Thursday, February 6, 2014

setResult (Activity.RESULT_OK, intent) does not return a value in this Activity


            
This is
I have 2 Activity. And not the main entrance activity


a start startActivityForResult (intent, 0) into b activity; and override onActivityResult ..

Click on the button to call b activity setResult return results, and finish.

Result in a activity does not execute onActivityResult method ..

May I ask why?
Reply:
The process is this, paste the code and see.
Reply:

a activity
 
namelayout.setOnClickListener (new OnClickListener () {

@ Override
public void onClick (View v) {
Intent intent = new Intent (EditAccount.this,
CustomInfoEdit.class);
Bundle bundle = new Bundle ();
/ / Bundle.putString ("type", "egamename");
intent.putExtras (bundle);
startActivityForResult (intent, 0);

}
});


 
@ Override
protected void onActivityResult (int requestCode, int resultCode, Intent data) {
/ / TODO Auto-generated method stub \
Log.v ("test", "------------------------------>");
super.onActivityResult (requestCode, resultCode, data);
}


b activity
 
Intent intent = getIntent ();
Bundle bundle = intent.getExtras ();
/ / Bundle.putString ("type", type);
/ / Intent.setClass (CustomInfoEdit.this, EditAccount.class);
bundle.putString ("value", edit.getEditableText () toString ().);
intent.putExtras (bundle);
setResult (RESULT_FIRST_USER, intent);
finish ();

Reply:
setResult (RESULT_FIRST_USER, intent);
Changed
setResult (RESULT_OK, intent); / / RESULT_OK = -1;

On OK
Reply:
Useless, originally result_ok's. Replaced by another to try
Reply:
That set a breakpoint debugging yet to see sometimes Logcat information will not hang out
Reply:
Intent intent = getIntent ();
Bundle bundle = intent.getExtras ();


A top part is to obtain data transmission over!
The following section is to return data! Need to re-construct Intent
Intent intent1 = new Intent ();
Bundle bundle1 = new Bundle ();
bundle1.putString ("value", edit.getEditableText () toString ().);
intent1.putExtras (bundle1);
setResult (RESULT_FIRST_USER, intent1);

Landlord to try it!
finish ();


Reply:
Back upstairs, or not oh
Reply:
The problem is that it does not go this method onActivityResult
Reply:
No, I've tried it all OK here, ah!

Other procedures may be out of your question! !

Reply:
reference to the 9th floor lizhengjun2010 reply:
not try it on my side it can be, ah!

Other procedures may be out of your question! !


Will Under normal circumstances, it may be what causes it? Write your own demo can be achieved. . . No problem

Reply:
Some people wonder why it? You can add points to solve
Reply:
In b activity in print his calling activity is empty
Reply:
You are using the real test it?
Reply:
Back upstairs, yes
Reply:
PS: is similar to the tab page. getParent is not so that
Reply:
Nobody know?
Reply:
Intent intent = getIntent ();
Bundle bundle = intent.getExtras ();
/ / Bundle.putString ("type", type);
/ / Intent.setClass (CustomInfoEdit.this, EditAccount.class);
bundle.putString ("value", edit.getEditableText () toString ().);
intent.putExtras (bundle);
EditAccount.this finish ();

Brother, you are what this intent, getIntent ()? ? ?
Intent intent2 = new Intent (CustomInfoEdit.this, EditAccount.class);
setResult (RESULT_FIRST_USER, intent2);
This trip



Reply:
ForResult how Internet search under their own use? See you are still a novice, and slowly learn it
Reply:
cited 17 floor lovexjyong reply:
Intent intent = getIntent ();
Bundle bundle = intent.getExtras ();
/ / Bundle.putString ("type", type);
/ / Intent.setClass (CustomInfoEdit.this, ......


Could you see the question to answer right. Full bottle does not move, shake bottle
Reply:
Results posted. Because the results are returned to the floor on a activity activitygroup the other side.

Upstairs is mine died. This does not bother most TMD see the replies of the problem.
Reply:
reference to the 20th floor Reply:
Results posted. Because the results are returned to the floor on a activity activitygroup the other side.

Upstairs is mine died. This does not bother most TMD see the replies of the problem.


How is this going on? ? I also have the same problem. . Will be able to say elaborate?
Reply:
this.getParent (). setResult (RESULT_OK, intent) ;/ / focus is this.getparent ()
Reply:
How to solve the problem,,,

No comments:

Post a Comment