views:

764

answers:

2

For some reason, when I use the call, the result is always returned as 0. All I am doing is popup the selection box and then once the selection is made, the user hits the back button. Does anyone know what mistake I could be doing?

CALLING ACTIVITY:

Intent i = new Intent(this, Selection.class);
Log.d("Front-End", "Launching Activity");
startActivityForResult(i, SELECTION);

INVOKED ACTIVITY:

bundle.putStringArray("selections", selected_array);
Intent resultIntent = new Intent();
resultIntent.putExtras(bundle);
setResult(RESULT_OK, resultIntent);
finish();

Any suggestions? If I include the finish() call, it gives me the following:

W/ActivityManager( 1030): Duplicate finish request for HistoryRecord{44802c90 com.android.TVitter/.Selection}
A: 

Ok don't flame at me now. It took me two hours to debug this :( Just writing it down so that others won't make this stupid mistake. I had to put an "OK" button and then handle the event instead of letting the user press the "Back" button on the phone. It was an obvious thing but for some reason I missed it...

Legend
+1  A: 

You could also implement Activity.onBackPressed() if you want to return some specific data from the activity when the back button is pressed. It looks like that's only available with 2.0 though.

Erich Douglass