Android PackageManager.NameNotFoundException - top ranked examples from Open Source projects

These code examples were ranked by Codota’s semantic indexing as the best open source examples for Android PackageManager.NameNotFoundException class.

This code example shows how to use the following methods:
 
    private String startApp(String appName) throws NameNotFoundException {
        Log.i(TAG, "Starting " + appName);
 
        if (!mNameToProcess.containsKey(appName))
            throw new NameNotFoundException("Could not find: " + appName);
 
        String process = mNameToProcess.get(appName);
        Intent startIntent = mNameToIntent.get(appName);
 
        AppLaunchRunnable runnable = new AppLaunchRunnable(startIntent);
        Thread t = new Thread(runnable);
        t.start();
        try { 
            t.join(JOIN_TIMEOUT);
        } catch (InterruptedException e) {
            // ignore 
        } 
 
        return process;
6
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:getMessage
		boolean isInstalled = false;         
		try {                   
			context.createPackageContext(packageName, Context.CONTEXT_IGNORE_SECURITY);
			isInstalled = true;                
		} catch (NameNotFoundException e) {  
		    Logger.error(e.getMessage(), e);
		} 
    
		return isInstalled;  
    } 
     
//    public boolean isInstalled(String packageName) { 
//    	boolean isInstalled = false;  
// 
//        List<PackageInfo> infoList = context.getPackageManager().getInstalledPackages(0); 
//        for (PackageInfo info : infoList) { 
//            if (info.packageName.equals(packageName)) { 
//            	isInstalled = true; 
//                break; 
//            } 
7
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:printStackTrace
This code example shows how to use the following methods:getMessage
This code example shows how to use the following methods:getMessage
      PackageManager manager = this.getPackageManager();
      PackageInfo info = manager.getPackageInfo(this.getPackageName(), 0);
 
      result = String.format("%s (%s)", info.versionName, info.versionCode);
    } catch (NameNotFoundException e) {
      Log.w(AboutActivity.class.toString(), "Unable to get application version: " + e.getMessage());
      result = "Unable to get application version.";
    } 
 
    return result;
  } 
 
  @Override 
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
 
    Window w = getWindow();
    w.requestFeature(Window.FEATURE_LEFT_ICON);
 
    setContentView(R.layout.about_activity);
6
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:printStackTrace
        try { 
          ActivityInfo info = pm.getActivityInfo(this.getComponentName(),
              PackageManager.GET_META_DATA);
          labelSeq = info.loadLabel(pm);
        } catch (NameNotFoundException e) {
          e.printStackTrace();
          return false; 
        } 
 
        String[] components = labelSeq.toString().split("/");
        if (components[components.length - 1].equals("Purgeable")) {
            return true; 
        } else { 
            return false; 
        } 
    } 
 
    private String getDialogMessage(boolean isOutOfMemory, int index) {
         StringBuilder sb = new StringBuilder();
         if (isOutOfMemory) {
6
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:getMessage
			final PackageManager packageManager = context.getPackageManager();
			return packageManager.getActivityInfo(new ComponentName(context, cls), 0);
		} 
		catch (NameNotFoundException e) {
			if(logger != null) {
				logger.error("Failed to locate info for activity [" +
						cls.getName() +
						"]", e);
			} 
			else { 
				SocializeLogger.e(e.getMessage(), e);
			} 
		} 
		 
		return null; 
	} 
 
	/* (non-Javadoc) 
	 * @see com.socialize.util.IAppUtils#isReceiverAvailable(android.content.Context, java.lang.Class) 
	 */ 
6
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:getMessage
 
        private void setIcon(ImageView icon, String pck, String activity) {
            try { 
                icon.setImageDrawable(manager.getActivityIcon(new ComponentName(pck, activity)));
            } catch (NameNotFoundException e) {
                Log.w(TAG, "could not find the icon for the activity: " + e.getMessage());
                icon.setImageDrawable(manager.getDefaultActivityIcon());
            } catch (IllegalArgumentException e) {
                e.printStackTrace();
            } 
        } 
    } 
 
    /* 
     * Parse the default XML for providers value. The XML should have the tag 
     * name similar to the columns' name in the DB 
     */ 
    protected ContentValues[] parseProviders(XmlPullParser xpp) {
        List<ContentValues> ret = new ArrayList<ContentValues>();
        ContentValues value = new ContentValues();
6
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:printStackTrace
		ApplicationInfo appInfo = null;
		PackageManager packMgmr = getPackageManager();
		try { 
			appInfo = packMgmr.getApplicationInfo(getPackageName(), 0);
		} catch (NameNotFoundException e) {
			e.printStackTrace();
			throw new RuntimeException("Unable to locate assets, aborting...");
		} 
		apkFilePath = appInfo.sourceDir;
		return (apkFilePath);
	} 
 
	private void setValuesToSharedMemory() { 
		final String languageCode = Locale.getDefault().getLanguage();
		GS2DJNI.createConstSharedData("ethanon.system.language", languageCode);
	} 
 
	private boolean verifyExternalStorageState() { 
		boolean externalStorageAvailable = false;
		boolean externalStorageWriteable = false;
6
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:printStackTrace
			try { 
				c = mAskAppContext.createPackageContext(mPackageName, PackageManager.GET_META_DATA);
				mPackageContext = new WeakReference<Context>(c);
			} catch (NameNotFoundException e) {
				// TODO Auto-generated catch block 
				e.printStackTrace();
			} 
		} 
		return c;
	} 
 
	public final int getSortIndex() { 
		return mSortIndex;
	} 
 
	public String getName() {
		return mName;
	} 
} 
5
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java

Related Android PackageManager.NameNotFoundException Questions & Answers:

See Code Examples for Android PackageManager.NameNotFoundException Methods: