tags:

views:

35

answers:

1

Hello, I have two activities. The first activity display list of the users with short info. And after select some user I go to the second activity for display full info about this user. For send event I used startActivityForResult(); for receive event in socond activity and added public void onActivityResult(int requestCode, int resultCode, Intent data). After start project I send intend from first activity and I do not receive in the second :(. How I can receive sent event in second activity? Thank you...

+1  A: 

You implement onActivityResult in the first activity in order to get the result from the sub-activity you've started. In your sub-activity you receive the event in the onCreate method:

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    final Intent intent = getIntent();

    // Do some setup based on the action being performed.

    final String action = intent.getAction();
    if (action.equals()) {
    }

}

I recommend that you have a look at the Notepad sample to see how things work. startActivityForResult may not be needed - startActivity should be enough. You usually don't return something from the item view to the list view.

kgiannakakis