Android关于按钮在市场上评级

时间:2012-05-16 17:40:35

标签: android button share rate

我很困惑这个代码我正在寻找somenthing类似我有一个按钮,我希望它说率和点击它带你到Android市场,用户可以评价我的应用程序,请帮助

Button bRate = (Button) findViewById(R.id.button7); 
bRate.setOnClickListener(new View.OnClickListener() { 
    //plus the code on the top here is my idea of the code 
}

Elipse说错了,我明白我需要把我的市场链接但是按钮仍然不起作用

我无法将其发布在同一页面上这里是原始问题的链接

Use application to rate it on market

3 个答案:

答案 0 :(得分:13)

您刚刚添加了应用包名称...

https://play.google.com/store/apps/details?id=your packagename

使用Intent.ACTION_VIEW

致电
String str ="https://play.google.com/store/apps/details?id=com.zeustechnocrats.quickfoods";
startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse(str)));

答案 1 :(得分:2)

这对我使用图像按钮做同样的事情很有帮助。这里是我使用的代码。

    final ImageButton mybutton = (ImageButton) findViewById(R.id.imageButton); 
    mybutton.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {

            String str ="https://play.google.com/store/apps/details?id=ws.crandell.newspaperpuzzles";
            startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse(str)));

        }

    });

答案 2 :(得分:0)

您可以使用的示例代码。

将your_package_name更改为your.package.name。例如。 com.example.myapp

Java文件:

public void ratebutton(View v) {
        Intent intent = new Intent(Intent.ACTION_VIEW)
                .setData(Uri
                        .parse("https://play.google.com/store/apps/details?id=your_package_name"));
        startActivity(intent);
    }

布局文件:

<Button
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:onClick="ratebutton"
        android:text="@string/rate"
        android:layout_gravity="center_horizontal" />

的strings.xml:

 <string name="rate">Rate with 5 stars please</string>
相关问题