android - pendingintent not working sometimes -


i have home screen widget has text views. when click on text view main activity opens. have set pendingintent on text views.

intent intent = new intent(context, mainactivity.class);     pendingintent pendingintent = pendingintent.getactivity(context, 0,             intent, 0);      remoteviews views = new remoteviews(context.getpackagename(),             r.layout.widget_layout);     views.setonclickpendingintent(r.id.contentw1, pendingintent);     views.setonclickpendingintent(r.id.contentw2, pendingintent);     views.setonclickpendingintent(r.id.contentw3, pendingintent);      appwidgetmanager.updateappwidget(appwidgetids, views);      updatewidget(context, appwidgetmanager, appwidgetids); 

this code works fine. when click on text view nothing happens. widget seems freezed. have manually open main activity main application pendingintent again works fine , text view becomes clickable.

i have no idea why happening.

instead of setting many elements 1 intent, have ever tried group them layout, , set intent on layout instead?

plus, it's recommended add flags intent, use

intent.flag_activity_clear_task 

and

flag_activity_new_task 

and set in pending intent

setonclickpendingintent(r.id.contentw3,0, pendingintent,                          pendingitent.flag_update_current); 

Comments

Popular posts from this blog

linux - xterm copying to CLIPBOARD using copy-selection causes automatic updating of CLIPBOARD upon mouse selection -

c++ - qgraphicsview horizontal scrolling always has a vertical delta -