Back to project page iwannawatch-android.
The source code is released under:
MIT License
If you think the Android project iwannawatch-android listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.
package com.meoyawn.iwannawatch; //from w ww . j a va 2s. c o m import android.content.ActivityNotFoundException; import android.content.Intent; import android.net.Uri; import android.os.Bundle; import android.support.v7.app.ActionBarActivity; import android.view.MenuItem; import com.google.analytics.tracking.android.EasyTracker; public class MainActivity extends ActionBarActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); if (savedInstanceState == null) { getSupportFragmentManager().beginTransaction() .add(android.R.id.content, new MainFragmentBuilder(false).build()) .commit(); } } @Override public boolean onOptionsItemSelected(MenuItem item) { try { switch (item.getItemId()) { case R.id.action_support: Intent intent = new Intent(Intent.ACTION_SEND); intent.setType("text/plain"); intent.putExtra(Intent.EXTRA_EMAIL, new String[]{"stiggpwnz@gmail.com"}); intent.putExtra(Intent.EXTRA_SUBJECT, getString(R.string.support, getString(R.string.app_name))); startActivity(Intent.createChooser(intent, getString(R.string.send))); return true; case R.id.action_store: Uri uri = Uri.parse("https://play.google.com/store/apps/details?id=" + getPackageName()); startActivity(new Intent(Intent.ACTION_VIEW, uri)); return true; } } catch (ActivityNotFoundException ignored) { } return super.onOptionsItemSelected(item); } @Override protected void onStart() { super.onStart(); EasyTracker.getInstance(this).activityStart(this); // Add this method. } @Override protected void onStop() { super.onStop(); EasyTracker.getInstance(this).activityStop(this); // Add this method. } }