0
這是我如何啓動選項卡活動OnActivityResult()不會被調用
Intent i = new Intent("walk.me.TAB");
startActivityForResult(i, STATIC_RESULT);
注:STATIC_RESULT = -1或RESULT_OK;
我這是怎麼完成的標籤活動
((Button)viewItem.findViewById(R.id.gotherefav)).setOnTouchListener(new OnTouchListener(){
@Override
public boolean onTouch(View v, MotionEvent event) {
if(ime!=null)
{
b.putString("ime",ime.toString());
b.putIntArray("koordinati&kategorija", coordAndCat);
b.putBoolean("klik", true);
FinishWithResult(b);
}
return false;
}});
public void FinishWithResult(Bundle b)
{
Intent i = getIntent();
i.putExtras(b);
setResult(Activity.RESULT_OK, i);
Log.i("in FINISH", "settig Activity Result");
finish();
}
這裏是我的OnActivityResult實現:
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
Log.i("in OnActivityResult", "Activity Result");
Toast.makeText(getBaseContext(), "DOJDE", Toast.LENGTH_LONG).show();
super.onActivityResult(requestCode, resultCode, data);
Log.i("in OnActivityResult", "Activity Result");
if (requestCode == STATIC_RESULT) {
if (resultCode == RESULT_OK) {
Toast.makeText(getBaseContext(), "DOJDE BUNDLE", Toast.LENGTH_LONG).show();
Bundle preferenciOdTab = data.getExtras();
if(preferenciOdTab !=null && preferenciOdTab.getBoolean("klik", true))
{
mapView = (MapView)findViewById(R.id.map);
isFavorite=preferenciOdTab.getBoolean("klik");
drawFavorite(preferenciOdTab.getString("ime"),preferenciOdTab.getIntArray("koordinati&kategorija"));
}
}}
爲什麼onActivityResult永遠不會把它稱爲直接進入的onResume()無論文檔保證OAR會在OR之前被調用?我做錯了什麼?我不清單中的XML
singleInstance都表示
或
singleTask
的主要活動......
Thanks @Blundel。它解決了它。 –