开发者

Have a main Activity that calls another Activity

My Activity calls another Activity during which , the app should move to other activity and should not affect the main Activity.Should the main activity be onPause() ? and after the second Activity comes back to the Main Activity sho开发者_运维问答uld it have OnResume()?

if you have any example will be great.

thanks for helping!!!


No rather you should use startActivityforResult(intent, requestCode) to start the next activity

and then override

protected void onActivityResult( final int requestCode,
                         final int resultCode, 
                      final Intent data)

See Returning a Result from a Screen

That way you will know which activity was called before returning to main


If you are using Intents, there is no need for pause and resume, provided the flow of your activity is fine. Suppose you are going from A to B, all you do is mention the current activity name and the next activity where it should go. For Ex: Intent i = new Intent(ClassA.this,ClassB.class); where you are in class A and you are going to classB

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜