zoukankan      html  css  js  c++  java
  • android144 360 快捷方式

    package com.example;
    
    import android.net.Uri;
    import android.os.Bundle;
    import android.app.Activity;
    import android.content.Intent;
    import android.graphics.Bitmap;
    import android.graphics.BitmapFactory;
    import android.view.Menu;
    
    //权限:<uses-permission android:name="com.android.launcher.permission.INSTALL_SHORTCUT"/>
    public class MainActivity extends Activity {
    
        @Override
        protected void onCreate(Bundle savedInstanceState) {
            super.onCreate(savedInstanceState);
            setContentView(R.layout.activity_main);
            
            Intent intent = new Intent();
            intent.setAction("com.android.launcher.action.INSTALL_SHORTCUT");
            
            /**
             * 1  你想干什么事情
             * 2  叫什么名字
             * 3  长什么样子
             */
            Intent dowhtIntent = new Intent();
            //告诉系统哥想打电话
            dowhtIntent.setAction(Intent.ACTION_CALL);
            //给谁打电话
            dowhtIntent.setData(Uri.parse("tel://110"));
            //叫什么名字
            intent.putExtra(Intent.EXTRA_SHORTCUT_NAME, "哈哈");
            //长什么样子
            intent.putExtra(Intent.EXTRA_SHORTCUT_ICON, 
                    BitmapFactory.decodeResource(getResources(), R.drawable.ic_launcher));
            
            intent.putExtra(Intent.EXTRA_SHORTCUT_INTENT, dowhtIntent);
            sendBroadcast(intent);
        }
    
        @Override
        public boolean onCreateOptionsMenu(Menu menu) {
            // Inflate the menu; this adds items to the action bar if it is present.
            getMenuInflater().inflate(R.menu.main, menu);
            return true;
        }
    
    }
  • 相关阅读:
    springboot之mybatis别名的设置
    webstorm
    万字长文把 VSCode 打造成 C++ 开发利器
    残差residual VS 误差 error
    参数与非参数的机器学习算法
    阿里云产品梳理
    aws产品整理
    Azure产品整理
    OpenStack产品摘要
    头条、美团、滴滴、阿里、腾讯、百度、华为、京东职级体系及对应薪酬
  • 原文地址:https://www.cnblogs.com/yaowen/p/5143720.html
Copyright © 2011-2022 走看看