-1

Toolbar mainly should used with ActionBarActivity if I want to use it by Extends Activity it gives an error when I call

 setSupportActionBar(toolbar);

I main Above I don,t want to use ActionBarActivity

Any help here , And what About Another kind Of Activities

Like FragmentActivity or Others .

Example to support FragmentActivity

 ActionBarActivity activity = (ActionBarActivity) getActivity();
 activity.setSupportActionBar(toolbar);
Maher Ismaail
  • 1,663
  • 2
  • 15
  • 26

2 Answers2

2

If you're extending Activity just use setActionBar(). setSupportActionBar is for when your're using ActionBarActivity from the support library

freddieptf
  • 2,134
  • 2
  • 15
  • 16
0

You have done little mistake .. you had to extend

ActionBarActivity

not only

Activity

class ..when you do error will be removed.