Java my main.xml中的Rate按钮
我想在my main.xml中添加一个按钮,用于重定向用户对我的应用进行评分。 我正在用切换方法编程我的活动,因为我有很多按钮做不同的事情,但我不知道如何制作一个按钮来给我的应用评分 如果有人能给我举个例子Java my main.xml中的Rate按钮,java,android,Java,Android,我想在my main.xml中添加一个按钮,用于重定向用户对我的应用进行评分。 我正在用切换方法编程我的活动,因为我有很多按钮做不同的事情,但我不知道如何制作一个按钮来给我的应用评分 如果有人能给我举个例子 谢谢。您可以设置意图以进入您的应用程序 http://market.android.com/search?q=pub: 或 market://search?q=pub:您不能为用户显示“费率”对话框。唯一可行的方法是询问用户是否需要,然后在市场上打开应用程序的页面: startActiv
谢谢。您可以设置
意图
以进入您的应用程序
http://market.android.com/search?q=pub:
或
market://search?q=pub:
您不能为用户显示“费率”对话框。唯一可行的方法是询问用户是否需要,然后在市场上打开应用程序的页面:
startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse("market://details?id=" + getPackageName())));
为了补充Rotemmiz的答案,这是我在助手类中为我的应用程序提供的一种方法:
public static void openMarketAppPage(Context context) {
String packageName = context.getApplicationInfo().packageName;
try {
// Open the market application on your app page
Uri marketAppUri = Uri.parse("market://details?id=" + packageName);
Intent intent = new Intent(Intent.ACTION_VIEW, marketAppUri);
startActivity(intent);
} catch (Exception e) {
// If no market application on the device, open the market website instead
Uri marketWebUri = Uri.parse("http://market.android.com/details?id=" + packageName);
Intent intent = new Intent(Intent.ACTION_VIEW, marketWebUri);
startActivity(intent);
}
}
别忘了将其包装在try/catch语句之间。在没有Android Market的设备上,你的应用程序会崩溃。别忘了在try/catch语句中加上这个。在没有Android Market的设备上,你的应用程序会崩溃。这很好,但我想在你的代码上添加一个按钮。谷歌帮助了很多懒惰的程序员:
public static void openMarketAppPage(Context context) {
String packageName = context.getApplicationInfo().packageName;
try {
// Open the market application on your app page
Uri marketAppUri = Uri.parse("market://details?id=" + packageName);
Intent intent = new Intent(Intent.ACTION_VIEW, marketAppUri);
startActivity(intent);
} catch (Exception e) {
// If no market application on the device, open the market website instead
Uri marketWebUri = Uri.parse("http://market.android.com/details?id=" + packageName);
Intent intent = new Intent(Intent.ACTION_VIEW, marketWebUri);
startActivity(intent);
}
}