startActivityForResult from ActivityGroup
Converting comments as answer,
Try using onResume()
to update UI of SummerCostScreen
how to call startactivityforresult from one activity to another within a activity group inside a tabwidget
Change startActivity to:
.startActivityForResult(i, .addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP));
then add this method to ActivityA:
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
// See which child activity is calling us back.
switch (resultCode) {
case RESULT_OK:
{
//processing code goes here
}
default:
break;
}
}
and then when finish() is called on Activity B you should hit the 'OnActivityResult' method. You can also send an intent back to main activity by calling:
setResult(Activity.Result_OK, intent);
on Activity B.
Android - startActivityForResult immediately triggering onActivityResult
You can't use startActivityForResult()
if your activity is being launched as a singleInstance
or singleTask
. standard
or singleTop
launch mode will fix the problem.
android: Activity.startActivityForResult() or ActivityGroup?
IMHO, none of the above.
Popping out of one activity into another briefly via startActivityForResult()
is fine...once. It gets cumbersome for users and developers alike when there are several.
Consider recasting your UI as a wizard, perhaps driven by a ViewFlipper
, so you can keep all of this in a single activity. It also provides the user with a recognized pattern for going back and forth within the chain of steps leading to them providing all of the information you need.
startActivityForResult not working TabGroupActivity in android
Your onActivityResult
is called on the ActivityGroup
and not on the subActivity
of your tabgroupActivity
.
So override the method onActivityResult
, and then create an abstract method
on the mother class of your SubActivities
( on the TabActivityGroup
i think ), and override it on each subActivity .
Android Use startActivityForResult from a nested activity in a tab.
Alright, I was able to find a solution to this problem.
First, I created another activity that I started using the basic startActivity() call I called a Result Controller. This does not pass any data back to the tabbed activity which means you don't have to worry about where it's going.
Second, I created a simple static data class which I called DataConnector. The ResultController would get the instance of the DataConnector and insert the Data there
Then, in the original activity(in the tabs) I implemented the onWindowFocusChanged method to determine when the user is back to it. I got the instance of DataConnector and was able to pull the data I needed out of there.
Related Topics
When Does Adt Set Buildconfig.Debug to False
Why Does Flag_Activity_Clear_Top Not Work
Add Support Library to Android Studio Project
Supportmapfragment.Getmap() Returns Null
Are There Conventions on How to Name Resources
Input Elements on Android 4.X Can Not Be Styled When Focused
Error: This Android Sdk Requires Android Developer Toolkit Version 22.6.1 or Above
Best Way to Show a Loading/Progress Indicator
Bottomsheetdialog with Transparent Background
Timepicker Dialog from Clicking Edittext
How to Animate a View in Android and Have It Stay in The New Position/Size
How to Handle Empty Response Body with Retrofit 2
What Is Use of Cursor in Android Development
Emulator: Warning: Quick Boot/Snapshots Not Supported on This Machine
How to Set Text Color of a Textview Programmatically
React Native Android Duplicate File Error When Generating APK