我想在我的对话框中使用我的费率按钮来启动市场并转到我的特定应用。
另外,如何将消息正文添加到此对话框中?
private void makeDialog() {
AlertDialog.Builder about = new AlertDialog.Builder(this);
about.setMessage("About The Giveaway");
about.setPositiveButton("Rate", new DialogInterface.OnClickListener() {
public void onClick(DialogInterface arg0, int arg1) {
//action
}
});
about.setNegativeButton("Close", new DialogInterface.OnClickListener() {
public void onClick(DialogInterface arg0, int arg1) {}
});
about.show();
}
}
最佳答案
我写了一个简单的库来做到这一点。
它叫做 AppRate 你可以在 GitHub 上找到它 here .
特点:
- 如果应用崩溃过一次,不提示用户。
- 准确决定何时提示用户。 (发射次数...)
- 自定义费率对话框以适合您的应用程序设计。
使用示例:
安装和使用非常简单:
删除 jar在您的 libs
文件夹中。
然后在 MAIN
Activity 的 onCreate
方法中包含以下代码。
new AppRate(this)
.setShowIfAppHasCrashed(false)
.setMinDaysUntilPrompt(0)
.setMinLaunchesUntilPrompt(20)
.init();
- 此代码将在 20 次启动后显示默认汇率对话框。
- 仅当应用从未崩溃时才会显示。
- 费率按钮指向您在 Google Play 商店中的应用。
希望对您有所帮助。 :)
关于java - 使费率按钮启动市场并显示消息正文,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6632652/