Friday, November 25, 2011

Treat for Tester friends :)

Testing is one of the most critical aspect of any application development.
So, Here is something for all my tester friends who are in high need of some image capture too for android.

I have attached two files Abhi.py and Abhi.bat,

All you have to do is to add these files in your exsisting tools folder of Android-sdk

and run abhi.bat

WHAT WILL IT DO?

well ..good question :)
It ask you some basic params like (How many snapshots you want to take and where you want to save)
Remeber 1 snapshot = 1sec so if you want to record your application on device you can simply start the abhi.bat with 500 value and it will keep on taking the snaps.

By default it will create capture folder in your D drive and if this folder already exsists it will override that folder (so do remember to take backups )

You can terminate the application t any point of time my simply closing thw window opened by this bat. :)


Abhi.py 
Abhi.bat

Hope it comes use full   :)

Wednesday, November 16, 2011

Open Source Library for Parsing data

Hey everyone,
Today i have launched yet another library for all developers.
                         Of'course its free :)
The library indends to solve a redundant problem of writing parsers in order to parse downloaded XML file.

Please let me know your suggestions in order to improve it further more.
You can get the source at xml-data-parser Source Link.


Hope it will come handy when you need to parse multiple XML's.
And do not forget to report a bug in case you face any issue. You are most welcome to contribute if you feel like doing the same.


Please let me know if you are interested in enhancing the library further more.



Tuesday, November 15, 2011

Adding dynamic data to spinners (Android)


Many a times we find that it becomes quite hard to work with some simplest looking stuffs, and then we try to find out the hardest possible ways for working with them.

I wont say its easiest but yeah its quite handy for people who wanna show dynamic data in a Spinner widget in Android.

Assumptions:
1. You are using ArrayList<DataType> dynamicData;
2. You have overriden toString function in your data class which holds the dynamic data.
class DataType{
   String spinnerElement; 


   @Override
   public String toString(){
        return spinnerElement;
   }
}
3. You know Android development :D


///////////////////////////////////////////////////////////////////////IMPLEMENTATION///////////////////////////////////////////////
Object[] items = dynamicData.toArray();
String[] elements= new String[items.length + 1];
for (int iTemp = 0; iTemp < items.length + 1; iTemp++) {
if (i == 0) {
elements[i] = "Please select";
} else {
elements[i] = ((DataType) items[i - 1]).toString();
}
}
ArrayAdapter<String> arrayAdapter = new ArrayAdapter<String>(getApplicationContext(),
android.R.layout.simple_spinner_item, prices);


// you can also use the default android.R.layout.single_line_spinner
// In order to support multi-line selection i have modified the source of default.


arrayAdapter .setDropDownViewResource(R.layout.single_line_spinner);
((Spinner) findViewById(R.id.mySpinner)).setAdapter(arrayAdapter );

//////////////////////////////////////////////////////////////////////////THATS IT /////////////////////////////////////////////////////////////////

R.layout.single_line_spinner
/**
Do not modify this source as the spinner uses this id only
*/

<?xml version="1.0" encoding="utf-8"?>
<CheckedTextView xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@android:id/text1"
    style="?android:attr/spinnerDropDownItemStyle"
    android:singleLine="false"
    android:layout_width="fill_parent"
    android:layout_height="?android:attr/listPreferredItemHeight"
    android:ellipsize="marquee" />

Let me know what you think about it or if have any better idea for the same.