Launching activity from widget fail after sometimes?

I'd do it like this: public void onUpdate(Context context, AppWidgetManager appWidgetManager, int appWidgetIds) { RemoteViews updateViews = new RemoteViews(context.getPackageName(), R.layout. Mywidgetprovider_layout); Intent onClickedIntent = new Intent(context,MyActivity. Class); PendingIntent pi = PendingIntent.

GetActivity(context, 0, onClickedIntent, 0); updateViews. SetOnClickPendingIntent(R.id. MyView, pi); for (int i=0; iLength; i++) { appWidgetManager.

UpdateAppWidget(appWidgetIdsi, updateViews); } } One thing I'm not sure on is the call to super.onUpdate() My own widget code doesn't have it and seems to work fine... not sure if it's needed or not I don't know if this refactor will fix your issue though!

I'd do it like this: public void onUpdate(Context context, AppWidgetManager appWidgetManager, int appWidgetIds) { RemoteViews updateViews = new RemoteViews(context.getPackageName(), R.layout. Mywidgetprovider_layout); Intent onClickedIntent = new Intent(context,MyActivity. Class); PendingIntent pi = PendingIntent.

GetActivity(context, 0, onClickedIntent, 0); updateViews. SetOnClickPendingIntent(R.id. MyView, pi); for (int i=0; iLength; i++) { appWidgetManager.

UpdateAppWidget(appWidgetIdsi, updateViews); } } One thing I'm not sure on is the call to super.onUpdate(). My own widget code doesn't have it and seems to work fine... not sure if it's needed or not. I don't know if this refactor will fix your issue though!

Thx dave. C, It's seem work ok for me. I think the main point is move the code of updateViews.

SetOnClickPendingIntent() outside the for loop. – chow Feb 4 at 13:16 Still have problem:( become more serious after Nexus One updated 2.3.3! – chow Mar 5 at 16:15.

Setting the "on click pending intent" must done before sending it to the updateAppWidget method, so your first call to that method won't prime your "myView" object for clicks. Your code next sets the onClick trigger and calls updateAppWidget a second time. It looks like that one should work but there is a whole confusing subject regarding just when two intents are distinct or ambiguous which you may want to read about to understand why your code is working unpredictably.

If I'm right, the take-away is to simply not call updateAppWidget the first time and then always make sure to set your onClick trigger whenever creating RemoteViews objects. I hope so anyway.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions