1 private void goToMarket(String packageName) { 2 try { 3 Intent intent = new Intent(Intent.ACTION_VIEW); 4 intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); 5 intent.setData(Uri.parse("market://details?id=" + packageName)); 6 startActivity(intent); 7 } catch (ActivityNotFoundException e) { 8 Toast.makeText(this, R.string.toast_no_market_found, Toast.LENGTH_SHORT).show(); 9 } 10 }
一般是到market上查看本应用程序:
1 goToMarket(getPackageName());