Advertisement
Guest User

Untitled

a guest
Jun 4th, 2011
222
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.95 KB | None | 0 0
  1. package com.gflam.test;
  2.  
  3. import android.app.Activity;
  4. import android.content.Intent;
  5. import android.os.Build;
  6. import android.os.Bundle;
  7.  
  8. public class Open extends Activity {
  9.     /** Called when the activity is first created. */
  10.     @Override
  11.     public void onCreate(Bundle savedInstanceState) {
  12.         super.onCreate(savedInstanceState);
  13.         setContentView(R.layout.main);
  14.         showInstalledAppDetails("com.android.settings");
  15.     }
  16.     public void showInstalledAppDetails(String packageName) {
  17.         Intent intent = new Intent();
  18.         final int apiLevel = Build.VERSION.SDK_INT;
  19.             final String appPkgName = (apiLevel == 8 ? "pkg" : "com.android.settings.ApplicationPkgName");
  20.             intent.setAction(Intent.ACTION_VIEW);
  21.             intent.setClassName("com.android.settings", "com.android.settings.InstalledAppDetails");
  22.             intent.putExtra(appPkgName, packageName);
  23.         startActivity(intent);
  24.     }
  25. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement