WEB开发网
开发学院手机开发Android 开发 Android Activity跳转的小结 阅读

Android Activity跳转的小结

 2010-10-19 20:15:08 来源:WEB开发网   
核心提示:private String text;public void onCreate(Bundle savedInstanceState) {super.onCreate(savedInstanceState);setContentView(R.layout.third);text = getIntent().getStr

private String text;

public void onCreate(Bundle savedInstanceState) {

super.onCreate(savedInstanceState);

setContentView(R.layout.third);

text = getIntent().getStringExtra("request_text_for_second");

request_text = (TextView)this.findViewById(R.id.request_text);

request_text.setText(text);

btn = (Button)this.findViewById(R.id.btn);

btn.setOnClickListener(new OnClickListener() {

public void onClick(View v) {

Intent i = new Intent();

i.putExtra("request_text_for_third", text+" "+"从ThirdActivity再次传递到Main");

setResult(Activity.RESULT_FIRST_USER, i);

finish();

}

});

}

}

public class ThirdActivity extends Activity{

private TextView request_text;

private Button btn;

private String text;

public void onCreate(Bundle savedInstanceState) {

super.onCreate(savedInstanceState);

setContentView(R.layout.third);

text = getIntent().getStringExtra("request_text_for_second");

request_text = (TextView)this.findViewById(R.id.request_text);

request_text.setText(text);

btn = (Button)this.findViewById(R.id.btn);

btn.setOnClickListener(new OnClickListener() {

public void onClick(View v) {

Intent i = new Intent();

i.putExtra("request_text_for_third", text+" "+"从ThirdActivity再次传递到Main");

setResult(Activity.RESULT_FIRST_USER, i);

finish();

}

});

}

}

 

上一页  2 3 4 5 6 7 8 9 10 11 12  下一页

Tags:Android Activity 小结

编辑录入:爽爽 [复制链接] [打 印]
赞助商链接