android-widget

Disable All Touch Screen Interactions While Animation

£可爱£侵袭症+ 提交于 2019-12-18 11:52:53
问题 I wish to disable all the touch screen interactions while an animation is being displayed. I don't wish to use the setClickable() method on the buttons at the start or end of the animation because there are a large number of buttons. Any suggestions? 回答1: In your Activity, you can override onTouchEvent and always return true; to indicate you are handling the touch events. You can find the documentation for that function there. Edit Here is one way you can disable touch over the whole screen

ExpandableListView - keep selected child in a “pressed” state

余生长醉 提交于 2019-12-18 11:11:51
问题 I'm using an ExpandableListView in a left nav for a tablet screen. When a user presses a child of a group in my expandable list, I'd like to keep the child in the pressed state so that the user knows for which child the right hand content is being shown for. For a ListView, I was able to accomplish this effect with this line in the code: getListView().setChoiceMode(ListView.CHOICE_MODE_SINGLE); and then applying this selector: <selector xmlns:android="http://schemas.android.com/apk/res

Android widget onclick listener for several buttons

久未见 提交于 2019-12-18 11:04:22
问题 I am trying to create a widget for my application. From my reading an android developer site your onclick listeners all need to have an Intent. But what if I just want my button to update data in the widget itself and I don't want to start a new activity? Here is some Android demo code: Intent intent = new Intent(context, ExampleActivity.class); PendingIntent pendingIntent = PendingIntent.getActivity(context, 0, intent, 0); // Get the layout for the App Widget and attach an on-click listener

Android: Hide child dividers in ExpandableListView

风流意气都作罢 提交于 2019-12-18 10:54:26
问题 I need to completely remove dividers from ExpandableListView. As for parent items it's a setDividerHeight method where I can pass a zero value. But there's no similar method for child divider. Is there any way to hide it? 回答1: If you want to completely remove dividers from ExpandableListView , setDividerHeight is ok for both parent and child items. Child divider will be draw using the same height as the normal divider or set by setDividerHeight() . And I am using one work around for us to

Widget not deleted when passing RESULT_CANCELED as result for configuration activity

社会主义新天地 提交于 2019-12-18 10:36:11
问题 I have some problems with my widgets. Here is the description: Context: I have a home widget. When I add it, it pops a configuration Activity for setting some parameters for the widget. If I call setResult(RESULT_OK, resultValue); before finishing the configuration Activity, the widget is added to the Home. If I delete the widget by dragging it to the trash bin, public void onDeleted(Context context, int[] appWidgetIds) from my AppWidgetProvider class gets called. So far so good. Problem: If

How to add controls to a Tab Layout in Android?

依然范特西╮ 提交于 2019-12-18 10:16:59
问题 I am following this tutorial https://developer.android.com/guide/tutorials/views/hello-tabwidget.html and have completed it. Now I would actually like to add you know some controls to these tabs like textboxes(text edit). How do I do this? I go to my mail.xml using eclipse as my ide and go to layout view and I now get a NullPointerException so I can't even drag stuff onto the layout anymore. Edit This is what I have <?xml version="1.0" encoding="utf-8"?> <TabHost xmlns:android="http://schemas

How can i do factory reset using adb in android?

◇◆丶佛笑我妖孽 提交于 2019-12-18 10:13:54
问题 How can i do the factory reset in android using ADB command? I had used adb reboot recovery command to get reset. But third party applications couldn't be cleared somehow.Is it correct way to achieve using ADB? Actually, I want to do factory reset android devices through java code.What can be solution here? 回答1: You can send intent MASTER_CLEAR in adb: adb shell am broadcast -a android.intent.action.MASTER_CLEAR or as root adb shell "su -c 'am broadcast -a android.intent.action.MASTER_CLEAR'"

SingleSelectList trouble with customView for one row onclicklistener

人走茶凉 提交于 2019-12-18 09:49:25
问题 I am trying to construct SingleSelect list by extending ListView with customrow like <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="horizontal" android:layout_width="fill_parent" android:layout_height="fill_parent" android:descendantFocusability="blocksDescendants" > <CheckBox android:id="@+id/chk" android:button="@drawable/q_list_check_box" android:layout_alignParentLeft="true" android:layout_width="wrap

Restrict Android Widget to one instance per device

不想你离开。 提交于 2019-12-18 05:46:09
问题 How could I restrict Android widgets in a way that only one instance can be created by the user at all times? A possible way is to store a SharedPreference including a counter variable and crash, if the count is 1, but obviously I'm not in favor of that solution. ;-) 回答1: How could I restrict Android widgets in a way that only one instance can be created by the user at all times? You can't. However, just because the user asks for multiple instances of your app widget does not mean you have to

Using PreferencesActivity from a widget?

折月煮酒 提交于 2019-12-18 05:24:07
问题 The PreferenceActivity seems like a really easy helper class to manage the preferences of an app. I'd like to also use that same class from the widget. On the first instance of a widget I want the PreferenceActivity to come up. This was very easy to do from the configuration activity but here is the glitch... I can't tell when the preference edit is completed! All examples of widget preferences I see on the net use a manually built preference screen rather than the PreferenceActivity helper