AlertDialogActivity.java
Go to the documentation of this file.
00001 package com.github.rosjava.android_remocons.headless_launcher;
00002 
00003 import android.app.Activity;
00004 import android.content.Intent;
00005 import android.net.Uri;
00006 import android.os.Bundle;
00007 import android.view.View;
00008 import android.widget.TextView;
00009 
00010 public class AlertDialogActivity extends Activity implements View.OnClickListener {
00011     private String installPackage = "";
00012     private String mainContext = "";
00013     @Override
00014     protected void onCreate(Bundle savedInstanceState) {
00015         super.onCreate(savedInstanceState);
00016         setContentView(R.layout.activity_alert_dialog);
00017         findViewById(R.id.yes).setOnClickListener(this);
00018         findViewById(R.id.no).setOnClickListener(this);
00019 
00020         installPackage = getIntent().getExtras().getString("InstallPackageName");
00021         mainContext = getIntent().getExtras().getString("MainContext");
00022 
00023         TextView text_view;
00024         text_view = (TextView)this.findViewById(R.id.main_context);
00025         text_view.setText(mainContext);
00026     }
00027 
00028     @Override
00029     public void onClick(View v) {
00030         switch(v.getId()){
00031             case R.id.yes:
00032                 Uri uri = Uri.parse("market://details?id=" + installPackage);
00033                 Intent intent = new Intent(Intent.ACTION_VIEW, uri);
00034                 AlertDialogActivity.this.startActivity(intent);
00035                 finish();
00036                 break;
00037             case R.id.no:
00038                 finish();
00039                 break;
00040             default:
00041                 break;
00042         }
00043     }
00044 }


android_remocons
Author(s): Daniel Stonier, Kazuto Murase
autogenerated on Sat Jun 8 2019 19:32:24