Dynamically adjusting widget’s content and layout to the size the user defined through resize. Android

Thanks to A–C , this is possible for Jellybean and above devices and is simple to implement. Below is the sample code using onAppWidgetOptionsChanged method @TargetApi(Build.VERSION_CODES.JELLY_BEAN) @Override public void onAppWidgetOptionsChanged(Context context, AppWidgetManager appWidgetManager, int appWidgetId, Bundle newOptions) { Log.d(DEBUG_TAG, “Changed dimensions”); // See the dimensions and Bundle options = appWidgetManager.getAppWidgetOptions(appWidgetId); // Get min width and … Read more

How to create android app with app widget in single application

Create and configure widget To register a widget you create a BroadcastReceiver with an intent filter for the android.appwidget.action.APPWIDGET_UPDATE action. <receiver android:icon=”@drawable/icon” android:label=”Example Widget” android:name=”MyWidgetProvider” > <intent-filter > <action android:name=”android.appwidget.action.APPWIDGET_UPDATE” /> </intent-filter> <meta-data android:name=”android.appwidget.provider” android:resource=”@xml/widget_info” /> </receiver> You also specify the meta-data for the widget via the android:name=”android.appwidget.provider attribute. The configuration file referred by this … Read more

Rotate View Hierarchy 90 degrees

I had the same problem and managed to solve it. Instead of rotating each view or the layout by hand, I used a LayoutAnimationController. First, place a file in /res/anim/ called rotation.xml <?xml version=”1.0″ encoding=”utf-8″?> <rotate xmlns:android=”http://schemas.android.com/apk/res/android” android:fromDegrees=”0″ android:toDegrees=”-90″ android:pivotX=”50%” android:pivotY=”50%” android:duration=”0″ android:fillAfter=”true”> </rotate> Then, in your Activity’s onCreate, do @Override public void onCreate(Bundle icicle) … Read more

Widget for turning on/off camera flashlight in android

After a long time, I got free to solve this problem. Here is what I did. FlashlightWidgetProvider class : public class FlashlightWidgetProvider extends AppWidgetProvider { @Override public void onUpdate(Context context, AppWidgetManager appWidgetManager, int[] appWidgetIds) { Intent receiver = new Intent(context, FlashlightWidgetReceiver.class); receiver.setAction(“COM_FLASHLIGHT”); receiver.putExtra(AppWidgetManager.EXTRA_APPWIDGET_IDS, appWidgetIds); PendingIntent pendingIntent = PendingIntent.getBroadcast(context, 0, receiver, 0); RemoteViews views = new … Read more

Launching activity from widget

Bringing this way back from the dead, but I had a similar problem and I think I finally solved it… like you, I had a PendingIntent that I attached to the RemoteView. Sometimes it would work, and sometimes it would fail. It was driving me crazy. What I found from a tooltip on the PendingIntent.getActivty() … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)