Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Deal with not working animations when activity is SingleInstance

I am developing an android app and I have used android:launchMode="singleInstance" for it,but as I activated it none of TransitionAnimation works and it makes my activity like this

enter image description here

In fact my main activity is singleinstane and when I want to lunch a new activity the new one does not work and ui breaks. well what can I do with it?Is there any way to have animations while singleinstace is activated? this is my code which lunches activity

 Intent intent = new Intent(context, ActivityMall.class);
                Bundle b = new Bundle();
                b.putParcelable("EXTRA_MALL",((Mall)v.getTag(R.id.TAG_MALL_ID)));
                b.putParcelable("EXTRA_Company",null);
                intent.putExtras(b);

                ActivityOptionsCompat options =
                        ActivityOptionsCompat.makeSceneTransitionAnimation((Activity) context,
                                (View)v.getTag(R.id.TAG_MALL_COVER2),   // Starting view
                                "profile1"    // The String
                                            );
                ActivityCompat.startActivity((Activity) context, intent, options.toBundle());

I read somewhere that I should set android:launchMode="singleTask" but I have no idea about its difference with singleinstance.. thanks very much

like image 999
Majid Hojati Avatar asked Oct 30 '16 07:10

Majid Hojati


1 Answers

Please refer this link.

SingleInstance is same as singleTask, except that the system doesn't launch any other activities into the task holding the instance. The activity is always the single and only member of its task; any activities started by this one open in a separate task.

Go ahead and use "singleTask" as launchMode your app will work fine.

like image 67
Ishaan Avatar answered Oct 05 '22 19:10

Ishaan