android-widget

Resetting Search Widget (SearchView) value

有些话、适合烂在心里 提交于 2019-12-04 10:00:42
问题 I've got 2 activites : the first, HomepageActiviy , have a search widget that search data using another activity, SearchActivity . What I want to do is when I go back from SearchActiviy to HomepageActivity , the search widget go collapsed and with a empty text. I've tried to do this following thing : public class HomepageActivity extends Activity { @TargetApi(11) @Override public boolean onCreateOptionsMenu(Menu menu) { MenuInflater inflater = getMenuInflater(); inflater.inflate(R.menu

Set predefined values to MultiAutoCompleteTextView : Android [closed]

假装没事ソ 提交于 2019-12-04 09:16:04
Closed. This question is off-topic. It is not currently accepting answers. Learn more . Want to improve this question? Update the question so it's on-topic for Stack Overflow. Closed 5 years ago . I have to set some predefined values to MultiAutoCompleteTextView (before I select from suggestion drop down list). It's like, as if you selected 2-3 items from drop-down list. After setting these predefined values, again I want to continue with normal process of filtering from the list and add it to MultiAutoCompleteTextView . It would look like this Predefined1, Predefined2, Predefined3, If I do

Widget setOnClickPendingIntent not starting service

社会主义新天地 提交于 2019-12-04 09:02:09
Following the example here i created my widget with ease. I then added a button to my widget, this button should start a service so I added the following code to my WidgetProvider @Override public void onEnabled(Context context) { Log.e("ERROR", "REMOVE ME"); // TODO remove. This is for eclipse logcat recognition RemoteViews views = new RemoteViews(context.getPackageName(), R.layout.widget_layout); Intent intent = new Intent(context, RepairService.class); PendingIntent pi = PendingIntent.getService(context, 0, intent, 0); views.setOnClickPendingIntent(R.id.widget_boost, pi); } The code

Is possible to customize positive and negative buttons in AlertDialog?

孤街醉人 提交于 2019-12-04 08:55:46
Is possible to customize positive and negative buttons in AlertDialog ? I need to replace default look of positive and negative with custom. .setPositiveButton(android.R.string.ok, new DialogInterface.OnClickListener() {... .setNegativeButton(android.R.string.cancel, new DialogInterface.OnClickListener() {... Can somebody tell me how to do that ? public class ComentarDialog extends DialogFragment{ @Override public Dialog onCreateDialog(Bundle savedInstanceState) { AlertDialog.Builder builder = new AlertDialog.Builder(getActivity()); builder.setMessage("Mensaje de alerta") .setTitle("Comentar")

Changing ImageView content causes OutOfMemoryError

依然范特西╮ 提交于 2019-12-04 08:19:16
问题 I have a very simple application with one ImageView and a Button. The first Drawable resource loaded by my ImageView is specified with the "android:src" tag in the XML Layout, however at runtime i want to change the picture displayed by it . To do so i start an Activity for result to pick an image from the sd card (intent sent to MediaStore.Images.Media.EXTERNAL_CONTENT_URI). However when the picture is selected, i try to update the ImageView with the chosen Picture's URI but i get the

Button click lost on widget when screen is rotated

谁说胖子不能爱 提交于 2019-12-04 08:01:48
I have a very simple widget application which consists of a LinearLayout with a background and an ImageButton . In the AppWidgetProvider onUpdate() method, I register the click of the button to broadcast an intent. When the widget first loads, everything runs fine and the click is captured. The problem occurs when the screen is rotated, and the click is never captured again even if the screen is rotated back. What do I have to do to re-register the click when the screen rotates? below is some segments of code I am using. AppWidgetProvider @Override public void onReceive(Context context, Intent

Android - Multiple appWidgets playing different sounds

笑着哭i 提交于 2019-12-04 07:43:55
I'm writing an android soundboard wich allow the user to create multiple desktop widgets, one for each sound. I'm using an activity for the user to choose wich sound he wants to create the widget for. For each widget created i store a shared preference in the form of key => "WIDGET_FILENAME_"+widgetId, value=> fileName To play the sounds, i did override the onRecieve method on the widgetProvider class. When the desktop widget is clicked, it triggers a broadcast to this method, wich gets the widget id from the intent and then loads the shared preference associated with the widget: int

How to create crisp background image for 1x1 Android widget?

扶醉桌前 提交于 2019-12-04 07:39:12
问题 I'm creating an a 1x1 widget, and no matter what I try, I just can't get the background image looking nice and crisp. I've read just about any resource I can find, yet I still can't win. I'm designing for the HTC Desire/Nexus 1, and would love someone to tell me when creating the background in Photoshop, what dpi/height/width to use (currently using 72/100/80). I'll worry about other devices resolutions once I can get it looking nice on my test device first. Also, if there's anything special

how can we make table layout to scroll both ways ( horizontally, vertically)

假装没事ソ 提交于 2019-12-04 07:23:16
I am having a table defined in XML file, which currently set to Scroll vertically. But i also want it scroll horizontally as required. Here is the code of XML in use <?xml version="1.0" encoding="utf-8"?> <ScrollView xmlns:android="http://schemas.android.com/apk/res/android" android:scrollbars="vertical" android:layout_height="fill_parent" android:layout_width="fill_parent"> <TableLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="fill_parent" android:stretchColumns="0,1,2" android:id="@+id/tLayout" android:scrollbars=

How to change color of button when being click,and revert back to default color in next click?

生来就可爱ヽ(ⅴ<●) 提交于 2019-12-04 07:09:44
问题 I have a like button in my RecyclerView ,what I want is when user hit the like button for the 1st time,the button background color will change to red color,and when the same user hit the like button,the button will change back to default color which is white . I checked for few SO question,but still havent get what I want.So far my solution is like below,doesnt produce any error but when clicked the button,nothing happen. likeButton =(Button) view.findViewById(R.id.likeButton); //here for