android-widget

Why is android trying to read an xml layout file from the /res/layout when I have created the layout in code?

蹲街弑〆低调 提交于 2019-12-13 08:46:17
问题 This question is in respect to RemoteViews. It works as it should in normal activities, but not in widgets: I have that in my ids.xml: <item type="layout" name="linear_layout_for_widget"></item> I have this in my WidgetProvider class: RemoteViews remoteViews = new RemoteViews(context.getPackageName(), R.layout.widget4x1_layout); LinearLayout linearLayoutForWidget = layout4x1Provider.createLinearLayoutForWidget(backgroundColor, textColor, borderColor, borderWidth, false); RemoteViews

AppWidgetProvider handle touch event problem

萝らか妹 提交于 2019-12-13 07:31:46
问题 i am adding installed AppWidgetViews to my application as AppWidgetHostView. The problem is they don't handle any touch events as they were added to home screen. Here is part of my code; AppWidgetHost host = new AppWidgetHost(getContext(), HOST_ID); AppWidgetManager manager = AppWidgetManager.getInstance(getContext()); int id = host.allocateAppWidgetId(); AppWidgetHostView view = host.createView(getContext(), id, info); Lets say AppWidgetProviderInfo object "info" belongs to "com.android

Horizontal listview inside vertical listview (and scrolling multiple listviews together)

浪尽此生 提交于 2019-12-13 07:08:01
问题 I am creating an attendance app and currently am trying to implement a layout as follows for mass viewing of attendance data: AAA | B | B | B | B | C ----------------------- DDD | E | E | E | E | F DDD | E | E | E | E | F A, B and C are headers (A = Name, B = Date, C = %). A and C should fixed and should not scroll in either direction. D, E and F should scroll together vertically (D = name, E = checkbox, F = calculated %). B and E should scroll together horizontally (B = date, E = checkbox).

Redraw Widget every second

淺唱寂寞╮ 提交于 2019-12-13 07:03:33
问题 I want to create a clock widget with a second watch hand. And yes, I already read that widgets aren't designed to be refreshed that fast. The widget should become an egg timer which is only animated when the user actively starts it so it is probably not that bad for battery life and performance at all because I only use this high refresh rate when the user actively uses it... Currently I start a service which posts a delayed runnable every 1000 milliseconds. Handler

Android how to programmatically create scrollview and add programmatically created views into it

允我心安 提交于 2019-12-13 06:13:57
问题 Alright I'm trying to build an activity that has a horizontal scrollview, that the user can swipe through, to view different "pages". My train of thought is these "pages" will be views. The following is a mockup of my idea (to mess around to see if it works) I've experimented with this as follows: My content view is set to the the scrollview. (unsure if this is an incorrect approach) I create the scrollview, and place a view into it as follows: private void setupScrollView() { Display display

connect to database from widget class

北慕城南 提交于 2019-12-13 05:49:16
问题 in widget Receiver class that extend AppWidgetProvider when i want to connect to database helper class for fetching some data by this statement i get some error: public class wigetactivity extends AppWidgetProvider { @Override public void onUpdate(Context context, AppWidgetManager appWidgetManager,int[] appWidgetIds) { final DataBaseHelper myDbHelper = new DataBaseHelper(this); . . . } i get this error: The constructor DataBaseHelper(wigetactivity) is undefined my database helper class and

Image not showing up in gallery

Deadly 提交于 2019-12-13 05:26:25
问题 My app is able to take a photo and stores it into a specified folder. Using ES File explorer, I'm able to confirm that the image has been stored in sd card and the specified folder. However, my gallery is not showing this album immediately. It will need to take quite some time. Is there any ways that i can make the detection immediate using codes? The following broadcasting codes did not seem to work. My gallery doesnt immediately do a refresh to retrieve the newly created album and image.

not getting all images from gridview on item click listener

為{幸葍}努か 提交于 2019-12-13 05:24:16
问题 i m developing an application in which gridview display images from inter net...now i want to pass all image to gallery on gridview's click event.. I want that my gallery should not download all images when gallery activity is called..so,i want to pass all image from grid view to gallery activity... is there any solution to pass all images of gridview o next activity,.? My gridview's images are come from internet and i m not storing all images locally...just displaying in grid view. here is

Different widgets (views) for different screen orientations?

半城伤御伤魂 提交于 2019-12-13 04:32:54
问题 I'm quite new developing for Android so I have a very basic question. Basically, I have two screen layouts, one for portrait and another for landscape orientation. I use the folders res/layout and res/layout-land. Both orientations are drawn fine, but I have different widgets (buttons) for each orientation, btnPortrait and btnLandscape. The problem arises when I try to call onSetClickListener(). Because when the device is oriented in portrait the framework can't locate the btnLandscape and

Android, Gray out seek bars unless radio button is selected

南楼画角 提交于 2019-12-13 03:38:24
问题 I'm restricting user to either select default audio profiles or customized audio setting, for this purpose I'm using radio button for profiles and customized audio settings, so if user select customized settings all seek bars are reactive for use, Is there any way to do this, also numbers at seek bars 回答1: Are you using a SeekBar ? If that's so, you may want to set the enabled attribute to false by default : android:enabled="false" so that, when your RadioButton is checked, you set the