Tuesday, 6 March 2018

Play store rating

In this project you can give the rating the app using playstore in Android. See the example below: - Java File MainActivity.java: - package safal.bhatia.openplaystore; import android.content.Intent; import android.net.Uri; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; import android.view.View; import android.widget.TextView; public class MainActivity extends AppCompatActivity { TextView rate_us; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); rate_us = (TextView)findViewById(R.id.rate_us); rate_us.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse("https://play.google.com/store/search?q=jeevansons&hl=en")); startActivity(intent); } }); } } Xml File main_activity.xml: - <?xml version="1.0" encoding="utf-8"?> <LinearLayout 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" android:layout_width="match_parent" android:gravity="center" android:layout_height="match_parent" tools:context="safal.bhatia.openplaystore.MainActivity"> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="Rate Us" android:id="@+id/rate_us" android:textAllCaps="true" android:textSize="20dp" android:textColor="#080808" /> </LinearLayout>

No comments:

Post a Comment