Note that there are some explanatory texts on larger screens.

plurals
  1. POHow to change Android widget background and textcolor?
    primarykey
    data
    text
    <p>I have need to change widget background in this way. 1- After click widget an activity launch we customize widgetview and click ok button widget should be shown on . screen.</p> <p>Like this widget:- <a href="http://youtu.be/k9SFD8yuttw" rel="nofollow">http://youtu.be/k9SFD8yuttw</a></p> <p>I have search lot on Google but not get any clue for doing this.I have much try in this way:- but its not working:-</p> <pre><code>private static final String ACTION_CLICK = "ACTION_CLICK"; private static Intent getLaunchIntent(final Context context, final int appWidgetId) { final PackageManager manager = context.getPackageManager(); final Intent intent = manager .getLaunchIntentForPackage("com.appstudioz.hellowidget"); intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK); intent.setData(new Uri.Builder().path(String.valueOf(appWidgetId)) .build()); return intent; } @Override public void onUpdate(Context context, AppWidgetManager appWidgetManager, int[] appWidgetIds) { /*Timer timer = new Timer(); timer.scheduleAtFixedRate(new MyTime(context, appWidgetManager), 1, 1000); ComponentName objcomponentname = new ComponentName(context, HelloWidget.class); int[] allappids = appWidgetManager.getAppWidgetIds(objcomponentname);*/ final RemoteViews remoteViews = new RemoteViews( context.getPackageName(), R.layout.widgetlayout); final PreferenceAdaptor preferences = new PreferenceAdaptor(context); for (final int appWidgetId : appWidgetIds) { updateAppWidget(context, appWidgetManager, appWidgetId, preferences, remoteViews); } if (preferences.isUpdateNeeded()) { // Build the intent to call the service Intent intent = new Intent(context, UpdateService.class); context.startService(intent); } } private class MyTime extends TimerTask { RemoteViews remoteViews; AppWidgetManager appWidgetManager; ComponentName thisWidget; DateFormat format = SimpleDateFormat.getTimeInstance( SimpleDateFormat.MEDIUM, Locale.getDefault()); public MyTime(Context context, AppWidgetManager appWidgetManager) { this.appWidgetManager = appWidgetManager; remoteViews = new RemoteViews(context.getPackageName(), R.layout.activity_main); thisWidget = new ComponentName(context, HelloWidget.class); } @Override public void run() { remoteViews.setTextViewText(R.id.widget_textview, "Time = " + format.format(new Date())); appWidgetManager.updateAppWidget(thisWidget, remoteViews); } } @Override public void onReceive(Context context, Intent intent) { // v1.5 fix that doesn't call onDelete Action final String action = intent.getAction(); if (AppWidgetManager.ACTION_APPWIDGET_DELETED.equals(action)) { final int appWidgetId = intent.getExtras().getInt( AppWidgetManager.EXTRA_APPWIDGET_ID, AppWidgetManager.INVALID_APPWIDGET_ID); if (appWidgetId != AppWidgetManager.INVALID_APPWIDGET_ID) { this.onDeleted(context, new int[] { appWidgetId }); } } else { super.onReceive(context, intent); } } public static void updateAppWidget(final Context context, final AppWidgetManager appWidgetManager, final int appWidgetId, final PreferenceAdaptor preferences, final RemoteViews remoteViews) { if (preferences.isUpdateNeeded()) { return; } final PendingIntent pendingIntent = PendingIntent.getActivity(context, appWidgetId, getLaunchIntent(context, appWidgetId), 0); remoteViews.setOnClickPendingIntent(R.id.thelayout, pendingIntent); appWidgetManager.updateAppWidget(appWidgetId, remoteViews); } </code></pre> <p>Anyone suggest me or give me link How I can customize my widget.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload