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

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

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

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

當(dāng)我們?cè)趹?yīng)用程序Launcher的桌面空白處長按觸摸時(shí),會(huì)出現(xiàn)一個(gè)對(duì)話框,提示選擇要添加的桌面組件,如下圖所示

選擇快捷方式后,會(huì)彈出一個(gè)對(duì)話框,顯示出了可添加快捷方式的Activity所屬的應(yīng)用程序的圖標(biāo)和名稱的列表。當(dāng)我們想把添加快捷方式的Activity添加到這一列表時(shí),只需要在這個(gè)Activity注冊(cè)時(shí)添加一個(gè)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>

運(yùn)行結(jié)果:

希望本文所述對(duì)大家的Android程序設(shè)計(jì)有所幫助。

相關(guān)文章

最新評(píng)論

蓬安县| 庆安县| 皋兰县| 夏津县| 阿拉善右旗| 望奎县| 封丘县| 阿鲁科尔沁旗| 仪征市| 板桥市| 祁门县| 恩平市| 泸水县| SHOW| 太仆寺旗| 吉林省| 梓潼县| 沅江市| 平潭县| 黑河市| 寻甸| 鹿邑县| 阳曲县| 麟游县| 阜平县| 临桂县| 无极县| 府谷县| 武邑县| 安陆市| 江西省| 汽车| 噶尔县| 伊吾县| 萨嘎县| 化德县| 德州市| 三江| 营山县| 伊金霍洛旗| 沐川县|