4

I am trying to implement a ProfilesActivity in my app. So, imagine, we are in the home activity/layout: UsersActivity, where we have done addActions to init the 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 and it opens a new layout (profiles_menu.xml) where I have a listView with checkables items and an image for 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, what I want to do is: when we select a profile it has to change the profile's icon on the action bar of the home page (this go_profiles in the code) into the selected profile icon. Do you know how to do it?

enter image description here

0 Answers0