View RSS Feed

Android Developer

  1. Starting an Android Activity for a Result

    by , 02-11-2012 at 10:56 AM
    Start the activity using startActivityForResult() when you want to get a result from the activity. Implement the onActivityResult() method to get the result from activity. In this method, subsequent activity will return result in Intent.

    In below code, we want to pick the contact.

    Java Code: This is the code to start an activity for a result
    private void pickContact() {
        // Create an intent to "pick" a contact, as defined by the content provider URI
        Intent intent = new Intent(Intent.ACTION_PICK,
  2. Starting an Android Activity

    by , 02-11-2012 at 10:53 AM
    startActivity() method is called when a new activity is started. Intent object is passed as parameter and it describes your activity. What actions you want to perform are described by this intent. Also data used by an activity is carried by this intent.

    For launching a new activity, create an intent that describes the activity using the class name. Following code explains how one activity can start a new activity.

    Java Code: This is the code to create a new Intent
    Intent intent = new Intent(this, SignInActivity.class);