Monthly Archives: March 2014

How to use AsyncTask in Android?

Android implements single thread model and whenever an android application is launched, a thread is created. Assuming we are doing network operation on a button click in our application. On button click a request would be made to the server and … Continue reading

Posted in Uncategorized | Leave a comment

How to pass data from one activity to another in Android?

Lets suppose you have one EditText and one button in one activity and one text view in another activity. On clicking the button, text in Edit Text of activity one should become lable/ text of text view in another activity. … Continue reading

Posted in Uncategorized | Leave a comment

How to connect two activities in Android?

Define onClick attribute of button with function to be called as value of the attribute. <Button …. android:onClick = login />  where login is the name of function that is called when button is clicked.  Now define Intent object inside … Continue reading

Posted in Uncategorized | Leave a comment

How to use Auto Complete Edit Text in Android?

Get the object of AutoCompleteTextView. AutoCompleteTextView mAutoView = (AutoCompleteTextView)findViewById(R.id.autoCompleteTextView1); Create array of ArrayAdapter. ArrayAdapter<String> myAdapter = new ArrayAdapter<String>(this, android.R.layout.simple_list_item_1 ,new String[] {“delhi”,”delhi2″,”bangalore”,”mumbai”,”pune”});  Set the adapter of AutoCompleteTextView.          mAutoView.setAdapter(myAdapter); And you are done!

Posted in Uncategorized | Leave a comment