I have an activity, which when starting (onCreate or onStart) needs to manipulate some views, and then maybe immediately starts another activity (a interstitial ad in its own activity).
There seems to be a problem with the order/concurrency: The ad activity is opened, and then the manipulated view R.id.productlist_filterbar from the previous activity is drawn on top of the interstitial ad activity.
(Simplified) code:
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.productlist);
// Do some init stuff ..
// Manipulate the GUI
findViewById(R.id.productlist_filterbar).setVisibility(View.VISIBLE);
// If executed, then a new intent is fired in here to open the interstitial ad
if (..we have an ad..) {
Intent i = new Intent(this, AdViewActivity.class);
i.setFlags(Intent.FLAG_ACTIVITY_NO_HISTORY);
startActivity(i);
overridePendingTransition(R.anim.fadein, 0);
}
}
What happens when I call startActivity() while there are still pending GUI modifications?
And, what would be the best solution for this case?
Thanks for any help!
I would have a flag set in
onAttachedToWindow()callback and then check for this flag inonWindowFocusChanged()if set then start the ad activity and reset the flag.