i have 3 tabs (like whatsapp) , load same webview(which defined in activity_main.xml) in bottom want load relative layout in tab2(which defined in android_fragment.xml). unfortunately when access element using findviewbyid showing nothing not error message.
so confused. possible call layout elements of activity file in activity file using findviewbyid or there other way ?
mainactivity.java public void ontabselected(tab tab, fragmenttransaction ft) { mainfragment mainfragment= (mainfragment)getfragmentmanager().findfragmentbyid(r.id.content_frame); if(mainfragment==null){ log.d("main frame null", "returning "); return; } string value = tab.gettext().tostring(); log.d("tab value", value); if (value.equalsignorecase("tab1")) { mainfragment.executejavascriptfunction("tab1()"); //webview.loadurl("javascript:tab1();"); } else if (value.equalsignorecase("tab2")) { system.out.println("inside tab2"); imagebutton.setvisibility(0); edittext.setvisibility(0); /*txtview.setvisibility(0);*/ /*mainfragment.executejavascriptfunction("tab2()"); { edit= (edittext)findviewbyid(r.id.edittext1); log.d("value of editext", edit.tostring()); edit.setvisibility(0); } //webview.loadurl("javascript:tab2();"); */ } else if (value.equalsignorecase("tab3")) { mainfragment.executejavascriptfunction("tab3()"); //webview.loadurl("javascript:tab3();"); imagebutton.setvisibility(view.gone); edittext.setvisibility(view.gone); }
Comments
Post a Comment