I'd get rid of all the getApplicationContext() calls. The Context you
are supplied in onUpdate() will work just fine for all of those.

Also, FLAG_ACTIVITY_NEW_TASK is a flag for Intent, not PendingIntent.
Please move it to a setFlags() call on the Intent object.

On Sun, Jun 12, 2011 at 1:40 PM, ABSOLUT <[email protected]> wrote:
> Hi,
>
> I have a button in my appwidget that I would like that launch the
> activity. I have this in the code:
>
>  public void onUpdate(Context context, AppWidgetManager
> appWidgetManager,
>            int[] appWidgetIds) {
>
> RemoteViews remoteViews = new RemoteViews(context.getPackageName(),
> R.layout.widget_layout);
> Intent intent = new Intent(context.getApplicationContext(),
> Servicio.class);
>        context.startService(intent);
>        Intent intent2 = new Intent(context.getApplicationContext(),
> tele.class);
>        PendingIntent pendingIntent =
> PendingIntent.getActivity(context.getApplicationContext(), 0, intent2,
> intent2.FLAG_ACTIVITY_NEW_TASK);
>        remoteViews.setOnClickPendingIntent(R.id.textoWidgetCron,
> pendingIntent);
>
> But the activity doesn't start. Could you help me please?
> Thanks and sorry for my english!
>
>
> --
> You received this message because you are subscribed to the Google
> Groups "Android Developers" group.
> To post to this group, send email to [email protected]
> To unsubscribe from this group, send email to
> [email protected]
> For more options, visit this group at
> http://groups.google.com/group/android-developers?hl=en
>



-- 
Mark Murphy (a Commons Guy)
http://commonsware.com | http://github.com/commonsguy
http://commonsware.com/blog | http://twitter.com/commonsguy

Android Training in NYC: http://marakana.com/training/android/

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to