应用程序的图标内容和图标下面的文字内容都是从PackageManager中获取到的。
如果Launcher启动时,应用程序的包名和类名因为某种原因没有在PackageManager中找到,桌面就不会显示它的图标。如果类名和包名找到了,但是图标没有找到,会显示Android默认的小机器人图标。请问上面的话中 “如果Launcher启动时,应用程序的包名和类名因为某种原因没有在PackageManager中找到,桌面就不会显示它的图标。”这句的packagemanager是在哪的?意思是如果在应用的启动activity中如果没有使用packagemanager调用,即使修改了default_workplace.xml也无法在桌面上显示应用图标吗?还是说这个PackageManager在别的地方高手有别的方法让应用在开机桌面上显示快捷方式吗

解决方案 »

  1.   

    给你一些参考代码:我实现的是点击按钮 会在home界面图标,点击图标就可以进入程序。应该算你所说的快捷方式把!@Override
    public void onClick(View v) {
    Intent addShortcut = new Intent(ACTION_ADD_SHORTCUT);// SELF_BROAD
    // ACTION_ADD_SHORTCUT
    String numToDial = null;
    Parcelable icon = null;
    switch (v.getId()) {
    case R.id.Button01: {
    numToDial = "110";
    icon = Intent.ShortcutIconResource.fromContext(this,
    R.drawable.important);
    }
    break;
    case R.id.Button02: {
    numToDial = "119";
    icon = Intent.ShortcutIconResource.fromContext(this,
    R.drawable.importantor);
    }
    break; }// switch addShortcut.putExtra(Intent.EXTRA_SHORTCUT_NAME, numToDial); //directCall.setData(Uri.parse("tel://" + numToDial));
    directCall.putExtra("xxx",numToDial);
    addShortcut.putExtra(Intent.EXTRA_SHORTCUT_INTENT, directCall);
    addShortcut.putExtra(Intent.EXTRA_SHORTCUT_ICON_RESOURCE, icon);
    sendBroadcast(addShortcut);
    }