我想把一些字符串数据从 sub activity 发送到 main activity,然后在 edit text 字段中显示数据。
sub activity :
button.setOnClickListener(new OnClickListener() { public void onClick(View v) { Intent in = new Intent(); in.setClass(getApplicationContext(), DelaySmsActivity.class); in.putExtra("values", stringDataForSend); setResult(RESULT_OK, in); finish(); } });
main activity代码,我想从中获取值:
@Override public void onActivityResult(int requestCode, int resultCode, Intent data) { super.onActivityResult(requestCode, resultCode, data); parametar = data.getStringExtra("values"); editTextField.setText(parametar); }
运行过后,editTextField 是空的,怎么解决呢?
GCT1015
郎朗坤
相关分类