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. regarding soap client and webservices

Hi Every One

i am new to web services

I have a created a Php Script in the server having a method name
getList
having three rows in the database are names images and rating field
having 20 names nearly

how to get the data in the Android screen in the form of table layout
or list view ?


I am used for this nusoap php web services and Mysql.

i have written a code for android soap client but i am not how call
that method and field in database

there will great appreciation for this solution..


Thanks in advance
--~--~---------~--~----~------------~-------~--~----~

2. Google I/O 2008 - Dalvik VM Internals - implicit labeling

On Wed, Jun 24, 2009 at 11:54 AM, Marek



As an example first of *explicit* labeling, if you look inside a
.class file, you will find that many parts of it are represented as
tagged attributes, where the tag identifies the attribute, say, as a
method body, a default field value, a line number table, etc. Those
attribute tags are generally two-byte references to constant pool
entries for string constants, and though two bytes may not sound like
much, they add up. Similarly, each entry in the constant pool for a
.class is preceded by a byte identifying its type, and these also add
up.

In the dex format, on the other hand, in representing the vast
majority of data, such labeling is omitted, because the format itself
implies the type of data being represented. Bytecode arrays are known
to be bytecode arrays because they are pointed at from a known offset
in a method structure; and that method structure is known to be a
method structure, since it is referred to at the right point in a
class definition structure; and that class definition structure is
known to be a class definition structure, because it is within the
class definition array pointed at by the dex file header. It's all
implicit; no tagging required.

The dex format does provide an "escape valve" for arbitrary tagged
data in the form of annotations. Dex annotations are used to represent
annotations as written in the original source code, but they are also
used for a couple of things that are represented as tagged attributes
in .class files. For example, metadata about inner classes is
represented in dex files using the annotation mechanism.

You can refer to the dex format spec for more details, under
<dalvik/docs> in the source.

Cheers,

-dan

--~--~---------~--~----~------------~-------~--~----~

3. Multiselect List View and Key Event

4. OnSharedPreferenceChangeListener not listening anymore in 1.5??

5. how to create thumbnail generated after ending video recording

6. How to get the Xml response from the nusoap PHp web services

7. INSTALL_FAILED_SHARED_USER_INCOMPATIBLE in 1.0 and 1.5