search App From Market - Android android.content.pm

Android examples for android.content.pm:App

Description

search App From Market

Demo Code

import android.content.Context;
import android.content.Intent;
import android.content.pm.PackageManager;
import android.net.Uri;

public class Main {

  public static void searchAppFromMarket(Context context, String packName, int notFoundError) {

    Uri uri = Uri.parse("market://search?q=pname:" + packName);
    Intent intent = new Intent(Intent.ACTION_VIEW);
    intent.setData(uri);//from  ww w  .  j  a  va  2s . c  o m
    PackageManager pManager = context.getPackageManager();
    if (intent.resolveActivity(pManager) != null)
      context.startActivity(intent);


  }

}

Related Tutorials