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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T03:44:31+00:00 2026-06-15T03:44:31+00:00

How to update ListFragment whenever data updated in Sqlite Database.My following Fragment code works

  • 0

How to update ListFragment whenever data updated in Sqlite Database.My following Fragment code works properly,how to update this list fragment?

public class MyMasterFragment extends SherlockListFragment {
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);

        /*
        Runnable mRunnable=new Runnable() {
               public void run() {
                     Log.i("mylog", "refreshing...");
                     ListAdapter myListAdapter = getMyListAdapter();
                     setListAdapter(myListAdapter);
                     Log.i("mylog", "list Updated");
                     mHandler.postDelayed( this, 60*1000 );
                   }
        };

        mHandler.postDelayed( mRunnable, 0);
        */

        ListAdapter myListAdapter = getMyListAdapter();
        setListAdapter(myListAdapter);

    }

    private ListAdapter getMyListAdapter() {
        DBHelper dbHelper=new DBHelper(getActivity().getApplicationContext());
        SQLiteDatabase myDB = dbHelper.getWritableDatabase();


        ListAdapter adapter = null ;
            String TIME_SORT_ORDER=DBConstants.TIME+" DESC";
            String[] mycolumns={DBConstants.SNO,DBConstants.MYSYMBOL,DBConstants.VALUE1,DBConstants.DATE,DBConstants.TIME,DBConstants.VALUE2,DBConstants.VALUE3,DBConstants.VALUE4,DBConstants.VALUE5,DBConstants.VALUE6};
            Cursor c1 = myDB.query(DBConstants.LATEST_MY_DATA_TABLE,mycolumns, null, null, null, null, TIME_SORT_ORDER);

            if(c1.getCount()>0)
            {
                adapter=new SimpleCursorAdapter(getActivity().getApplicationContext(), R.layout.live_list_item, c1, new String[] {DBConstants.MYSYMBOL,DBConstants.VALUE1,DBConstants.VALUE2,DBConstants.DATE,DBConstants.TIME}, new int[] {R.id.mysymbol, R.id.value1,R.id.value2,R.id.ldate,R.id.ltime});
            }
        myDB.close();
        dbHelper.close();
        return adapter;
    }
}

Also i have studied about Loader Manager in Android document.

  1. If i use loader manager it automatically updates my fragment list whenever data updated in my DB?
  2. Can i use Loader manager on Pre-honeycomb versionz using Support 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-06-15T03:44:32+00:00Added an answer on June 15, 2026 at 3:44 am

    If i use loader manager it automatically updates my fragment list
    whenever data updated in my DB?

    Nope, you have to listen to some internal event, or external broadcast to re-run the load.

    • Services: When you bind with a service, you share an Interface
      IBinder
      to communicate. Using that , service can notify your Activity that it
      has updated the DB.

    Can i use Loader manager on Pre-honeycomb versionz using Support
    Library?

    Yes, you can.

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

Sidebar

Related Questions

How to update List Fragment Periodically? I need to query data from SQLite Database
I have a Pager adapter that will call a ListFragment like this: public Fragment
Update.. code works now had to change the validation statement on form submit. Removed
Update: I reported this as a bug to Apple and they fixed it! All
UPDATE: I've been playing around with this more, and it seems like tmux's clear-history
Update : This is no longer an issue from C# 6, which has introduced
UPDATE: I'm getting this error: (No route matches /docs/index.html... ) when accessing admin.example.com/docs/index.html The
UPDATE: I made a mistake in my debugging - this question is not relavent
UPDATE : A commenter told me to change some codes, this is the new
UPDATE: I added this to my unload function: $(window).resize(function(){ var pageheight = $(window).height(); $('section').css('height',

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.