BÀI 28 - TRAO ĐỔI DỮ LIỆU TRONG LẬP TRÌNH ANDROID
BÀI 28 - TRAO ĐỔI DỮ LIỆU TRONG LẬP TRÌNH ANDROID
Video bài học:
Màn hình chính:
Intent intent = new Intent(màn hình chính.this, màn hình cần.class);
startActivityForResult(intent, biến_kiểu_int);
protected void onActivityResult(){
if(requestCode == biến_kiểu_int && resultCode == RESULT_OK && data != null){
show thứ đã nhận
}
}
Màn hình cần:
Intent intent = new Intent();
intent.putExtra("tên thứ cần gửi", thứ_cần_gửi);
setResult(RESULT_OK, intent);
finish();