i creating appwidget has 2 different adapters, 1 of them stackview, , second gridview, display images external folder. when click in imagebutton, layout changes , create new remoteview. in onreceive, when add or delete image, notify both adapters when data changed using notifyappwidgetviewdatachanged each adapter. update occurs 1 of them
@override public void onreceive(context context, intent intent) { super.onreceive(context, intent); int appwidgetid = intent.getintextra(appwidgetmanager.extra_appwidget_id, 0); appwidgetmanager appwidgetmanager = appwidgetmanager.getinstance(context); if (intent.getaction().equals(shareddata.action_gallery)) { updatelayout(context, appwidgetmanager, appwidgetid, r.layout.gallery_screen); } else if (intent.getaction().equals(shareddata.action_main)) { updatelayout(context, appwidgetmanager, appwidgetid, r.layout.visual_memo); } else if (intent.getaction().equals(shareddata.action_on_stack_click)) { string filename = intent.getstringextra(shareddata.item_name); intent fullscreenintent = new intent(context, fullscreenactivity.class); fullscreenintent.putextra(appwidgetmanager.extra_appwidget_id, appwidgetid); fullscreenintent.putextra(shareddata.item_name, filename); fullscreenintent.addflags(intent.flag_activity_new_task); context.startactivity(fullscreenintent); } else if (intent.getaction().equals(shareddata.receive_add)) { log.d("bitmapcreator", "receive_add"); appwidgetmanager.notifyappwidgetviewdatachanged(appwidgetid, r.id.stackview); appwidgetmanager.notifyappwidgetviewdatachanged(appwidgetid, r.id.gridview); } }
Comments
Post a Comment