Pass Input Value From Activities C#
I'm trying to pass user input text from activity1 to activity2. I tried alot of thing but all of the thing did to me this error, this is the error i get when i'm trying to put the
Solution 1:
You can get your string by using the method getStringExtra(QUERY)
:
var l = Intent.getStringExtra("j");
If you ever get a null and you're using getStringExtra(QUERY)
. Add a .toString()
to your variable which is used in the PutExtra. In your case this shouldn't be necessary.
Solution 2:
Try with this:
On the main activity
var activity2 = new Intent (this, typeof(next_activity));
activity2.PutExtra ("value",i);
StartActivity (activity2);
On the next_activity
var Passed_value = Intent.GetStringExtra ("value",0);
// for int use: Intent.GetIntExtra
Also try changing
t1.Text = l++.ToString();
to
t1.Text = l++;
and
string b = t1.Text;
to
string b = t1.Text.ToString();
Post a Comment for "Pass Input Value From Activities C#"