android判断是否已经存在快捷图标

来源:互联网 发布:linux网卡配置文件详解 编辑:程序博客网 时间:2024/06/13 07:55
/**      * 判断是否已有快捷方式      *      * @return      */     private boolean isInstallShortcut() {            // TODO Auto-generated method stub            boolean isInstallShortcut = false;            final ContentResolver cr = getContentResolver();            final String AUTHORITY = "com.android.launcher2.settings" ;            final Uri CONTENT_URI = Uri. parse("content://" + AUTHORITY                     + "/favorites?notify=true");           Cursor c = cr.query(CONTENT_URI,                      new String[] { "title", "iconResource" }, "title=?",                      new String[] { getResources().getString(R.string.app_name ) },                      null);            if (c != null && c.getCount() > 0) {                 isInstallShortcut = true;           }            return isInstallShortcut;     }


0 0