Android Open Source - AndroidHandsOn Display Message Activity






From Project

Back to project page AndroidHandsOn.

License

The source code is released under:

Apache License

If you think the Android project AndroidHandsOn listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

package com.globant.mobile.handson;
/* ww w.  j  a v a 2 s  .  c  om*/
import android.annotation.SuppressLint;
import android.content.Intent;
import android.os.Bundle;
import android.support.v4.app.NavUtils;
import android.view.Menu;
import android.view.MenuItem;
import android.widget.TextView;

public class DisplayMessageActivity extends BaseActivity {

  @SuppressLint("NewApi")
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_display_message);
    // Show the Up button in the action bar.
    setupActionBar();
    //Get the message from the intent
    Intent intent = getIntent();
    String message = intent.getStringExtra(MainActivity.EXTRA_MESSAGE);
    //set the message in the text view
    TextView textview = (TextView) findViewById(R.id.greet);
    textview.setTextSize(40);
    textview.setText(message);
  }  

  @Override
  public boolean onCreateOptionsMenu(Menu menu) {
    // Inflate the menu; this adds items to the action bar if it is present.
    getMenuInflater().inflate(R.menu.display_message, menu);
    return true;
  }

  @Override
  public boolean onOptionsItemSelected(MenuItem item) {
    switch (item.getItemId()) {
    case android.R.id.home:
      // This ID represents the Home or Up button. In the case of this
      // activity, the Up button is shown. Use NavUtils to allow users
      // to navigate up one level in the application structure. For
      // more details, see the Navigation pattern on Android Design:
      //
      // http://developer.android.com/design/patterns/navigation.html#up-vs-back
      //
      NavUtils.navigateUpFromSameTask(this);
      return true;
    }
    return super.onOptionsItemSelected(item);
  }
  
  @Override
  public void onDestroy(){
    //Always call the superclass
    super.onDestroy();
    //Stop method tracing that the activity started during onCreate
    android.os.Debug.stopMethodTracing();
  }

}




Java Source Code List

com.globant.mobile.handson.BaseActivity.java
com.globant.mobile.handson.CameraActivity.java
com.globant.mobile.handson.DisplayMessageActivity.java
com.globant.mobile.handson.GalleryActivity.java
com.globant.mobile.handson.ImageDetailActivity.java
com.globant.mobile.handson.ImageDetailFragment.java
com.globant.mobile.handson.ImageGrid.java
com.globant.mobile.handson.MainActivity.java
com.globant.mobile.handson.RecyclingImageView.java
com.globant.mobile.handson.exception.CameraNotAvailableException.java
com.globant.mobile.handson.media.BitmapCache.java
com.globant.mobile.handson.media.BitmapDecoder.java
com.globant.mobile.handson.media.BitmapFetcher.java
com.globant.mobile.handson.media.CustomCamera.java
com.globant.mobile.handson.media.FaceDetection.java
com.globant.mobile.handson.media.RecyclingBitmapDrawable.java
com.globant.mobile.handson.media.task.AsyncTask.java
com.globant.mobile.handson.media.task.BitmapWorker.java
com.globant.mobile.handson.media.task.MustacheWorker.java
com.globant.mobile.handson.media.task.WorkerListener.java
com.globant.mobile.handson.provider.Bitmaps.java
com.globant.mobile.handson.provider.Images.java
com.globant.mobile.handson.sensor.RotationListener.java
com.globant.mobile.handson.util.DiskLruCache.java
com.globant.mobile.handson.util.SystemUiHiderBase.java
com.globant.mobile.handson.util.SystemUiHiderHoneycomb.java
com.globant.mobile.handson.util.SystemUiHider.java