Perform a generic search in Google Play - Android Intent

Android examples for Intent:App Market

Description

Perform a generic search in Google Play

Demo Code


//package com.java2s;
import android.app.Activity;
import android.content.Intent;
import android.net.Uri;

public class Main {
    /**/* w  w w. ja  v a2s  .  c o m*/
     * Perform a generic search in Google Play
     *
     * @param a
     * @param searchQuery
     */
    public static void searchInGooglePlay(Activity a, String searchQuery) {
        try {
            a.startActivity(new Intent(Intent.ACTION_VIEW, Uri
                    .parse("market://search?q=" + searchQuery)));
        } catch (android.content.ActivityNotFoundException anfe) {
            a.startActivity(new Intent(Intent.ACTION_VIEW, Uri
                    .parse("http://play.google.com/store/search?q=<query>"
                            + searchQuery)));
        }
    }
}

Related Tutorials