android-appwidget

How to set time to Android AnalogClock in app widget?

♀尐吖头ヾ 提交于 2020-01-02 00:32:37
问题 How to set custom time to Android AnalogClock placed in app widget? As an alternative I was thinking to override default AnalogClock to set the time through codes. Or in other words, I would create my custom Clock which extends from default View or AnalogClock. Then put my custom Clock on widget layout UI. Is this possible? I'm afraid we are limited on RemoteViews to have our own custom Component. UPDATE: This is error log I have following the solution given by vArDo at first. 回答1: Intro It's

Determine the homescreen's appwidgets space grid size

若如初见. 提交于 2019-12-30 10:54:06
问题 I have developed a re-sizable app-widget for tablets. The app-widget works nice on most devices with the majority of launchers, however there are some problems with the orientation especially on the GO-HD Launcher in portrait mode. The height of the app-widget is too big and doesn't look nice. In order to deal with this I have created a method to allow the user to set any extra margins, in the app-widget space, he wants to make it look nice. For example he can set extra 20 pixels top margin

How to start Activity from Android AppWidget?

隐身守侯 提交于 2019-12-30 08:06:08
问题 Code like this works well. Intent configIntent = new Intent (context, WidgetConfigActivity.class); configIntent.putExtra(AppWidgetManager.EXTRA_APPWIDGET_ID, appWidgetId); PendingIntent pIntent = PendingIntent.getActivity(context, 0, configIntent, PendingIntent.FLAG_UPDATE_CURRENT); remoteView.setOnClickPendingIntent(R.id.btn, pIntent); But I want to hide that button befor activity will appear, so I'm triing to send intent to the widget itself, perform hiding components in onReceive() method

How to start Activity from Android AppWidget?

吃可爱长大的小学妹 提交于 2019-12-30 08:06:06
问题 Code like this works well. Intent configIntent = new Intent (context, WidgetConfigActivity.class); configIntent.putExtra(AppWidgetManager.EXTRA_APPWIDGET_ID, appWidgetId); PendingIntent pIntent = PendingIntent.getActivity(context, 0, configIntent, PendingIntent.FLAG_UPDATE_CURRENT); remoteView.setOnClickPendingIntent(R.id.btn, pIntent); But I want to hide that button befor activity will appear, so I'm triing to send intent to the widget itself, perform hiding components in onReceive() method

How to disable Widget updatePeriodMillis?

你。 提交于 2019-12-29 05:04:10
问题 I'm trying to figure out how I can disable the update period on my widgets? I don't need this particular feature. I'm just fine with the widget calling onUpdate when added that's it... 回答1: Just don't include it in your xml and it won't autoupdate, or set it to 0. 来源: https://stackoverflow.com/questions/5641134/how-to-disable-widget-updateperiodmillis

Setting programmatically the pixel size of a remote ImageVIew?

女生的网名这么多〃 提交于 2019-12-25 05:16:40
问题 Let's say that I have a layout that contains <ImageView android:id="@+id/my_id" android:layout_width="123px" android:layout_height="345px" android:padding="0dip" android:scaleType="fitXY" /> which is used in an AppWidget and is set via a RemoteViews. How can I programmatically set the width and height in pixels (overriding the 123 and 345 in the above xml)? (motivation: this image view shows a dynamic png file that is set at runtime via a file URL. If the layout_width and layout_height above

Widget: onUpdate, onReceive - appWidgetManager - not working in v2.3.5 and v3.2.1

限于喜欢 提交于 2019-12-24 11:51:34
问题 I am new to Android applications and hence have a few questions. Using the code below, I am trying action on ImageButton. And it would be important to remember that this is a Widget , not an Activity. I searched online for examples on using ImageButton in a Widget and found very little information. However, this working example seems to have problems with different versions of Android. Now, the code works on old version (2.1-update1) of Android and not in new version of phone(2.3.5) or on

onDisabled and onDeleted method not being called

故事扮演 提交于 2019-12-24 11:29:28
问题 For some reason, the onDisabled and onDeleted method of my widget is not getting called when i remove the widget from the homescreen. I don't know why. Here's the code: public class WidgetProvider2x1 extends AppWidgetProvider { @Override public void onEnabled(Context context) { Log.i("MyTag", "onEnabled"); super.onEnabled(context); } @Override public void onDeleted(Context context, int[] appWidgetIds) { Log.i("MyTag", "onDeleted"); Toast.makeText(context, "onDeleted", Toast.LENGTH_SHORT).show

Exported Activity Permission for AppWidget Configuration Activity

北战南征 提交于 2019-12-24 00:32:39
问题 I'm getting this warning for my AppWidget's configuration activity in the manifest file after I added the android:exported="true" tag. This is what it looks like... <activity android:name=".widgets.WidgetConfigurationActivity" android:theme="@android:style/Theme.Translucent" android:exported="true" > <intent-filter> <action android:name="android.appwidget.action.APPWIDGET_CONFIGURE" /> </intent-filter> </activity> The warning I'm getting is "Exported activity does not require permission".

how attach a onClick Listener to an listview item on an app widget

别等时光非礼了梦想. 提交于 2019-12-23 19:14:13
问题 I like to add a onClick Listener to every item of my listview, but nothing what I have tried work. Here is my RemoteViewsFactory: public class MyRemoteViewsFactory implements RemoteViewsService.RemoteViewsFactory { [...] public RemoteViews getViewAt(int position) { final RemoteViews remoteView = new RemoteViews( context.getPackageName(), R.layout.widget_item); [...] final Intent activityIntent = new Intent(context, ListActivity.class); activityIntent.putExtra(AppWidgetManager.EXTRA_APPWIDGET