2011-05-04 36 views
0

用例是:用戶打開設置 - >應用程序 - >管理應用程序 - >選擇一些應用程序 - >選擇「卸載」 - >確認用戶界面顯示「確定」和「取消」按鈕如何將任務帶到前臺

然後用戶按「Home」按鈕並顯示「Home」。

這裏是我的問題:如何以編程方式將「確認UI」帶到前臺? 謝謝!

回答

0

Gix答案看起來不錯。 一般而言,您可以啓動任何「活動」以將其置於前臺。

if (!Preferences.running || view == null) { 
      Intent intent = new Intent(Preferences.context,     YourActivity.class); 
      if (message != null) 
       intent = intent.putExtra("message", message); 
      // | Intent.FLAG_ACTIVITY_RESET_TASK_IF_NEEDED 
      intent = intent.setFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT);// Intent.FLAG_ACTIVITY_NEW_TASK 
      try { 
       Preferences.context.startActivity(intent); 
      } catch (Exception e) { 
       intent = intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK 
         | Intent.FLAG_ACTIVITY_RESET_TASK_IF_NEEDED); 
       Preferences.context.startActivity(intent); 
      } 
     } else 
      view.bringToFront(); 
相關問題