StartActivity ForResoult
1055 ワード
http://www.cnblogs.com/linjiqin/archive/2011/06/03/2071956.html
最高の解釈は一つもない。
最高の解釈は一つもない。
Activity , startActivityForResult() Activity , Activity , Activity onActivityResult(int requestCode, int resultCode, Intent data) 。 Activity, onActivityResult() (ResultActivity NewActivity Activity):
public class ResultActivity extends Activity {
.....
ResultActivity.this.setResult(1, intent);
ResultActivity.this.finish();
}
public class NewActivity extends Activity {
......
NewActivity.this.setResult(2, intent);
NewActivity.this.finish();
}
public class MainActivity extends Activity { // Activity ResultActivity NewActivity
@Override protected void onActivityResult(int requestCode, int resultCode, Intent data) {
switch(resultCode){
case 1:
// ResultActivity
case 2:
// NewActivity
}
}
}