我有,当它被点击后,从我的窗口小部件启动我的应用程序的问题。下面是一些code的切
I am having problems launching my application from my widget when it's clicked upon. Here is a cut of some code
// Create an Intent to launch activity
Intent intent = new Intent(context, Entry_MainTabView.class);
PendingIntent pendingIntent = PendingIntent.getActivity(context, 0, intent, 0);
updateViews.setOnClickPendingIntent(R.id.Widget, pendingIntent);
现在采取的方案。我启动我的应用程序,退出到首页,然后点击我的小部件。它启动该应用程序的第二个实例,所以当我点击后退,应用程序消失并显示其他副本。我还是那句话打回,最后再回到主屏幕。
Now take the scenario. I launch my app, exit to the home page , then click on my widget. It launches a second instance of the application, so when I hit "back" , the application goes away and reveals the other copy. I then hit back again and finally go back to the homescreen.
我怎样才能让意图只有在没有在RAM中已经存在创建一个新的实例?
How can I make the Intent only create a new instance if none already exists in ram ?
推荐答案
你有没有看 singleInstance和singleTask活动的启动模式? 此摘录临Android的2 表示有确保只有一个小部件的运行实例没有任何记载的方法。
Have you looked at singleInstance and singleTask launch modes of an activity? This extract from Pro Android 2 indicates that there is no documented way of ensuring that there is only one instance of the widget running.
相关推荐
最新文章