Saturday, 15 June 2013

android - Native Navigation Drawer using IBM worklight -



android - Native Navigation Drawer using IBM worklight -

i'm trying create hybrid app in worklight uses navigation drawer in native. navigation drawer not appear 1 time webpage loaded. can utilize before 1st index page loading. after appears been overlapped webpage. suggest reply this? or how implement it?

public void oncreate(bundle savedinstancestate){ super.oncreate(savedinstancestate); setcontentview(r.layout.drawer_layout); wl.createinstance(this); wl.getinstance().initializewebframework(this, this); wl.getinstance().addactionreceiver(this); mdrawer = (drawerlayout) findviewbyid(r.id.drawer_layout); mlistview = (listview) findviewbyid(r.id.drawer_list1); mplanets = getresources().getstringarray(r.array.planets); mlistview.setonitemclicklistener(this); mlistview.setadapter(new arrayadapter<string>(this, android.r.layout.simple_list_item_1, mplanets)); getactionbar().sethomebuttonenabled(true); getactionbar().setdisplayhomeasupenabled(true); drawerlistener = new actionbardrawertoggle(getactivity(), mdrawer, r.drawable.ic_launcher, r.string.open, r.string.close) { @override public void ondrawerclosed(view drawerview) { toast.maketext(getapplicationcontext(), " closed: ", toast.length_long).show(); } @override public void ondraweropened(view drawerview) { toast.maketext(getapplicationcontext(), " opened: ", toast.length_long).show(); } }; mdrawer.setdrawerlistener(drawerlistener); } @override public void ondestroy() { super.ondestroy(); wl.getinstance().removeactionreceiver(this); } @override public void oninitwebframeworkcomplete(wlinitwebframeworkresult result) { // if comment line , stop webpage loading navigation drawer appears while swiping super.loadurl(wl.getinstance().getmainhtmlfilepath()); } @override public boolean oncreateoptionsmenu(menu menu) { getmenuinflater().inflate(r.menu.actionbar, menu); homecoming true; } @override public void onactionreceived(string action, jsonobject data) { //not required } @override public boolean onoptionsitemselected(menuitem item) { if (drawerlistener.onoptionsitemselected(item)) { toast.maketext(getapplicationcontext(), "option clicked", toast.length_short).show(); homecoming true; } int menuitemid = 0; switch (item.getitemid()) { case r.id.action_icon: break; case r.id.action1: menuitemid = 1; break; case r.id.action2: menuitemid = 2; break; case r.id.action3: menuitemid = 3; break; default: break; } seek { jsonobject info = new jsonobject(); data.put("itemid", menuitemid); wl.getinstance().sendactiontojs("menuitemclicked", data); } grab (jsonexception e) { log.d(tag, "json error"); } homecoming true; } @override protected void onpostcreate(bundle savedinstancestate) { super.onpostcreate(savedinstancestate); drawerlistener.syncstate(); } @override public void onitemclick(adapterview<?> parent, view view, int position, long id) { mlistview.setitemchecked(position, true); getactionbar().settitle(mplanets[position]); }

while not clear me why unable hook native navigation drawer, possible workaround (unless you've solved now) utilize js-based navigation drawer , same.

you can review this solution @ codepen.

android worklight navigation-drawer

No comments:

Post a Comment