哨兵职责的内容是什么:[z]有关应用的隐式和不一样的启动方式

来源:百度文库 编辑:偶看新闻 时间:2024/05/07 17:07:01

有关应用的隐式和不一样的启动方式

分类: android 2011-11-23 14:41 48人阅读 评论(0) 收藏 举报

学习别人的代码:

一、隐式启动应用的方式,就是在界面上你看不到那个应用

[java] view plaincopyprint?

  1.             android:theme="@style/Transparent" android:launchMode="singleTask">  
  2.               
  3.                   
  4.                   
  5.               
  6.           

上面就是隐式的设置方式

二、另一种启动Activity的方式

[java] view plaincopyprint?

  1. 在PhoneWindowManager.java的init方法中  
  2.         mPoiSearchIntent =  new Intent(Intent.ACTION_MAIN, null);  
  3.         mPoiSearchIntent.addCategory(Intent.CATEGORY_POI_SEARCH);  
  4.         mPoiSearchIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK  
  5.               | Intent.FLAG_ACTIVITY_RESET_TASK_IF_NEEDED);  
  6. launchPoiSearchFromHotKey方法中  
  7. int result = ActivityManagerNative.getDefault()  
  8.                           .startActivity(null, mPoiSearchIntent,  
  9.                                   mPoiSearchIntent.resolveTypeIfNeeded(mContext.getContentResolver()),  
  10.                                   null, 0, null, null, 0, true, false);  
  11.                           if (result == IActivityManager.START_RETURN_INTENT_TO_CALLER) {  
  12.                               return;  
  13.                           }  
[java] view plaincopyprint?
  1.  public static final String CATEGORY_POI_SEARCH = "android.intent.category.POI_SEARCH";  

应用中

[java] view plaincopyprint?

  1. android:launchMode="singleTask">  
  2.       
  3.           
  4.                 
  5.           
  6.       
  7.   

重点看