1 |
package soo.elements.intent; |
---|
2 |
|
---|
3 |
import android.app.Activity; |
---|
4 |
import android.content.Intent; |
---|
5 |
import android.os.Bundle; |
---|
6 |
import android.view.View; |
---|
7 |
import android.view.View.OnClickListener; |
---|
8 |
import android.widget.Button; |
---|
9 |
import android.widget.TextView; |
---|
10 |
|
---|
11 |
public class ExIntenttDataTest extends Activity { |
---|
12 |
/** Called when the activity is first created. */ |
---|
13 |
|
---|
14 |
|
---|
15 |
@Override |
---|
16 |
public void onCreate(Bundle savedInstanceState) { |
---|
17 |
super.onCreate(savedInstanceState); |
---|
18 |
setContentView(R.layout.main); |
---|
19 |
|
---|
20 |
final Button bt = (Button)findViewById(R.id.button01); |
---|
21 |
|
---|
22 |
bt.setOnClickListener(new OnClickListener() { |
---|
23 |
|
---|
24 |
@Override |
---|
25 |
public void onClick(View v) { |
---|
26 |
// TODO Auto-generated method stub |
---|
27 |
Intent i = new Intent(ExIntenttDataTest.this,SubForm.class); |
---|
28 |
startActivityForResult(i,1 ); //���瑜�二쇰� 寃���� 1����껌肄��(requestCode) �대�.. |
---|
29 |
} |
---|
30 |
}); |
---|
31 |
} |
---|
32 |
|
---|
33 |
@Override |
---|
34 |
protected void onActivityResult(int requestCode,int resultCode,Intent data){ |
---|
35 |
TextView tv1 = (TextView)findViewById(R.id.textView01); |
---|
36 |
TextView tv2 = (TextView)findViewById(R.id.textView02); |
---|
37 |
|
---|
38 |
if(resultCode == RESULT_OK){ //���濡�諛���������. |
---|
39 |
if(requestCode==1){ |
---|
40 |
String name = data.getStringExtra("param_name"); |
---|
41 |
String addr = data.getStringExtra("param_addr"); |
---|
42 |
|
---|
43 |
tv1.setText(name); |
---|
44 |
tv2.setText(addr); |
---|
45 |
} |
---|
46 |
} |
---|
47 |
} |
---|
48 |
} |
---|