0

I'm starting share dialog on item click this way:

Intent share = new Intent(Intent.ACTION_SEND);
share.setType("text/plain");
share.putExtra(Intent.EXTRA_TEXT,getResources().getString(R.string.share_messageToSend));
startActivity(Intent.createChooser(share,getResources().getString(R.string.share_app_title)));

On orientation change activity recreates, and this dialog after launching starts blinking(constantly recreating), but I need my activity to be recreated on orientation change. Thanks in advance.

Max Makeichik
  • 227
  • 4
  • 18
  • Even if activity doesn't recreate itself on orientation change, this happens. Dialog works normally when using fragments. If you want to use it in activity, you can create one custom, here is the link: https://clickclickclack.wordpress.com/2012/01/03/intercepting-androids-action_send-intents/ – Max Makeichik Feb 04 '15 at 11:54
  • That's not all atached there in the link, you should make a row layout "basiclistview.xml" by yourself. – Max Makeichik Feb 04 '15 at 11:57

1 Answers1

0

You can try something like this:

private Bundle mSavedInstanceState;

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    mSavedInstanceState = savedInstanceState;
}

@Override
protected void onResume() {
    super.onResume();

    if(mSavedInstanceState == null) {
        //show dialog here
    }
}
Dominik Suszczewicz
  • 1,469
  • 2
  • 16
  • 23