+ final void openGoogleShopper(String query) {
+ try {
+ activity.getPackageManager().getPackageInfo(GOOGLE_SHOPPER_PACKAGE, 0);
+ // If we didn't throw, Shopper is installed, so launch it.
+ Intent intent = new Intent(Intent.ACTION_SEARCH);
+ intent.setClassName(GOOGLE_SHOPPER_PACKAGE, GOOGLE_SHOPPER_ACTIVITY);
+ intent.putExtra(SearchManager.QUERY, query);
+ activity.startActivity(intent);
+ } catch (PackageManager.NameNotFoundException e) {
+ // Otherwise offer to install it from Market.
+ AlertDialog.Builder builder = new AlertDialog.Builder(activity);
+ builder.setTitle(R.string.msg_google_shopper_missing);
+ builder.setMessage(R.string.msg_install_google_shopper);
+ builder.setIcon(R.drawable.shopper_icon);
+ builder.setPositiveButton(R.string.button_ok, shopperMarketListener);
+ builder.setNegativeButton(R.string.button_cancel, null);
+ builder.show();
+ }
+ }
+