Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Intent.FLAG_ACTIVITY_FORWARD_RESULT Live Example In Android

Tags:

android

Can any one tell me the the working of Intent.FLAG_ACTIVITY_FORWARD_RESULT Live Example

now what I am doing just creating three activity that are A,B,C

so When I am Launching Application from activity A and from A I am Starting Activity B with startActivityForResult(Activity B) and there In B Activity I am starting activity C with Intent.FLAG_ACTIVITY_FORWARD_RESULT and finishing B Activity,so now from there in Activity C When I finished to Activity C it gives result back to the Activity A in onActivityResult().

So i want to know that is this the purpose of using this flag or that is something different and if I am wrong please let me know.

and please try to give answer with example.

like image 946
Virendra Pal Singh Avatar asked Nov 06 '14 10:11

Virendra Pal Singh


People also ask

What are intent flags in Android?

Use Intent Flags Intents are used to launch activities on Android. You can set flags that control the task that will contain the activity. Flags exist to create a new activity, use an existing activity, or bring an existing instance of an activity to the front.

What is Flag_activity_new_task?

The flags you can use to modify the default behavior are: FLAG_ACTIVITY_NEW_TASK. Start the activity in a new task. If a task is already running for the activity you are now starting, that task is brought to the foreground with its last state restored and the activity receives the new intent in onNewIntent() .

Which method of the Intent class allows you to pass information to the target?

putExtra method is used.


1 Answers

Virendra, your assumptions are correct. This gist demonstrates a simple use case: https://gist.github.com/mcelotti/cc1fc8b8bc1224c2f145. Please note the use of setResult() in ActivityC before it is finished.

like image 53
mageeky90 Avatar answered Jan 01 '23 22:01

mageeky90