Tom*_*ola 7 android android-intent
一切正常,除了这个活动给出resultCode = -1
public class SetTimeDialog extends Activity{
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.settimedialog);
Button bUseTime = (Button) findViewById(R.id.buttonUseTime_settime);
bUseTime.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
Intent resultIntent = new Intent(this, SetTimeDialog.class);
setResult(Activity.RESULT_OK, resultIntent);
finish();
}
});
Run Code Online (Sandbox Code Playgroud)
它在MainActivity中从这里调用:
TableLayout timeTable = (TableLayout)findViewById(R.id.timeTable_writepos);
timeTable.setOnTouchListener(new View.OnTouchListener() {
public boolean onTouch(View v, MotionEvent event) {
Intent settimedialogIntent = new Intent(getApplicationContext(), SetTimeDialog.class);
startActivityForResult(settimedialogIntent, SETTIMEDIALOG_REQCODE); // See onActivityResult()
return false;
}
});
Run Code Online (Sandbox Code Playgroud)
在我的onActivityResult方法中,我现在什么都不做,只检查resultCode的值.(我已经删除了所有其他代码以找出错误).
归档时间: |
|
查看次数: |
4474 次 |
最近记录: |