remoteview

Android AppWidget Listview change selected imagebutton onClick

梦想与她 提交于 2019-12-11 08:15:58
问题 I've this homescreen widget: It's easy to update for example two buttons next to the logo from activity , because I have their appWidgetIds from onUpdate method from AppWidgetProvider , but imagebuttons in the list are created in RemoteViewsFactory class in getViewAt() method. @Override public RemoteViews getViewAt(int position) { RemoteViews row = new RemoteViews(ctxt.getPackageName(), R.layout.list_row_widget); row.setTextViewText(R.id.tvDescription, items.get(position).name); Intent i =

java.lang.SecurityException: Not allowed to start service Intent

為{幸葍}努か 提交于 2019-12-11 05:25:25
问题 hey all when installing my app to the emulator I get this: ERROR/AndroidRuntime(465): java.lang.RuntimeException: Unable to start receiver com.myPackage.Widget.MYWidget: java.lang.SecurityException: Not allowed to start service Intent { cmp=com.myPackage/.Widget.MYWidget$MyWidgetService } without permission android.permission.BIND_REMOTEVIEWS here is the code from my manifest <!-- Broadcast Receiver that will process AppWidget updates --> <receiver android:name=".Widget.MYWidget" android

RemoteView setLayoutParams - Change ImageView Size Inside HomeScreen Widget

巧了我就是萌 提交于 2019-12-11 03:37:06
问题 My app shows a widget with a total of 8 buttons. I would like to give the user the possibility to style that widget and customize the size of the ImageViews which are below the buttons. The aim is to leave the Buttons as they are, but to change the ImageView sizes dynamically. For this the User gets to set an icon Size, which is stored in a SharedPreference as an Integer iconSize . How can I change the size of an ImageView in a Widget? For now, the ImageViews are created with the size set in

Android remote view display images from the web?

╄→尐↘猪︶ㄣ 提交于 2019-12-11 02:43:19
问题 Does any know of a tutorial or something similar to help create a Remote View wigdet like this... I followed through the development guide on doing StackView widget. I did it but i dont know how to display images in the Stack like the example news 360 does. All i want to do is display images in the remote view from a url. 来源: https://stackoverflow.com/questions/6894147/android-remote-view-display-images-from-the-web

resolveUri failing on app private data file

南楼画角 提交于 2019-12-10 11:09:47
问题 I'm generating a bunch of image files when my app first runs, and then trying to use remoteViews.setImageViewUri() later to get these images into my ImageViews. However, when I run the app I'm seeing 01-03 15:05:11.252: W/ImageView(137): Unable to open content: file:///data/data/com.nickavv.cleanwidgets/files/batt_s_19.png 01-03 15:05:11.252: W/ImageView(137): java.io.FileNotFoundException: /data/data/com.nickavv.cleanwidgets/files/batt_s_19.png (Permission denied) Since the file was created

Get TextView from RemoteViews to make its text scrollable

喜你入骨 提交于 2019-12-10 10:55:25
问题 I have a notification built with a RemoteView from a service. The RemoteView layout contains a TextView that I want to have it scrolling. I've set it up as marquee in the xml, all good. But now I need to set textView.setSelected(true) therefore I need to somehow reference the textView. So how do I get the textView from the RemoteView to do setSelected()? Or is there another way to make it scrolling in the notification? I tried LayoutInflater inflater = (LayoutInflater) getSystemService(LAYOUT

Call setImageDrawable from RemoteViews

醉酒当歌 提交于 2019-12-10 10:33:46
问题 I have done this in an Activity and it works perfectly. ImageView myImage = (ImageView) findViewById(R.id.myImageView); ShapeDrawable mDrawable; mDrawable = new ShapeDrawable(new OvalShape()); mDrawable.getPaint().setColor(0xff74AC23); mDrawable.setBounds(x, y, x + width, y + height); mDrawable.setIntrinsicWidth(width); mDrawable.setIntrinsicHeight(height); myImage.setImageDrawable(mDrawable); Now I want to do the same thing in a widget (inside onUpdate ) and I have to use RemoteViews to

android update widget appearance

不羁的心 提交于 2019-12-08 09:16:35
问题 I want to change one of the visual elements of an android widget when the user clicks it. This is in the widget's xml <ImageView android:id="@+id/bg" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_centerInParent="false" android:layout_marginLeft="20dp" android:layout_marginTop="18dp" android:src="@drawable/seal" /> I want to change the src based on an ID, so from the widget I plan to send the remoteView a click listener Intent bgSwitch = new Intent

Glide: load image to push notifications

时光怂恿深爱的人放手 提交于 2019-12-07 15:58:44
问题 I am trying to load an image to a push notification using Glide but it says this: FATAL EXCEPTION: Thread-9730 Process: com.monkingme.monkingmeapp, PID: 24226 java.lang.IllegalArgumentException: You must call this method on the main thread at com.bumptech.glide.util.Util.assertMainThread(Util.java:135) And the code used: NotificationTarget notificationTarget = new NotificationTarget( context, rv, R.id.remoteview_notification_icon, notification, NOTIFICATION_ID); Glide.with(context

Is it safe to rely on the call to onDataSetChanged() after onCreated() in RemoteViewsFactory of an AppWidget

时间秒杀一切 提交于 2019-12-07 04:37:25
问题 I developed my AppWidget according to the android doc, loading my cursor in onCreate() and reloading it in onDataSetChanged() , and everything worked fine, until I set some breakpoints in my RemoteViewsService.RemoteViewsFactory and surprisingly found that onDataSetChanged() is always called after the call to onCreate() , which made my cursor loaded twice when first created. I'm on Android 4.4.3. According to the Api doc, public abstract void onDataSetChanged () Added in API level 11 Called