最新国产好看的视频,伊人天堂AV在线,国产Aaaaaa视频,蜜臀视频在线观看一区,人妻av色图,密臀久久久精品影片,青青视频免费观看毛片,久草在线观看视,国产三级精品色情在线

Android實現(xiàn)向Launcher添加快捷方式的方法

 更新時間:2015年09月27日 12:57:52   作者:Ruthless  
這篇文章主要介紹了Android實現(xiàn)向Launcher添加快捷方式的方法,涉及Android添加快捷方式的相關技巧,具有一定參考借鑒價值,需要的朋友可以參考下

本文實例講述了Android實現(xiàn)向Launcher添加快捷方式的方法。分享給大家供大家參考。具體如下:

當我們在應用程序Launcher的桌面空白處長按觸摸時,會出現(xiàn)一個對話框,提示選擇要添加的桌面組件,如下圖所示

選擇快捷方式后,會彈出一個對話框,顯示出了可添加快捷方式的Activity所屬的應用程序的圖標和名稱的列表。當我們想把添加快捷方式的Activity添加到這一列表時,只需要在這個Activity注冊時添加一個Action為android.intent.action.CREATE_SHORTCUT的IntentFilter就可以了。

ShortCutAction類:

package com.ljq.action;
import android.app.Activity;
import android.os.Bundle;
/**
 * 向Launcher添加快捷方式
 * 
 * @author jiqinlin
 * 
 */
public class ShortCutAction extends Activity {
  @Override
  public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.main);
  }
}

清單文件:

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
  package="com.ljq.action" android:versionCode="1"
  android:versionName="1.0">
  <application android:icon="@drawable/icon"
    android:label="@string/app_name">
    <activity android:name=".ShortCutAction"
      android:label="@string/app_name">
      <intent-filter>
        <action android:name="android.intent.action.MAIN" />
        <category
          android:name="android.intent.category.LAUNCHER" />
      </intent-filter>
      <intent-filter>
        <action
          android:name="android.intent.action.CREATE_SHORTCUT" />
      </intent-filter>
    </activity>
  </application>
  <uses-sdk android:minSdkVersion="7" />
</manifest>

運行結果:

希望本文所述對大家的Android程序設計有所幫助。

相關文章

最新評論

永丰县| 临西县| 紫金县| 乌兰县| 奉节县| 永宁县| 庆安县| 乐安县| 曲阜市| 宁晋县| 孝义市| 齐齐哈尔市| 潢川县| 达孜县| 新平| 金乡县| 泌阳县| 灌阳县| 乌苏市| 两当县| 隆尧县| 玉门市| 南漳县| 定安县| 井研县| 揭东县| 浦县| 南汇区| 麦盖提县| 福贡县| 绍兴县| 康乐县| 密山市| 定边县| 新泰市| 和田市| 绥中县| 丹江口市| 泽库县| 天镇县| 原阳县|