Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android open URL onclick certain button

How i can send people to my google play on click certain button ? i already did this in activity_menu.xml

<Button
        android:id="@+id/ratebutton"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignBaseline="@+id/morebutton"
        android:layout_alignBottom="@+id/morebutton"
        android:layout_toLeftOf="@+id/morebutton"
        android:layout_toRightOf="@+id/aboutButton"
        android:background="@drawable/more"
        android:text="@string/rateBtn"
        android:textColor="@color/White"
        android:textColorHint="@color/White"
        android:textSize="18sp" />

but in MenuActivity.java i couldn't know what should i do ?

Any help? Thanks

like image 830
Dr.Mezo Avatar asked Jun 17 '14 10:06

Dr.Mezo


1 Answers

findViewById(R.id.ratebutton).setOnClickListener(new OnClickListener() {
                @Override
                public void onClick(View v) {
                    String url = "market://details?id=<package_name>";

                    Intent i = new Intent(Intent.ACTION_VIEW);
                    i.setData(Uri.parse(url));
                    startActivity(i);
                }
            });
like image 93
Suhail Mehta Avatar answered Sep 21 '22 07:09

Suhail Mehta