android-widget

How to embed one layout inside another in my case?

﹥>﹥吖頭↗ 提交于 2019-12-09 17:04:52
问题 If I have a layout called bottom.xml , bottom.xml: (simply contain a textview and edit text view) <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="center_horizontal" android:orientation="vertical" > <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="center_horizontal" android:gravity="center_horizontal" android:text="

Get the intent from onCreate in Android

99封情书 提交于 2019-12-09 16:45:07
问题 I launch an activity from my widget using an Intent with some extra, anyway I can only get the Intent when the activity is in background.. How can I get the Intent when activity is created? Tried with this.getIntent() but extras are null. Thanks in advance 回答1: How can I get the Intent when activity is created? Call getIntent() on the Activity . Tried with this.getIntent() but extras are null. One possibility is that you are arranging for an existing instance of the activity to return to the

Are Android app widgets (for home screen) allowed gestures?

ⅰ亾dé卋堺 提交于 2019-12-09 16:28:21
问题 I noticed that when I swipe my finger from left to right across a home screen widget, in simulator on a AVD, Android switch to the left home screen. I was wondering if its possible to prevent this behavior and allow home screen gadgets to listen and react to finger gestures (like swipe)? Its very critical for my widget UI design. 回答1: Starting with API level 11 (Android 3.0.x) you can use " android.widget.RemoteViewsService.RemoteViewsFactory " and and assign a widget to use (from docs):

Android Button Position Programmatically

柔情痞子 提交于 2019-12-09 15:57:19
问题 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

How to exchange an image in a layer-list by a bitmap?

五迷三道 提交于 2019-12-09 13:51:37
问题 Here is my Bitmap Bitmap bitmap = BitmapFactory.decodeStream((InputStream) new URL(url).getContent()); //Need some code to access "dynamicItem" and exchange it with my Bitmap And here is my layer list (nothing spectacular). I want to exchange the dynamicItem with my Bitmap. <?xml version="1.0" encoding="utf-8"?> <layer-list xmlns:android="http://schemas.android.com/apk/res/android"> <item android:id="@+id/dynamicItem" android:drawable="@drawable/defaultItem" /> <item> <bitmap android:src="

Android widget update via service, that is doing http requests

ⅰ亾dé卋堺 提交于 2019-12-09 13:51:27
问题 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

How to display QuickContact card from widget

为君一笑 提交于 2019-12-09 13:13:39
问题 I have a widget that displays the picture of some of my contacts and I would like to display the QuickContact card when the user taps on one of the pictures. I know I should be using the method ContactsContract.QuickContact.showQuickContact(), but it requires a View or a Rect as one of the input parameters. My problem is that Widgets only have RemoteViews, so I'm no sure what to pass as the View or Rect parameter. Any ideas would be appreciated. 回答1: You can reference the badge in the XML I

Context menu from a ListFragment

我是研究僧i 提交于 2019-12-09 09:55:17
问题 I am trying to create an application for tablets that has a main screen with three fragments, each containing a list. I would like to enable context menus for each list, but whenever I attempt that I get an unexpected program stop and Force Close. Following is the relevant code and xml that works and gives me my desired three fragments with listviews in each, before I try and add the context menu: main.xml <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas

android EditText maxLength allows user to type more

情到浓时终转凉″ 提交于 2019-12-09 08:06:50
问题 I've already set the maxLength attribute for an EditText widget in the xml layout file, and it does limit the display of characters. But it still allows the user to press more letters on the keyboard, and backspacing deletes these extra presses rather than the last letter on the display. I believe this is not how it's supposed to be. Pressing keys after the limit has been reached should stop accepting more input even if it is not displayed. Any fix on this? Update Based on the answer below,

Creating Android widgets using phonegap

人走茶凉 提交于 2019-12-09 07:57:14
问题 Is it possible to create android homescreen widgets using phonegap ? 回答1: It's defiantly possible. But yes you will need to be writing native code and have an understanding of Java/Android. And any updating the widget needs to do, refreshing from a web service, will need to be written in Java/Android. As you can not talk to the javascript from the Service required to update the widget. 回答2: According to various posts on the PhoneGap's Google Group it doesn't seem to be possible, at least not