Hello guyz,

I am facing problem with starting MainActivity again and perform
remaining tasks, after returning from startActvityForREsult()

My code structrue goes like:

MainActivity{
  // this method calls different activities of my application based on
the result of onActivityResult
   startCustomActivity() ;
 }

//Code goes like :
Class MainActivity extends Activity{

 startCustomActivity()
 {

 if( <Condition1>) {
       Intent subIntent = new Intent();
 
subIntent.setClassName(getApplicationContext(),"com.android.SubActivity");
 subIntent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
 startActvityForResult(subIntent);
startActivityForResult(subIntent,Constant.REQUEST_SUB_SCREEN);  //
REQUEST_SUB_SCREEN = 20;
  }

else if (<Condition 2>) {
  //start activity 2
 startActivityForResult(,..,..,);
}

else if (<Condition3>) {
   //start activity 3
 startActivityForResult(,..,..,);
}


else if (<Condition 4>) {
   //start activity 4

}

}

onActivtyResult(,..,..,)
{
   if(requestCode == Constant.REQUEST_SUB_SCREEN)
   {
        if(responseCode == RESULT_OK)
        {
            startCustomActivity(getIntent().getAction(), getIntent());
        }
   }
}

AndroidManifest.xml

<activity android:name="com.android.SubActivity"
                        android:theme="@android:style/
Theme.Translucent.NoTitleBar.Fullscreen"
                        android:screenOrientation="sensor" 
android:label="@string/
app_name1"
                        android:icon="@drawable/qo"
                  <!--    android:noHistory = true  this is not
working as well -->
                          >

                <intent-filter>
                <action android:name="android.intent.action.VIEW" />
                <category
android:name="android.intent.category.DEFAULT" />
            </intent-filter>
                </activity>


SubActivity.java
//Here on GoBack button, I want to send control back to calling
Activity ii.e. MainActivity
/// code starts
GoBackButton.setOnClickListener(new OnClickListener() {
                        public void onClick(View arg0) {
                                setResult(RESULT_OK);
                                finish();   <---------------- causing
problem
                        }
                });

//code ends

Whats happening is ...

My control is going back to MainActiivty on pressing GOBack button,
but the problem is since I am finishing SubAcitivty in GoBackButton
itself, it takes some time for control to go back to
onActivityResult() and do remaining task and launch another activity
say Activity 2,
as a result of which on pressing GoBack button, for few seconds ,
homeScreen (device homescreen) is dispalyed and then later, my
activity2 gets launched.

I want to remove that delay between GoBack button and launch of
Activity2

I wan to end SubAcitivty as soon as user navigates away from this
activity and send back control to calling activity. I also tried
setting android:noHistory = true instead of calling finish() but
nothing is working.

Please help :(


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

Reply via email to