Reputation: 1809
I have 2 activities. A and B. A has a action bar with 4 items. Each item display a different list of movies. B extends A cause I want to be able to use the action bar to change the movie list.
So my question is, can I use the same instance of activity (B) to show the different movie lists when I press an item in the action bar ?
Activity B
Activity A
Upvotes: 1
Views: 35
Reputation: 1139
I think you are a bit over complicating it, you can use one activity ActivityA
to have the actions (tabs) and the list (Recyclerview
). When you click on a tab you update your list with the movies you want. Or you can create a Fragment
to hold your movies list instead.
Also I suggest that you use tabs instead of actionbar actions they are more user friendly and apply more to this case. If you go with the tabs you can have a Viewpager
and you can swipe between your movie lists fragments. Here is all you need for the tabbed view
Upvotes: 1
Reputation: 41
Yes, you can override method click action bar buttons.
Where you click on "Popular" in A, you use your method:
public void clickPopular(){
//some action for A
}
Where you click "Popular" in B, you use your @Override method:
@Override
public void clickPopular(){
//some action for B
}
Upvotes: 0