Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8324799
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T00:12:26+00:00 2026-06-09T00:12:26+00:00

I’m able to edit & save data from one Activity(EditActivity.java), but the updated data

  • 0

I’m able to edit & save data from one Activity(EditActivity.java), but the updated data doesn’t display(or carried over) to the next Activity(ViewActivity.java) when click Save button. I can see the changes on the EditText fields if go back to the EditActivity page.

EditActivity.java

btnSave.setOnClickListener(new View.OnClickListener() {

        public void onClick(View arg0) {
            // starting background task to update request
            new SaveRequestDetails().execute();
        }
    });

    class SaveRequestDetails extends AsyncTask<String, String, String> {


    protected String doInBackground(String... args) {

        // getting updated data from EditTexts
        String request_title = txtTitle.getText().toString();
        String request_date = txtSdate.getText().toString();
        String reqEndDate = txtEdate.getText().toString();
        String hours = txtHours.getText().toString();
        String reason = txtReason.getText().toString();
        String explanation = txtExp.getText().toString();


        List<NameValuePair> params = new ArrayList<NameValuePair>();
        params.add(new BasicNameValuePair(TAG_ID, request_id));
        params.add(new BasicNameValuePair(TAG_TITLE, request_title));
        params.add(new BasicNameValuePair(TAG_SDATE, request_date));
        params.add(new BasicNameValuePair(TAG_EDATE, reqEndDate));
        params.add(new BasicNameValuePair(TAG_HOURS, hours));
        params.add(new BasicNameValuePair(TAG_REASON, reason));
        params.add(new BasicNameValuePair(TAG_EXP, explanation));


        JSONObject json = jsonParser.makeHttpRequest(url_update_request,
                "POST", params);


        try {
            int success = json.getInt(TAG_SUCCESS);

            if (success == 1) {

                Intent i = getIntent();
                // send result code 100 to notify about request update
                setResult(100, i);
                finish();
            } else {

            }
        } catch (JSONException e) {
            e.printStackTrace();
        }

        return null;
    }

ViewActivity.java

public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.view_request);

        Intent i = getIntent();

        // getting request id (rid) from intent
        request_id = i.getStringExtra(TAG_ID);

        // Getting complete request details in background thread
        new GetRequestDetails().execute();

        btnEdit = (Button) findViewById(R.id.btnEdit);

        btnEdit.setOnClickListener(new View.OnClickListener() {

            @Override
            public void onClick(View v) {
                // TODO Auto-generated method stub
                // Starting new intent
                Intent in = new Intent(getApplicationContext(), EditActivity.class);
                // sending rid to next activity
                in.putExtra(TAG_ID, request_id);
                startActivity(in);

            }
        });

    }

    // Response from Edit Activity
    @Override
    protected void onActivityResult(int requestCode, int resultCode, Intent data) {
        super.onActivityResult(requestCode, resultCode, data);
        // if result code 100
        if (resultCode == 100) {
            // if result code 100 is received 
            // means user edited/deleted request
            // reload this screen again
            Intent intent = getIntent();
            finish();
            startActivity(intent);
        }

    }
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-09T00:12:27+00:00Added an answer on June 9, 2026 at 12:12 am

    Your headline says that, that onActivityResult() does not get called.

    Use startActivityForResult(in, 55) instead of startActivity(in)

    //EDIT:
    By the way, checking the result code should by done using the RESULT_OK / RESULT_CANCELED constants. You might also consider checking the request code (in my example code it would be 55)

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

link Im having trouble converting the html entites into html characters, (&# 8217;) i
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
I want to construct a data frame in an Rcpp function, but when I
I have just tried to save a simple *.rtf file with some websites and
I want to count how many characters a certain string has in PHP, but
For some reason, after submitting a string like this Jack’s Spindle from a text
I am trying to understand how to use SyndicationItem to display feed which is
I am reading a book about Javascript and jQuery and using one of the
I have a French site that I want to parse, but am running into

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.