android - Change icon actionbar depending on the profile selected -


i trying implement profilesactivity in app. so, imagine, in home activity/layout: usersactivity, have done addactions init actionbar like:

intent addprofilesintent = new intent(this, profilesactivity.class);     action profilesaction = (action) new intentaction(this, addprofilesintent,             r.drawable.go_profiles);     actionbar.addaction(profilesaction); 

we click on profile's icon on our actionbar , opens new layout (profiles_menu.xml) have listview checkables items , image each profile (differents profiles: work, home, auxiliary...).

listview list = (listview) findviewbyid(r.id.list);  arraylist<hashmap<string, object>> listdata=new arraylist<hashmap<string,object>>();   string []name={"    company number","   home number","   handy number","   auxiliary number"};   for(int i=0;i<4;i++){       hashmap<string, object> map=new hashmap<string, object>();       map.put("number_image", r.drawable.icon+(i+1));       map.put("number_name", name[i]);       listdata.add(map);   }   listitemadapter = new checkboxadapter(this, listdata); list.setadapter(listitemadapter);   list.setchoicemode(listview.choice_mode_single); 

now, want is: when select profile has change profile's icon on action bar of home page (this go_profiles in code) selected profile icon. know how it?

enter image description here


Popular posts from this blog

How to calculate SNR of signals in MATLAB? -

c# - Attempting to upload to FTP: System.Net.WebException: System error -

ios - UISlider customization: how to properly add shadow to custom knob image -