Widget onUpdate called when Configuration Activity is launched

Providing an answer after digging into the source code: 1) This is expected behavior see here This method is also called when the user adds the App Widget 2) Seems you have found your own answer. For others looking for the docs go here Note: Updates requested with updatePeriodMillis will not be delivered more than … Read more

How can I do factory reset using adb in android? [closed]

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'” After Android 8.0 and above with root permission from shell am broadcast -p “android” –receiver-foreground -a android.intent.action.FACTORY_RESET

How can an error message be set for the Spinner in Android?

There are a few solutions in this thread Creating a setError() for the Spinner: The EdmundYeung99‘s one works for me, either you are using your own adapter or not. Just put the following code in your validate function: TextView errorText = (TextView)mySpinner.getSelectedView(); errorText.setError(“”); errorText.setTextColor(Color.RED);//just to highlight that this is an error errorText.setText(“my actual error text”);//changes … Read more

Button click event for android widget

Here is one example more that should help: package com.automatic.widget; import android.app.PendingIntent; import android.appwidget.AppWidgetManager; import android.appwidget.AppWidgetProvider; import android.content.ComponentName; import android.content.Context; import android.content.Intent; import android.widget.RemoteViews; public class Widget extends AppWidgetProvider { private static final String SYNC_CLICKED = “automaticWidgetSyncButtonClick”; @Override public void onUpdate(Context context, AppWidgetManager appWidgetManager, int[] appWidgetIds) { RemoteViews remoteViews; ComponentName watchWidget; remoteViews = new RemoteViews(context.getPackageName(), … Read more

Open source Android libraries? Reusable Views, ViewGroups, Adapters etc? [closed]

Update June 28, 2013: More libraries Some high quality ones: actionbarsherlock.com DragSortListView FadingActionBar Square Open Source Android libraries (multiple high quality libraries) ActionBar-PullToRefresh PagerSlidingTabStrip FunDapter viewpagerindicator.com GreenDroid or the GDCatalog demo app See also: Android UI Patterns App demoing and listing lots of components from various developers (the app has been removed from the playstore, … Read more

Pop up window over Android native incoming call screen like true caller Android app

I am not sure that your custom GUI will always be on top of the default one, because the system broadcast receiver and your receiver are both trying to display its GUI on top of the screen. We are not sure which one is called first, but one tricky work to make your GUI on … Read more

Using selector to change TextView text color

1) Use tab_text_selector.xml as below and put it into res/color folder: <selector xmlns:android=”http://schemas.android.com/apk/res/android”> <item android:state_selected=”true” android:color=”@android:color/white” /> <item android:state_focused=”true” android:color=”@android:color/white” /> <item android:state_pressed=”true” android:color=”@android:color/white” /> <item android:color=”#504f4f” /> <!– default case –> </selector> And set it to your textview as below.. TextView tv = (TextView) findViewById(R.id.TextView1) ; tv.setTextColor(context.getResources().getColor(R.color.tab_text_selector)); 2) The Second option is If you … Read more