Android Activity跳转的小结
2010-10-19 20:15:08 来源:WEB开发网Intent i = new Intent();
i.putExtra("request_text_for_third", text+" "+"从ThirdActivity再次传递到SecondActivity");
setResult(Activity.RESULT_OK, 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再次传递到SecondActivity");
setResult(Activity.RESULT_OK, i);
finish();
}
});
}
}
比起前一个demo2其实没有更复杂之处,只是从ThirdActivity跳转回SecondActivity,而通过SecondActivity的另一个Button来跳转回Main的。DEMO下载:php?file_id=206">http://code.cnmsdn.com/viewfile.php?file_id=206
更多精彩
赞助商链接