how to disable the fragment from navigation drawer android? -
i developing first android application. please 1 me issue. in application using navigation drawer, added fragments in navigation drawer. based on condition need disable 1 fragment drawer. cased on mainvendorid need add fragment navigation drawer. if mainvendorid 1 need add. code:
main_activity:
class mysimplerightarrayadapter extends arrayadapter<string> { private final context context; private final string[] values; public integer[] sideimages = { r.drawable.orders, r.drawable.cash, r.drawable.contact, r.drawable.profilee, r.drawable.changepassword,r.drawable.profilee }; public mysimplerightarrayadapter(context context, string[] values) { super(context, r.layout.drawer_list_item_two, values); this.context = context; this.values = values; } @override public view getview(int position, view convertview, viewgroup parent) { layoutinflater inflater = (layoutinflater) context .getsystemservice(context.layout_inflater_service); view rowview = inflater.inflate(r.layout.drawer_list_item_two, parent, false); textview textview = (textview) rowview.findviewbyid(r.id.tx_n_text); imageview imageview = (imageview) rowview .findviewbyid(r.id.img_side); textview.settypeface(custom_bold); textview.settext(mnavagarighttitles[position]); imageview.setimageresource(sideimages[position]); // change icon windows , iphone return rowview; } }
frag:
private void initialisepaging() { list<fragment> fragments = new vector<fragment>(); string mainvendorid=m_sharedpreference.getstring("vendorid", ""); log.v("tag_mainnnnnn", "" + mainvendorid); fragments.add(fragment.instantiate(getactivity(), previousorders_fragment.class.getname())); fragments.add(fragment.instantiate(getactivity(), retailer_fragment.class.getname())); fragments.add(fragment.instantiate(getactivity(), wallet_fragment.class.getname())); fragments.add(fragment.instantiate(getactivity(), commissions_fragment.class.getname())); fragments.add(fragment.instantiate(getactivity(), changepassword_fragment.class.getname())); fragments.add(fragment.instantiate(getactivity(), message_fragment.class.getname())); this.mpageradapter = new menu_adapter(super.getchildfragmentmanager(), fragments); pager.setadapter(this.mpageradapter); } }
string.xml:
<string-array name="navagation_bar_right">/ <item> transactions </item> <item> retailers </item> <item> wallet</item> <item> commissions</item> <item> profile</item> <item> messages</item> </string-array>
Comments
Post a Comment