BroadcastReceiver with acton SCREEN_ON in background

All we need is a simple explanation of the problem, which is provided below. I want to listen when screen of device is on and update widget but BroadcastReceiver does not work when I close my app. It works only when application is running. AndroidManifest.xml: <receiver android:name=".WidgetProvider" android:exported="true"> <intent-filter> <action android:name="android.appwidget.action.APPWIDGET_UPDATE"/> <action android:name="android.intent.action.SCREEN_ON"/> <action android:name="android.intent.action.SCREEN_OFF"/> … Read more

Issue when implementing two AppWidgetProvider for two different Android Home Screen Widgets

All we need is a simple explanation of the problem, which is provided below. My Objective: Create two Android Home Screen widgets for an app of two different sizes (3×2 & 5×2) as discussed in this StackOverflow question: Multiple widget sizes. As mentioned, two classes that implement AppWidgetProvider() must be created that serve as the … Read more

Receiving "old" Intent data from Widget PendingIntent. How to clear out?

All we need is a simple explanation of the problem, which is provided below. My WidgetConfigActivity creates an onClickListener PendingIntent to pass through RemoteViews to perform two tasks: (1) open SliderActivity and (2) pass the appropriate appWidgetId. val views =RemoteViews(context.packageName, R.layout.widget) views.setOnClickPendingIntent( R.id.tv_widget_access_slider, getSliderPendingIntent(this, appWidgetId) ) fun getSliderPendingIntent(context: Context, appWidgetId: Int): PendingIntent { val intent … Read more

How to use widget lists in ListView.builder?

All we need is a simple explanation of the problem, which is provided below. class CardPage extends StatelessWidget { String title; String description; CardPage({Key key,this.title,this.description}) : super(key: key); @override Widget build(BuildContext context) { final ThemeData themeData = Theme.of(context); return Container( height: (108), child: Card( semanticContainer: true, clipBehavior: Clip.antiAliasWithSaveLayer, child: ElevatedButton( onPressed: () {}, style: ElevatedButton.styleFrom( … Read more

How to read preference with glance Widget Jetpack compose?

All we need is a simple explanation of the problem, which is provided below. I’m trying to do a weather app with a widget. I call open weather map api and I can see the wether in the main screen on the phone. I save them in dataStore with : mainViewModel.setCity(city) fun setCity(city: String){ viewModelScope.launch … Read more

TextWatcher&Editable cannot be resolved to a type–from "Learning Android"

All we need is a simple explanation of the problem, which is provided below. I am reading the book "Learning Android", I typed the code on page 71, the eclipse show the error: Editable cannot be resolved to a type… TextWatcher cannot be resolved to a type… The method addTextChangedListener(TextWatcher) in the type TextView is … Read more

ListAdapter lifecycle and screen rotation for canceling a AsyncTask

All we need is a simple explanation of the problem, which is provided below. I have a asynctask that I cancel when the view is destoried via onDestoryView(). This problem is I do “downloader.cancel(true);” and it wont cancel. In fact, it will return false. Currently, it references the ListAdapter to add items to it. However … Read more

Android Widget+Service

All we need is a simple explanation of the problem, which is provided below. I have a music player which plays music using a service,all the broadcast receivers within that service are defined inside the service and not externally. I am totally new to widgets so i had been seeing a few tutorials.But they didn’t … Read more