<rt id="bn8ez"></rt>
<label id="bn8ez"></label>

  • <span id="bn8ez"></span>

    <label id="bn8ez"><meter id="bn8ez"></meter></label>

    溫馨提示:您的每一次轉(zhuǎn)載,體現(xiàn)了我寫此文的意義!!!煩請您在轉(zhuǎn)載時(shí)注明出處http://www.tkk7.com/sxyx2008/謝謝合作!!!

    雪山飛鵠

    溫馨提示:您的每一次轉(zhuǎn)載,體現(xiàn)了我寫此文的意義!!!煩請您在轉(zhuǎn)載時(shí)注明出處http://www.tkk7.com/sxyx2008/謝謝合作!!!

    BlogJava 首頁 新隨筆 聯(lián)系 聚合 管理
      215 Posts :: 1 Stories :: 674 Comments :: 0 Trackbacks
    創(chuàng)建快捷方式的主Activity
    package com.zhy.weather;

    import android.app.Activity;
    import android.content.Intent;
    import android.os.Bundle;
    import android.os.Handler;
    import android.os.Parcelable;

    public class SplashActivity extends Activity {
        
        @Override
        
    protected void onCreate(Bundle savedInstanceState) {
            
    super.onCreate(savedInstanceState);
            
            
    final Intent intent=getIntent();
            
    final String action=intent.getAction();
            
            
    //設(shè)置允許創(chuàng)建快捷方式
            if(Intent.ACTION_CREATE_SHORTCUT.equals(action)){
                setupShortcut();
                finish();
                
    return;
            }
            
            
            setContentView(R.layout.splash);
            
    new Handler().postDelayed(new Runnable() {
                
                @Override
                
    public void run() {
                    SplashActivity.
    this.startActivity(new Intent(SplashActivity.this, MainActivity.class));
                    SplashActivity.
    this.finish();
                }
            }, 
    2000);
        }

        
    //創(chuàng)建快捷方式
        private void setupShortcut() {
            
    //目標(biāo)Intent 打開快捷方式要啟動的那個intent
            Intent shortcutIntent = new Intent(Intent.ACTION_MAIN);
            shortcutIntent.setClassName(
    thisthis.getClass().getName());

            
    // Then, set up the container intent (the response to the caller)

            Intent intent 
    = new Intent();
            intent.putExtra(Intent.EXTRA_SHORTCUT_INTENT, shortcutIntent);
            intent.putExtra(Intent.EXTRA_SHORTCUT_NAME, 
    "小程序");
            Parcelable iconResource 
    = Intent.ShortcutIconResource.fromContext(this,  R.drawable.app);
            intent.putExtra(Intent.EXTRA_SHORTCUT_ICON_RESOURCE, iconResource);

            
    // Now, return the result to the launcher

            setResult(RESULT_OK, intent);
        }
        
        
        
    }

    AndroidManifest.xml
    <activity
                
    android:name=".SplashActivity" >
                
    <intent-filter >
                    
    <action android:name="android.intent.action.MAIN" />
                    
    <category android:name="android.intent.category.LAUNCHER" />
                
    </intent-filter>
            
    </activity>
            
            
    <!-- 創(chuàng)建桌面快捷方式 -->            
            
    <activity-alias android:name=".CreateShortcuts"
                android:targetActivity
    =".SplashActivity">
                
    <intent-filter>
                    
    <action android:name="android.intent.action.CREATE_SHORTCUT" />
                    
    <category android:name="android.intent.category.DEFAULT" />
                
    </intent-filter>
            
    </activity-alias>   
    重點(diǎn)是注意activity-alias中的部分
    android:name 就是取個別名的意思
    android:targetActivity=".SplashActivity" 指定目標(biāo)Activity
    <action android:name="android.intent.action.CREATE_SHORTCUT" />指定該action才可以被android系統(tǒng)檢索到

    posted on 2011-12-13 14:03 雪山飛鵠 閱讀(1393) 評論(0)  編輯  收藏 所屬分類: android
    主站蜘蛛池模板: 久久不见久久见免费影院www日本| 最近中文字幕mv免费高清视频8| 国产亚洲精品成人久久网站 | 四虎国产精品免费视| 亚洲国产成人精品女人久久久 | 亚洲日韩精品国产3区 | 色拍自拍亚洲综合图区| 亚洲欧洲国产经精品香蕉网| 亚洲熟伦熟女专区hd高清| 国产精品亚洲色图| 免费视频一区二区| 成人爽A毛片免费看| 久久99亚洲综合精品首页 | 亚洲五月综合网色九月色| 亚洲av片在线观看| 久久午夜羞羞影院免费观看| 免费特级黄毛片在线成人观看| 亚洲精品无码不卡在线播HE| 亚洲无砖砖区免费| 国产永久免费高清在线| 暖暖日本免费在线视频| 亚洲一区二区三区日本久久九| 亚洲精品一卡2卡3卡四卡乱码| 久久国产色AV免费看| 亚洲成a人片在线观看久| 亚洲自国产拍揄拍| 国产成人精品免费久久久久| 四虎影视精品永久免费网站| 亚洲综合激情九月婷婷| a毛片免费在线观看| 亚洲A∨午夜成人片精品网站| 国产精品亚洲综合五月天| 亚洲一区免费视频| 午夜网站在线观看免费完整高清观看| 丝袜捆绑调教视频免费区| www在线观看免费视频| selaoban在线视频免费精品| 久久青草精品38国产免费| 免费A级毛片无码A∨| 亚洲中文字幕久久精品无码APP| 美女裸体无遮挡免费视频网站|