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

  • SEARCH
  • Home
  • 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 7679123
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T17:48:19+00:00 2026-05-31T17:48:19+00:00

I have create a listfragment and a button which looks like as follows (

  • 0

I have create a listfragment and a button which looks like as follows ( Image on the left )

whenever i click on a ADD button a new Activity opens up and inside that user write something and click on DONE , the activty finishes and return to the ListFragment , but after click over DONE how would i update the ListFragment with new values. i mean where can i write
notifyDataSetChanged.

enter image description here

Note: when i click on DONE , the data will get store in the database , and when the ListFragment loads , it will fetch the data inside it

i am using android support compatibility library

  • 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-05-31T17:48:20+00:00Added an answer on May 31, 2026 at 5:48 pm

    You should be using StartActivityForResult().

    //place in shared location
    int MYACTIVITY_REQUEST_CODE = 101
    
    //start Activity
    Intent intent = new Intent(getActivity(), MyActivity.class);
    startActivityForResult(intent, MYACTIVITY_REQUEST_CODE);
    

    You should then override onActivityResult() in the fragment. The method will be called after the activity is closed.

    @Override
    public void onActivityResult(int requestCode, int resultCode, Intent data)
    {
        super.onActivityResult(requestCode, resultCode, data);
        if ((requestCode == MYACTIVITY_REQUEST_CODE) && (resultCode == Activity.RESULT_OK))
            adapter.notifyDataSetChanged()
    }
    

    The result Code is set in the activity before it is finished via:

    setResult(Activity.RESULT_OK)
    

    Using the requestCode and resultCode are really optional. You only need to use the requestCode if you are launching more than one activity from the fragment. You only need to use the resultCode if you need to return different results from the activity.

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

Sidebar

Related Questions

I have a ListFragment Activity. I want to create a method for onItemClickedLongPress, so
i have create this code for my button but the image doesen't change why?
i have to create an asp.net page dynamically on runtime. It should work like
I have create a new customer role SubAdmin with limited admin permission , assign
I have Create Many tables For User Registration Like Naukri... When i finished registration
I currently have my application set up with a ListFragment on the left and
I have Create application which contains google map. If i install app with debug
I have create the service which implement the media player class to play the
I have create two tables with reference with another table: I like this: Table1:
I have create a function so that it would load the function whenever call

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.