android-widget

Android Button Position Programmatically

混江龙づ霸主 提交于 2019-12-04 03:11:56
I have a button in my application. I want to change its position programmatically. I have created a button in XML as follows: <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="vertical" android:layout_width="fill_parent" android:layout_height="fill_parent" > <Button android:text="@+id/Button01" android:id="@+id/Button01" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginLeft="50px" android:layout_marginTop="10px" > </Button> </LinearLayout> Suppose I want to set the

App Widget does not appear in the widget list on Honeycomb devices until Launcher is restarted [duplicate]

柔情痞子 提交于 2019-12-04 03:01:08
Possible Duplicate: Android AppWidget does not show up in the menu in honeycomb until reboot It seems like the default launcher in Android 3 (Honeycomb) has a bug. It doesn't seem to refresh the widget list when you install a new application. When you restart the launcher (or restart the whole tablet) the widget will be there, as it should be. Seems like the widget list there is cached, while on earlier versions of Android, and in other launchers this is not the case. I've followed the instructions in the SDK, and it seems to be working find on other devices, but on Android 3 it never worked

getting battery level at android widget

岁酱吖の 提交于 2019-12-04 02:55:21
I wrote a widget for Android and I'm trying to get the battery level. I've tried using Intent batteryIntent = context.registerReceiver(null, new IntentFilter(Intent.ACTION_BATTERY_CHANGED)); but I get the error: "IntentReceiver components are not allowed to register to receive intents" Why? the ACTION_BATTERY_CHANGED is a sticky intent and I don't register a receiver (null in the first parameter). Any workaround? Thanks. hackbod gave the solution at the comments: " use getApplicationContext().registerReciever() " Ummmm...that feels like a bug. They must be doing the is-a- BroadcastRecevier

android:errorMessageBackground getting no resource found error in styles.xml

我怕爱的太早我们不能终老 提交于 2019-12-04 02:45:05
i was working on EditText validations and using ' setError ' to show error messages. My primary motto is to change the error popup as par my application design. I used the "android:errorMessageBackground" in styles but unfortunately i am getting **No Resource found error** . Used Base API: 2.2 (Even tried with 4.0.3 also) not sure what we need to do ? This seems to be a known issue: https://code.google.com/p/android/issues/detail?id=55879 来源: https://stackoverflow.com/questions/13874197/androiderrormessagebackground-getting-no-resource-found-error-in-styles-xml

Update issue of an app widget using collection

不羁的心 提交于 2019-12-04 02:41:06
I have created an app widget using collection for my app, The widget shows date and list of item on that particular date. Everything works fine and the widget are updating as required, But sometimes what happen while changing the date in the widget by clicking next and previous button, the list is not refresh means the items are not updated on that particular date. This behaviour is random and its occur sometimes only. So why this happen, anything wrong in my code. Code that i have use is: WidgetProvider.class public class WidgetProvider extends AppWidgetProvider { private ThemeManager m

Custom Position of Hint in Edit Text box.

為{幸葍}努か 提交于 2019-12-04 00:48:59
I was wondering if there was any way that I could get a hint at the bottom of an Edit Text view -- and then the user to start entering text at the top of the box. As a bonus question, is there any way I can make the hint NOT disappear once the user starts entering text. You can set the position of the text using the "gravity" attribute (as noted at http://developer.android.com/reference/android/widget/TextView.html#setGravity(int) ). So to put the text at the bottom you would have; android:gravity="bottom" And to answer your bonus question; No, you can't display the hint when text is entered

How to make animated GIFs work from Android WebView

不想你离开。 提交于 2019-12-04 00:33:21
Animated GIF images rendered by Android's WebView do not seem to animate. Has anyone figured out how to make them work? I'm testing on an N1 with 2.1-u1. None of the web settings available seem applicable. Not supported YET. Read more about this here: http://code.google.com/p/android/issues/detail?id=3422 For large memory phones like Droid and Nexus One, the two-line change has been made in Froyo (unreleased) to enable animated GIFs. For small memory phones, the change is not trivial and did not make it into this future release. As a workaround, if you are using a custom WebView, you can do

How to Handle Button Click on Widget

╄→尐↘猪︶ㄣ 提交于 2019-12-03 23:07:41
问题 I've a widget on my app and Service in order to update automatically. Widget has a ImageButton which triggers updating content manually. But I couldn't handle click event. Here is my AppWidgetProvider : public class MyWidget extends AppWidgetProvider { public static String ACTION_WIDGET_RECEIVER = "ActionReceiverWidget"; @Override public void onUpdate(Context context, AppWidgetManager appWidgetManager, int[] appWidgetIds) { super.onUpdate(context, appWidgetManager, appWidgetIds); RemoteViews

Relative Layout ignoring setMargin()

让人想犯罪 __ 提交于 2019-12-03 22:38:16
I'm trying to nest a RelativeLayout inside of a LinearLayout , and give the RelativeLayout a margin that spaces it's edges away from the edges of the LinearLayout . So far I have this: LayoutInflater.from(context).inflate(R.layout.conversation_view_layout, this, true); this.setLayoutParams(new MarginLayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT)); int tbm = AllConversationsActivity.topAndBottomMargin; int lrm = AllConversationsActivity.leftAndRightMargin; ((MarginLayoutParams) this.getLayoutParams()).setMargins(lrm, tbm, lrm, tbm); this.requestLayout(); Which, if I'm

Android widget update via service, that is doing http requests

只谈情不闲聊 提交于 2019-12-03 22:07:05
what is the best strategy for the following scenario: my app will periodically send and receive http requests to a server run PHP script. I tried a service fired by AlarmManager or clicking directly on its widget. Direct operations on the device are working fine (like random numbers, see http://www.vogella.com/tutorials/AndroidWidgets/article.html ) when it comes to the request, these should be done in async tasks. I tried to update the widget (remoteView) from the postexecute section of the async task, but it is not working. Somebody could give me some hints or maybe snippets? thank you in