android-widget

Can't add the widget to the home screen - App isn't installed

眉间皱痕 提交于 2021-02-20 04:26:28
问题 I'm trying to create my first widget. I run the app through eclipse, and it launches fine. But when I try to add the widget from the widgets menu to the home screen I get a toast that says: App isn't installed When I look at the logcat I see this error: 05-15 18:35:10.533: E/Launcher(851): Error: appWidgetId (EXTRA_APPWIDGET_ID) was not returned from the \widget configuration activity. I don't have a configuration activity at all, and as far as I understood from the developer's site, it's not

Xamarin: Android Widget with timer, stops when app killed

感情迁移 提交于 2021-02-11 14:21:49
问题 I have this code: public class MyWidgetProvider : AppWidgetProvider { public override void OnUpdate(Context context, AppWidgetManager appWidgetManager, int[] appWidgetIds) { Log.Debug("WIDGET", "Updating the widget"); // Open app on click RemoteViews views = new RemoteViews(context.PackageName, Resource.Layout.MyWidget); Intent launchAppIntent = new Intent(context, typeof(MainActivity)); PendingIntent launchAppPendingIntent = PendingIntent.GetActivity(context, 0, launchAppIntent,

Mirror (flip) a View / ProgressBar

邮差的信 提交于 2021-02-08 13:16:19
问题 I have a custom built circular progress bar used for a seconds counter on a clock, which I'd like to flip, so that the clock is counting counter-clockwise. Searching here for a solution, I found this: Right to Left ProgressBar? Which obviously works for a horizontal progress bar, but I can't simply rotate it 180 degrees, since that will just move the clock 180 degrees and it will still be ticking clockwise. Is there any other way to mirror a ProgressBar, or any View? Edit: Just found "android

How to perfectly sync clock app widget with system clock in Android?

一世执手 提交于 2021-02-08 10:40:14
问题 I made a digital clock widget which is using AlarmManager to update the time every 60 seconds. @Override public void onEnabled(Context context) { super.onEnabled(context); Log.d("onEnabled","Widget Provider enabled. Starting timer to update widget every minute"); AlarmManager alarmManager = (AlarmManager) context.getSystemService(Context.ALARM_SERVICE); alarmManager.setRepeating(AlarmManager.RTC, System.currentTimeMillis(), 60000, createClockTickIntent(context)); } The problem is, polling the

Use Switch button to toggle dayNight theme

北慕城南 提交于 2021-02-08 03:54:22
问题 I have implemented a Switch button in my layout and want to use Android dayNight theme using the button, dayNight theme works okay but the problem is that when ever I click the switch it does not work instantly , i have to change activities and then it works, for example if I click on switch in one activity it will not do anything until i press the back button and move to some other activity and again come back to that activity and also my switch state always set to default when ever I change

Use Switch button to toggle dayNight theme

与世无争的帅哥 提交于 2021-02-08 03:54:08
问题 I have implemented a Switch button in my layout and want to use Android dayNight theme using the button, dayNight theme works okay but the problem is that when ever I click the switch it does not work instantly , i have to change activities and then it works, for example if I click on switch in one activity it will not do anything until i press the back button and move to some other activity and again come back to that activity and also my switch state always set to default when ever I change

Android PreferenceScreen - Can I use it without saving preferences to SharedPreferences?

爱⌒轻易说出口 提交于 2021-02-07 11:27:39
问题 I'm trying to use the Android PreferenceScreen as a convenient way to layout my user settings, but I don't want to save the preferences to the device shared preferences. Is this possible, or should I be using a different mechanism such as ListView ? It seems really convenient to use the PreferenceScreen type because I require different widgets (ie. switches, edit text). But I'm already running into problems with persistence, ie. anything I enter is persisted even across sessions when I don't

Android PreferenceScreen - Can I use it without saving preferences to SharedPreferences?

∥☆過路亽.° 提交于 2021-02-07 11:27:09
问题 I'm trying to use the Android PreferenceScreen as a convenient way to layout my user settings, but I don't want to save the preferences to the device shared preferences. Is this possible, or should I be using a different mechanism such as ListView ? It seems really convenient to use the PreferenceScreen type because I require different widgets (ie. switches, edit text). But I'm already running into problems with persistence, ie. anything I enter is persisted even across sessions when I don't

AppWidgetProvider with Android Architecture Component

做~自己de王妃 提交于 2021-01-27 07:36:35
问题 I want to implement Android Architecture Component with AppWidgetProvider. I'm not sure to map properly Widget LifeCycle to LifeCycle events. I created a BaseAppWidgetProvider to be extented by my widgets: /** * Base class for {@link BaseAppWidgetProvider} to manage {@link Lifecycle} */ public abstract class BaseAppWidgetProvider extends AppWidgetProvider implements LifecycleOwner { private final AppWidgetProviderLifecycleDispatcher mDispatcher = new AppWidgetProviderLifecycleDispatcher(this)

AppWidgetProvider with Android Architecture Component

我们两清 提交于 2021-01-27 07:36:31
问题 I want to implement Android Architecture Component with AppWidgetProvider. I'm not sure to map properly Widget LifeCycle to LifeCycle events. I created a BaseAppWidgetProvider to be extented by my widgets: /** * Base class for {@link BaseAppWidgetProvider} to manage {@link Lifecycle} */ public abstract class BaseAppWidgetProvider extends AppWidgetProvider implements LifecycleOwner { private final AppWidgetProviderLifecycleDispatcher mDispatcher = new AppWidgetProviderLifecycleDispatcher(this)