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 8401301
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T21:46:15+00:00 2026-06-09T21:46:15+00:00

So, there is a button in a ListFragment . The onCLick method of the

  • 0

So, there is a button in a ListFragment. The onCLick method of the button is implemented in the MainActivity(not sure if it is a proper solution, but it is what it is). When I click the button the AlertDialog pops up and when I choose one of the dialog options it changes the dataset my fragment is working with.

The problem is when the AlertDialog disappears, my ListFragment is still displaying old data.

Is there any way to update my ListFragment from the MainActivity?

I’ve tried making certain ListFragment methods static so that they could be called from the main activity, but those methods use non-static fields, etc. and thus cannot be static.

  • 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-09T21:46:16+00:00Added an answer on June 9, 2026 at 9:46 pm

    So, I declared an adapter of my ListFragment fragment as static, as well as the I declared a list from which this adapter is being filled – as static.

    From the main activity I do this:

    ListFragment.item.add(mChosenFilePath);
    ListFragment.fileList.notifyDataSetChanged();
    

    where:

    item – is a list that contains the elements that are to be displayed

    mChosenFilePath – path of file that has been added into the item as a result of the dialog

    fileList – is my adapter

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

Sidebar

Related Questions

Is there ASP button that won't submit post form data. Whenever I click an
in my application a link button is there when i click on it it
In my app there is a button, user just click it then the latest
There are button (id= hide_message_button) and message(id=message). The click on the button should hide/show
In my application there is button field, when user click it, application communicate to
every time I click submit button there's a black 1px border around it. How
this is ma program.in this program on delete button there didnt perform onclick listener
I've embedded a LinkedIn Apply Now button on my page . But there are
I want to hide the tab,Only When i click on a particular button.There should
I want to pass some values to different forms at there button click event.

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.