Experts:

My MainActivity launches a SubActivity by calling:
startActivityForResult(intent, REQ_CODE);

The SubActivity shows a dialog that has two buttons: Yes, No

For the dialog, I've the following code:

...
...
public void onClick(DialogInterface dialog, int whichButton) {
        /* User clicked OK */
        setResult(DialogInterface.BUTTON_POSITIVE);
        finish();
}
...
...

Similar code for handling NEGETIVE result as well.

In my MainActivity, I've onActivityResult(...) method defined to
handle appropriate result code (which is a very standard code).

My manifest has the following entry for the SubActivity:

        <activity android:name=".activity.ShowDialog"
android:theme="@android:style/Theme.NoTitleBar">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
                <category
android:name="android.intent.category.DEFAULT" />
            </intent-filter>
        </activity>

I was expecting that when the user hits either Yes or No button, the
calling activity's onActivityResult(...) methid would be fired with
all the intended parameters. But, I found that the calling activity
(MainActivity) is not waiting for  the SubActivity to finish (hiting
Yes/No button). I thought, untill an appropriate button is pressed it
has no result to be given back to the calling activity and that makes
sense for a method like startActivityForResult(...).

My intention is to launch an another activity based on the result
received from the SubActivity, but it is always landing up in a blank
page (reason is obvious). This is such a common scenario, I'm sure
that I have made a mistake somewhere. Need your help.

Kind Regards,
Krish

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to