android,android-contentprovider,android-contentresolver,android-loadermanager,android-loader
If you want observers registered on CONTENT_URI_ANY_OBSERVER to be notified when a change happens on CONTENT_URI_FIND_BY_ID, you need to make sure of two things. First, the CONTENT_URI_ANY_OBSERVER needs to be a parent of CONTENT_URI_FIND_BY_ID. If you think of it like folders on a file system, 'CONTENT_URI_ANY_OBSERVER' should contain `CONTENT_URI_FIND_BY_ID' in...
android,android-listview,android-loadermanager,android-loader
adapter.swapCursor() has no effect because you never set the adapter to the ListView after the adapter was initialized. onCreateView() is called before onActivityCreated(). When you are setting the adapter to the ListView inside onCreateView() it is probably null. Then in onActivityCreated() you initialize the adapter but is not related to...
android,android-sqlite,android-contentprovider,android-loader
In the query method of your ContentProvider attach a listener to the returned cursor: Cursor cursor = queryBuilder.query(dbConnection, projection, selection, selectionArgs, null, null, sortOrder); cursor.setNotificationUri(getContext().getContentResolver(), uri); Then in your insert/update/delete methods use code like this: final long objectId = dbConnection.insertOrThrow(ObjectTable.TABLE_NAME, null, values); final Uri newObjectUri = ContentUris.withAppendedId(OBJECT_CONTENT_URI, objectId );...
java,android,garbage-collection,android-loadermanager,android-loader
Activities will not be garbage collected if its underlying members are referencing out side of the activity. It will be garbage collected when all its members are may not be used in the future. if swapCursor(null); will remove all the underlying references with the cursor. otherwise it will create a...
android,android-fragments,android-listview,android-listfragment,android-loader
Turns out that the problem was initializing the adapter in onActivityCreated, as it's called after onCreateView - so setAdapter was being passed a null value (and it doesn't complain about that). This wasn't a problem in the ListFragment and ListActivity implementations I'd looked at as you can use their setListAdapter...
android,android-activity,android-sqlite,android-loadermanager,android-loader
It is not the case that Loader is very problematic solution. Rather, web-service calls and push notifications are asynchronous, and the problem of integrating the result data delivered by these into the existing data set (and managing it within the Activity / Fragment life-cycle) is a complex situation which the...