Here I would like to share my experience to start my first android application in my android phone.
I was very curious to see my application on my android phone, so I start to install my application on my phone. In this process I try number of methods to install my android application on my phone, but my works are helpless. Then finally I tried one method this time my application has successfully installed on my phone. Here I share the steps I followed.

Steps 1:
Create your android virtual device exactly same as your android mobile version.

Steps 2:
Run your project or press Ctrl + f11

Step 3:
In your project bin folder file has been created with your application name .apk
Get the .apk file from the folder

Step 4:
Just copy the file to your mobile phone by sending the .apk file to your phone any method you can follow to get the apk file to your phone.
Then the application will be installed on your phone.. That’s it.

Any doubts post your comments here…….


Here I would like to share the usage of shared preference in android application. Basically in all application we need option to store a common data throughout the application. In android if you such a option then you can use shared preference method.
By using shared preference you can save the data in the three different types of ways.
1. Share data only on single activity
2. Share data on all activities within the application.
3. Share data between the different applications on the device.

First we see the different types of mode used shared preference.

MODE_PRIVATE-This Mode creates the file and it is used within the application.
MODE_WORLD_READABLE- This mode creates the file and it’s readable from other application in the device.
MODE_WORLD_WRITEABLE - This mode creates the file and it’s writable from other application in the device.



Storing Data in Activity Level:
SharedPreferences mypref=getPreferences(Context.MODE_PRIVATE);
        SharedPreferences.Editor editor= mypref.edit();
        editor.putString("user", "pass");
        editor.commit();

Retrieve the data in same activity:
SharedPreferences mypref=getPreferences(Context.MODE_PRIVATE);
           String val=mypref.getString("user", null);

Storing Data across different activity Level:
Here we can get storage  data from any activity within the application
SharedPreferences mypref= getSharedPreferences("user", Context.MODE_PRIVATE);
        SharedPreferences.Editor editor=mypref.edit();
        editor.putString("user1", "test1");
        editor.putString("user2", "test2");
        editor.putString("user3", "test3");
        editor.commit();


Retrieve Data across different activity Level::
By using the below code we can get the data from the shared preference.
SharedPreferences mypref= getSharedPreferences("user", Context.MODE_PRIVATE);
           String val=mypref.getString("user1", null);



Store Sharing data across application level :
Here by using the below code if we store the data then we can get the data from the different or another application. This can be achieved by using the package name.
Here I have mention the two application of package name
1. com.sample.demoapp1
2. .com.sample.demoapp2
SharedPreferences mypref= getSharedPreferences("user", Context.MODE_WORLD_READABLE);
        SharedPreferences.Editor editor=mypref.edit();
        editor.putString("user1", "test1");
        editor.commit();

Retrieve Data across application level
Context cont;
                            cont = createPackageContext("com.sample.demoapp1", 0);
                        SharedPreferences mypref=cont.getSharedPreferences("user", Context.MODE_PRIVATE);
                        String x= mypref.getString("user1", null);
                        txt.setText(x);

Here I get the data from the application dempapp1 from demoapp2
Note:For sharing to application level data must store with the mode of Context.MODE_WORLD_READABLE then only it can access from the other application.

If you have any doubts regard using shared preference post your comments here……..


Hi.
Recently I had work with activity with listview. Activity I have a case to add button on listview, so I design custom layout with button and textview.my requirement has when on listview or button I need to get the id from the row and move to next activity.
In code I used only activity and arrayadapter to setadapter on listview

Already I wrote some articles about listview please refe it..
http://www.dotnetcode.in/2012/07/showing-context-menu-in-single-click-on.html

Requirement:
I have a requirement if the user clicks on button I need to get the id from the row and move on to another activity.

Problem:
Normally In listview without using button you can call the method OnItemClickListener
By using this one we can easily get the position and move to the next activity. But if you use button on listview this event will not fire on listview.

Solution:
By made big search on Google I found a simple and best solution to solve my requirement.
Intially you need add the two things in xml in button,then only OnItemClickListener
will work on listview.
android:focusable="false"
android:focusableInTouchMode="false"
Next one we want to make enable the button click event on list view
For that another line on xml button layout
android:onClick="myClick"

The final code will be looki like below one..
<Button
        android:id="@+id/btnaccno"
        style="?android:attr/buttonStyleSmall"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="View"
        android:focusable="false"
android:focusableInTouchMode="false"
 android:onClick="myClick"
        />

Then write the myclick function on the activity. If you want to get the postion of the row from the listview use lst.getPositionForView(v)
Here lst denotes the ListView
public void myClick (View v)
           {
               int position1 = lst.getPositionForView(v);           
                     Intent i=new Intent(viewacc.this,viewtran.class);
                     i.putExtra("no", position1);
                     startActivity(i);         
           }

Thatsit…Now I fulfill my requirement I need ,Incase if you have met same kind of problem I hope this article would help you,the reason I share the code is I spent more time search to find the solutions.i hope I will reduce someone spare time to search this one..
In case if you have any problem to follow this method post your comments here..i try to give my solution best…