Best code examples for Android PackageManager.NameNotFoundException class (android.content.pm.PackageManager.NameNotFoundException)

These code examples were ranked by Codota’s semantic indexing as the best open source examples for Android PackageManager.NameNotFoundException class.
You can now enable Codota on your own code to easily search and navigate your Java codebase.

Android PackageManager.NameNotFoundException examples from Open Source projects
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;
Full Snippet Info
6
CodeRank
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; 
//            } 
Full Snippet Info
7
CodeRank
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);
Full Snippet Info
6
CodeRank
Related Android PackageManager.NameNotFoundException Questions & Answers:
See Code Examples for Android PackageManager.NameNotFoundException Methods: