appwidget setOnClickPendingIntent not always working

by biokys » Fri, 20 May 2011 18:13:12 GMT


Sponsored Links
 Hi, I have an issue with my appwidget. It has really strange behaviour, 
because when I add widget to desktop it *not always* become clickable, even 
i defined setOnClickPendingIntent. On different phones it has different 
"successfull install ratio".

Thank you for your help

public class BasicWidget extends AppWidgetProvider {


private static final String LOG_TAG = "WalletWidget";

@Override
public void onUpdate(Context context, AppWidgetManager appWidgetManager, 
int[] appWidgetIds) {
Log.d(LOG_TAG, "onUpdate(): ");
context.startService(new Intent(context, UpdateService.class));
 }
 
public static class UpdateService extends Service {
@Override
public void onStart(Intent intent, int startId) {
RemoteViews updateViews = buildUpdate(this);

ComponentName thisWidget = new ComponentName(this, BasicWidget.class);
AppWidgetManager manager = AppWidgetManager.getInstance(this);
manager.updateAppWidget(thisWidget, updateViews);
}

public RemoteViews buildUpdate(Context context) {
RemoteViews updateViews = null;
Intent intent = new Intent(context, RecordActivity.class);
intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
    intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
PendingIntent pendingIntent = PendingIntent.getActivity(context, 0, intent, 
PendingIntent.FLAG_UPDATE_CURRENT);
updateViews = new RemoteViews(context.getPackageName(), 
R.layout.widget_layout);
updateViews.setOnClickPendingIntent(R.id.layout_widget, pendingIntent);

new UpdateWidgetTask(context).execute();

return updateViews;
}

@Override
public void onConfigurationChanged(Configuration newConfig)
{
RemoteViews updateViews = buildUpdate(this);

ComponentName thisWidget = new ComponentName(this, BasicWidget.class);
AppWidgetManager manager = AppWidgetManager.getInstance(this);
manager.updateAppWidget(thisWidget, updateViews);
}

@Override
public IBinder onBind(Intent intent) {
// We don't need to bind to this service
return null;
}
}
 @Override
public void onDeleted(final Context ctx, final int[] aiAppWidgetIds)
{
super.onDeleted(ctx, aiAppWidgetIds);
ctx.stopService(new Intent(ctx, UpdateService.class));
}

-- 



Other Threads

1. android-86.org down?

Hello, I'm trying to get the source for x86android. However, following
these instructions:
http://code.google.com/p/android-x86/wiki/GetSourceCode
Leads to "fatal: unable to look up"...

It seems I cannot resolve the android-86.org domain at all. Is it just
my DNS, or has the domain vanished from others as well? If this is
just temporary problem, could someone give me the IP addresses for the
x86 subdomains, so I can kludge with my hosts file?

--~--~---------~--~----~------------~-------~--~----~
unsubscribe: android-porting+unsubscr...@googlegroups.com
website: 

2. change seekbar progress color

hi i am new to android .
i want to change the color of progress of seekbar form orange that is
default ot something different.

i tried something like this:
here is my code

<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/
android">
  <item android:id="@android:id/background">
         <shape>
             <corners android:radius="5dip" />
               <gradient
                android:startColor="#ff9d9e9d"
                         android:centerColor="#ff5a5d5a"
             android:centerY="0.75"
             android:endColor="#ff747674"
                 android:angle="270"
            />
    </shape>
 </item>
    <item android:id="@android:id/progress">
         <clip>
             <shape>
                <corners android:radius="5dip" />
                        <gradient
                         android:startColor="#ffffd300"
                          android:centerColor="#ffffb600"
                         android:centerY="0.75"
                         android:endColor="#ffffcb00"
                          android:angle="270"
                 />
              </shape>
          </clip>
     </item>
 </layer-list>

 <SeekBar android:id="@+id/seek"
        android:layout_width="400dip"
        android:progressDrawable="@drawable/progress_horizontal"
        android:layout_height="wrap_content"
        android:layout_below="@+id/btngrid"
        android:layout_marginTop = "10dip"
        android:layout_marginLeft = "30dip"
        android:max="10"
        android:progress="1"
        />

but it did nothing .so anybody can help me on this problem
plz its urgent.

thanks
jaimin.
--~--~---------~--~----~------------~-------~--~----~

3. List of running process.

4. onCreate -Prob?

5. How to start android emulator in a different port

6. getting all the resources from other apks

7. Listen a keybord