Forum General

How to pass number from one activity to another? I am taking the number with the help of EditText

AJNISHRANAAJNISHRANA INMember

I am taking the number with the help of EditText input type number decimal.
And then in the next activity i have to put these number in a array.
how to to this please help me.

Best Answer

  • myPhoenixmyPhoenix ZAMember ✭✭
    Accepted Answer

    @AJNISHRANA , try this.

    These are the values that we want to pass to the next activity
    'Bundle valuesForActivity = new Bundle();
    valuesForActivity.PutString("title", title);
    valuesForActivity.PutString("text", text);
    `

    Create the PendingIntent with the back stack
    Intent resultIntent = new Intent(this, typeof(newActivity)); resultIntent.PutExtras(valuesForActivity); // Pass some values to Activity.

    now, in the OnCreate() of the Activity that you want to open place the following code:

    base.OnCreate(bundle); string title = Intent.Extras.GetString("title"); string description = Intent.Extras.GetString("text");

    In your case, instead of using PutString or GetString, you could use PutDouble and the GetDouble. For an array you could use PutDoubleArray and then GetDoubleArray.

    Hope this answers your question.

Answers

  • myPhoenixmyPhoenix ZAMember ✭✭
    Accepted Answer

    @AJNISHRANA , try this.

    These are the values that we want to pass to the next activity
    'Bundle valuesForActivity = new Bundle();
    valuesForActivity.PutString("title", title);
    valuesForActivity.PutString("text", text);
    `

    Create the PendingIntent with the back stack
    Intent resultIntent = new Intent(this, typeof(newActivity)); resultIntent.PutExtras(valuesForActivity); // Pass some values to Activity.

    now, in the OnCreate() of the Activity that you want to open place the following code:

    base.OnCreate(bundle); string title = Intent.Extras.GetString("title"); string description = Intent.Extras.GetString("text");

    In your case, instead of using PutString or GetString, you could use PutDouble and the GetDouble. For an array you could use PutDoubleArray and then GetDoubleArray.

    Hope this answers your question.

Sign In or Register to comment.