How to build a RATE button in Android

import android.content.Context;
import android.content.Intent;
import android.net.Uri;
public class danhgia {
 public static void goToApp(Context context){
 final String appPackageName = context.getPackageName();
 try {
 context.startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse("market://details?id=" + appPackageName)));
 } catch (android.content.ActivityNotFoundException anfe) {
 context.startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse("http://play.google.com/store/apps/details?id=" + appPackageName)));
 }
 }
 public static void goToStore(Context context){
 final String nameDevIdGP = "DreamRelax";
 try {
 context.startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse("market://search?q=pub:" + nameDevIdGP)));
 } catch (android.content.ActivityNotFoundException anfe) {
 context.startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse("http://play.google.com/store/apps/developer?id=" + nameDevIdGP)));
 }
 }
 public static void shareLinkGP(Context ct) {
 Intent intent = new Intent(Intent.ACTION_SEND);
 intent.setType("text/plain");
 intent.putExtra(Intent.EXTRA_TEXT, "http://play.google.com/store/apps/details?id=" + ct.getPackageName());
 ct.startActivity(intent);
 }
}

<?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android="http://schemas.android.com/apk/res/android"
 xmlns:app="http://schemas.android.com/apk/res-auto"
 xmlns:tools="http://schemas.android.com/tools"
 tools:context="com.ghostprank.duoimuoi.DuoiMuoi">
 <item
 android:id="@+id/main_action_share"
 android:orderInCategory="999"
 app:showAsAction="never"
 android:title="Share"
 tools:ignore="HardcodedText" />
 <item
 android:id="@+id/action_rate"
 android:orderInCategory="999"
 android:title="Rate 5*"
 app:showAsAction="never"
 tools:ignore="HardcodedText" />
 <item
 android:id="@+id/xemthem"
 android:orderInCategory="999"
 android:title="More App"
 app:showAsAction="never"
 tools:ignore="HardcodedText" />
</menu>
Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s