OKIEWARDOYO

ANDROID NO.6 2

Feb 6th, 2015
18,318
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.58 KB | None | 0 0
  1. package mediatutorial.web.id.mengenalintent;
  2.  
  3. import android.content.Intent;
  4. import android.support.v7.app.ActionBarActivity;
  5. import android.os.Bundle;
  6. import android.view.Menu;
  7. import android.view.MenuItem;
  8. import android.widget.TextView;
  9.  
  10.  
  11. public class DisplayActivity extends ActionBarActivity {
  12.  
  13.     @Override
  14.     protected void onCreate(Bundle savedInstanceState) {
  15.         super.onCreate(savedInstanceState);
  16.         setContentView(R.layout.activity_display);
  17.  
  18.         //---intent begin---//
  19.         //intent diberikan setelah 'activity_display.xml' terloading
  20.         Intent intent = getIntent();
  21.         String dataNama = intent.getStringExtra(MainActivity.DATA_NAMA);
  22.         TextView textview_datanama = (TextView) findViewById(R.id.displayName);
  23.         textview_datanama.setText(dataNama);
  24.         //---intent end---//
  25.     }
  26.  
  27.  
  28.     @Override
  29.     public boolean onCreateOptionsMenu(Menu menu) {
  30.         // Inflate the menu; this adds items to the action bar if it is present.
  31.         getMenuInflater().inflate(R.menu.menu_display, menu);
  32.         return true;
  33.     }
  34.  
  35.     @Override
  36.     public boolean onOptionsItemSelected(MenuItem item) {
  37.         // Handle action bar item clicks here. The action bar will
  38.         // automatically handle clicks on the Home/Up button, so long
  39.         // as you specify a parent activity in AndroidManifest.xml.
  40.         int id = item.getItemId();
  41.  
  42.         //noinspection SimplifiableIfStatement
  43.         if (id == R.id.action_settings) {
  44.             return true;
  45.         }
  46.  
  47.         return super.onOptionsItemSelected(item);
  48.     }
  49. }
Advertisement
Add Comment
Please, Sign In to add comment