Skip to content

Instantly share code, notes, and snippets.

@gmsetiawan
Last active August 29, 2015 14:03
Show Gist options
  • Save gmsetiawan/e7b314e03e671bb9753e to your computer and use it in GitHub Desktop.
Save gmsetiawan/e7b314e03e671bb9753e to your computer and use it in GitHub Desktop.
package com.example.droidclass;
import android.app.Activity;
import android.os.Bundle;
import android.widget.TextView;
public class ActivityTwo extends Activity {
TextView tvReceived;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_two);
tvReceived = (TextView) findViewById(R.id.textView1);
String data = getIntent().getExtras().getString("sentNote");
tvReceived.setText(data);
}
//Option 1
/*Bundle extras = intent.getExtras();
if(extras != null)
String data = extras.getString("keyName");*/
//Option 2
//Shortest way to received
//String data = getIntent().getExtras().getString("keyName");
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment