Back to project page led-notifier.
The source code is released under:
Apache License
If you think the Android project led-notifier 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.ciubotariu_levy.lednotifier; //w w w.j a v a 2s. c om import android.content.ActivityNotFoundException; import android.content.Intent; import android.content.pm.PackageManager.NameNotFoundException; import android.net.Uri; import android.os.Bundle; import android.support.v4.app.NavUtils; import android.support.v7.app.ActionBarActivity; import android.view.MenuItem; import android.view.View; import android.widget.TextView; public class AboutActivity extends ActionBarActivity { private static String GH_URL = "http://www.github.com/"; private String mVersionName = ""; private CharSequence mAppName = ""; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_about); getSupportActionBar().setDisplayHomeAsUpEnabled(true); TextView appNameTextView = (TextView) findViewById (R.id.app_name); TextView appVersionTextView = (TextView) findViewById (R.id.app_version); try { mVersionName = getPackageManager().getPackageInfo(this.getPackageName(), 0).versionName; mAppName = getPackageManager().getApplicationLabel(getApplicationInfo())+ " "; } catch (NameNotFoundException e) { //should not happen } appNameTextView.setText (mAppName); appVersionTextView.setText (mVersionName); } public void viewSite (View v){ String fragment = null; switch (v.getId()){ case R.id.andrei: fragment = "andreiciubotariu"; break; case R.id.matthew: fragment = "LevyMatthew"; break; default: fragment = "andreiciubotariu/led-notifier"; } try{ startActivity (new Intent (Intent.ACTION_VIEW,Uri.parse(GH_URL+fragment))); } catch (ActivityNotFoundException e){ //usually won't happen. e.printStackTrace(); } } @Override public boolean onOptionsItemSelected(MenuItem item) { switch (item.getItemId()) { case android.R.id.home: Intent i = NavUtils.getParentActivityIntent(this); i.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); startActivity (i); return true; default: return super.onOptionsItemSelected(item); } } }