Sending data from one activity to another startactivityforresult

Arjun Krishnan

I searched on the forums but couldn't find the right answer for me. I've included the relevant parts below

ACTIVITY ONE

implicitActivationButton.setOnClickListener(new OnClickListener() {

            // Call startImplicitActivation() when pressed
            @Override
            public void onClick(View v) {

Intent myIntent = new Intent(ActivityLoaderActivity.this,
                ExplicitlyLoadedActivity.class);
        startActivityForResult(myIntent, GET_TEXT_REQUEST_CODE);
            }
        });

and a little lower

  protected void onActivityResult(int requestCode, int resultCode, Intent data) {

            Log.i(TAG, "Entered onActivityResult()");


            String input=data.getStringExtra(TAG);
            mUserTextView.setText(input);
        }

This is activity 2 after user enters some data

String input=mEditText.getText().toString();


    Intent i = new Intent(ExplicitlyLoadedActivity.this, ActivityLoaderActivity.class);
    i.putExtra("TAG",input);
    startActivity(i);       
    this.setResult(RESULT_OK);      
    finish();

No error messages at all but the text on screen doesnt update. it is supposed to

Shayan Pourvatan

don't need start activity in second class:

you need change your code with:

Intent i = new Intent();  // or // Intent i = getIntent()
i.putExtra("TAG",input);
setResult(RESULT_OK , i);         
finish();

and for cancel that,

setResult(RESULT_CANCELED, i);        
finish();

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

Sending data from one activity to another startactivityforresult

From Dev

Sending image from one activity to another?

From Dev

Sending data from child activity to the main one

From Dev

Sending data from child activity to the main one

From Dev

Sending Data From One Activity to Another Without Creating a new Intent Android

From Dev

Sending Data From One Activity to Another Without Creating a new Intent Android

From Dev

sending data from one sublayout to another in sitecore

From Dev

Sending data from one phone to another

From Dev

Parcelable error sending object from one to another activity

From Dev

Sending double from one activity to another Android Studio

From Dev

Passing data from one activity to another and then printing

From Dev

Notifying data change from one activity to another

From Dev

Transfer data from one activity to another

From Dev

How to parse data from one activity to another

From Dev

sending Uri from activity to another

From Dev

How to pass the data from listview of one activity and pass it to another activity?

From Dev

Number of ways to pass data from one activity to another activity

From Dev

getting error when passing data from one activity to another activity

From Dev

sending data from activity to fragment

From Dev

Sending data from an Activity to WearableListenerService

From Dev

Data loss during sending via $_SESSION from one script to another

From Dev

Sending data from one uiviewcontroller to another navigationcontroller using present modally

From Dev

sending data from one client to another using DatagramPacket

From Dev

Swift watch. Sending data from one view controller to another

From Dev

Sending Data From One Workbook to Another with Command Button

From Dev

Sending data through InfoWindow to another activity Android

From Dev

How to get ListView data from one activity to another using setOnClickListener

From Dev

pass data from one activity to another in Xamarin.Android

From Dev

How to transfer data from one activity to another in android

Related Related

  1. 1

    Sending data from one activity to another startactivityforresult

  2. 2

    Sending image from one activity to another?

  3. 3

    Sending data from child activity to the main one

  4. 4

    Sending data from child activity to the main one

  5. 5

    Sending Data From One Activity to Another Without Creating a new Intent Android

  6. 6

    Sending Data From One Activity to Another Without Creating a new Intent Android

  7. 7

    sending data from one sublayout to another in sitecore

  8. 8

    Sending data from one phone to another

  9. 9

    Parcelable error sending object from one to another activity

  10. 10

    Sending double from one activity to another Android Studio

  11. 11

    Passing data from one activity to another and then printing

  12. 12

    Notifying data change from one activity to another

  13. 13

    Transfer data from one activity to another

  14. 14

    How to parse data from one activity to another

  15. 15

    sending Uri from activity to another

  16. 16

    How to pass the data from listview of one activity and pass it to another activity?

  17. 17

    Number of ways to pass data from one activity to another activity

  18. 18

    getting error when passing data from one activity to another activity

  19. 19

    sending data from activity to fragment

  20. 20

    Sending data from an Activity to WearableListenerService

  21. 21

    Data loss during sending via $_SESSION from one script to another

  22. 22

    Sending data from one uiviewcontroller to another navigationcontroller using present modally

  23. 23

    sending data from one client to another using DatagramPacket

  24. 24

    Swift watch. Sending data from one view controller to another

  25. 25

    Sending Data From One Workbook to Another with Command Button

  26. 26

    Sending data through InfoWindow to another activity Android

  27. 27

    How to get ListView data from one activity to another using setOnClickListener

  28. 28

    pass data from one activity to another in Xamarin.Android

  29. 29

    How to transfer data from one activity to another in android

HotTag

Archive