Reputation: 1061
good morning every one,
I am using swipe tabs in fragments but getting null action bar.
Code snippet is given below:
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
View rootView = inflater
.inflate(R.layout.ride_detail, container, false);
li = getLayoutInflater(savedInstanceState);
context = getActivity();
customizedToast = new CustomizedToast(context, li);
actionBar = ((ActionBarActivity)getActivity()).getActionBar();
I have also tried with:
actionBar = getActivity().getActionBar();
Thanks.
Upvotes: 1
Views: 87
Reputation: 1971
You should use getSupportActionBar
instead of getActionBar
if you are working with ActionBarActivity
. The getActionBar method is available in the ActionBarActivity API since it extends Activity, but should not be used when working with support Activities.
Check you import which action bar you are importing...
Upvotes: 2