PageRenderTime 38ms CodeModel.GetById 26ms RepoModel.GetById 0ms app.codeStats 0ms

/RMaps.Ext/src/com/robert/maps/ext/DonationActivity.java

http://robertprojects.googlecode.com/
Java | 49 lines | 36 code | 13 blank | 0 comment | 0 complexity | 6f156cc1a9d3261c01f62aa56c94a0f3 MD5 | raw file
  1. package com.robert.maps.ext;
  2. import android.app.Activity;
  3. import android.content.ActivityNotFoundException;
  4. import android.content.ComponentName;
  5. import android.content.Intent;
  6. import android.net.Uri;
  7. import android.os.Bundle;
  8. import android.view.View;
  9. import android.widget.Toast;
  10. public class DonationActivity extends Activity {
  11. @Override
  12. protected void onCreate(Bundle savedInstanceState) {
  13. super.onCreate(savedInstanceState);
  14. setContentView(R.layout.donationactivity);
  15. findViewById(R.id.buttonStart).setOnClickListener(new View.OnClickListener() {
  16. public void onClick(View v) {
  17. try {
  18. final Intent intent = new Intent(Intent.ACTION_MAIN, null);
  19. intent.addCategory(Intent.CATEGORY_LAUNCHER);
  20. final ComponentName cn = new ComponentName("com.robert.maps", "com.robert.maps.applib.MainActivity");
  21. intent.setComponent(cn);
  22. intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
  23. startActivity(intent);
  24. } catch (ActivityNotFoundException e) {
  25. Toast.makeText(DonationActivity.this, R.string.message_noapp, Toast.LENGTH_LONG).show();
  26. try {
  27. startActivity(new Intent(Intent.ACTION_VIEW).setData(Uri.parse("market://details?id=com.robert.maps")));
  28. } catch (Exception e1) {
  29. e1.printStackTrace();
  30. }
  31. }
  32. DonationActivity.this.finish();
  33. }
  34. });
  35. }
  36. }