Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //rateus button
- android.widget.Button ratebutton = (android.widget.Button) findViewById(R.id.id_rateus);
- ratebutton.setOnClickListener(new View.OnClickListener() {
- @Override
- public void onClick(View v) {
- try {
- startActivity(new Intent(Intent.ACTION_VIEW,
- android.net.Uri.parse("market://play.google.com/store/apps/details?id=com.slsindupotha&hl=en")));
- }catch (android.content.ActivityNotFoundException e){
- startActivity(new Intent(Intent.ACTION_VIEW,
- android.net.Uri.parse("https://play.google.com/store/apps/details?id=com.slsindupotha&hl=en")));
- }
- }
- });
- //end rateus button code
- <item
- android:id="@+id/id_rateus"
- android:orderInCategory="100"
- android:title="@string/action_rateus"
- android:textAllCaps="false"
- app:showAsAction="ifRoom" />
- @Override
- public boolean onCreateOptionsMenu(Menu menu) {
- MenuInflater inflater = getMenuInflater();
- inflater.inflate(R.menu.menu_file, menu);
- return true;
- }
- @Override
- public boolean onOptionsItemSelected(MenuItem item) {
- // Handle item selection
- switch (item.getItemId()) {
- case R.id.id_rateus:
- //handle onclick event for intent to playstore
- return true;
- default:
- return super.onOptionsItemSelected(item);
- }
- }
- @Override
- public boolean onCreateOptionsMenu(Menu menu) {
- // Inflate the menu; this adds appModels to the action bar if it is present.
- this.menu = menu;
- getMenuInflater().inflate(R.menu.menu_main, menu);
- return true;
- }
- @Override
- public boolean onOptionsItemSelected(MenuItem item) {
- int id = item.getItemId();
- switch (id) {
- switch (item.getItemId()) {
- case R.id.share:
- Intent sharingIntent = new Intent(android.content.Intent.ACTION_SEND);
- sharingIntent.setType("text/plain");
- String shareBodyText = "Check it out. Your message goes here";
- sharingIntent.putExtra(android.content.Intent.EXTRA_SUBJECT,"Subject here");
- sharingIntent.putExtra(android.content.Intent.EXTRA_TEXT, shareBodyText);
- startActivity(Intent.createChooser(sharingIntent, "Shearing Option"));
- return true;
- case R.id.id_rateus:
- try {
- startActivity(new Intent(Intent.ACTION_VIEW,
- android.net.Uri.parse("market://play.google.com/store/apps/details?id=com.slsindupotha&hl=en")));
- }catch (android.content.ActivityNotFoundException e){
- startActivity(new Intent(Intent.ACTION_VIEW,
- android.net.Uri.parse("https://play.google.com/store/apps/details?id=com.slsindupotha&hl=en")));
- }
- return true;
- }
- return super.onOptionsItemSelected(item);
- }
Add Comment
Please, Sign In to add comment