I’m having a hard time figuring out why my App Widget ListView won’t populate with data. Everything seems to be wired up right. When I debug, I can see the data that is being retrieved from my database (Firestore). However, it still won’t populate into the App Widget.
I created a new Issue on my Github to make it easier to view the problem:Github Issue
Firestore DB
List<Review> reviews
is populatedReview
objects within it contain the right dataget()
methods return the right dataReviewsWidgetService Intent
is createdsetRemoteAdapter()
is called using the Intent
and passing in the ListView
as wellupdateAppWidget()
is callednotifyAppWIdgetViewDataChaged()
is calledReviewsAppWidgetProvider.updateAppWidgets()
is called when adding or deleting reviewsReviewsAppWidgetProvider
declared as a reveiveraction.APPWIDGET_UPDATE
ReviewsWidgetService
declared as ServiceBIND_REMOTEVIEWS
setAs you said, everything is ok with fetching data. But it's still draw a loading view. So the problem is in your divider. View can't be used in app widgets, because launcher process doesn't know about view, it's only know about limited count of views, all views that can be used, you can find here.
So how to make a such divider? Firstly you need a shape, so it will be something like bottom_border.xml:
<?xml version="1.0" encoding="UTF-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<stroke
android:width="0.5dp"
android:color="#CCCCCC" />
</shape>
So now in your root view add background bottom_border.xml like:
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:background="@drawable/bottom_border"
android:layout_width="match_parent"
android:layout_height="wrap_content">
...