这是怎么开始的标签活动
This is how I start the Tab Activity
Intent i = new Intent("walk.me.TAB");
startActivityForResult(i, STATIC_RESULT);
注:STATIC_RESULT = -1或RESULT_OK;
Note: STATIC_RESULT=-1 or RESULT_OK;
这是我如何完成标签的活动
This is how I finish the Tab activity
((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实现:
And here is my OnActivityResult implementation:
@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()不管文件garantees的OAR会前或者叫什么名字?我做错了什么?我没有在清单XML声明
Why the onActivityResult is never called it goes directly to OnResume() regardless of the documentation garantees that OAR will be called before OR? What I'm doing wrong? I dont have stated in manifest xml
singleInstance
singleInstance
或
singleTask
singleTask
为主要业务...
推荐答案
您说STATIC_RESULT是-1?
You say STATIC_RESULT is -1?
请求code必须是一个正整数。
The requestCode has to be a positive integer.
startActivityForResult()
参数
意图的意图开始。
要求$ C $)c。如果> = 0,code将在onActivityResult(返回时,活动退出。
requestCode If >= 0, this code will be returned in onActivityResult() when the activity exits.
相关推荐
最新文章