0

I am unable to get support V-7 or toolbar in Java Class

package com.adworld.admin.ab;

import androidx.appcompat.app.AppCompatActivity;

import android.os.Bundle;
import android.widget.Toolbar;

public class Main2Activity extends AppCompatActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main2);

        Toolbar toolbar = findViewById(R.id.toolbar);
        setSupportActionBar(toolbar);
    }
}
Gabriele Mariotti
  • 320,139
  • 94
  • 887
  • 841
Patrick Dark
  • 11
  • 1
  • 3
  • Hi, I've edited your question a bit to format the code. You should do that yourself next time. Please read [ask], then [edit] your question and clarify what the problem is. What do you mean by "unable t get support"? What happens when you run your code? What did you expect to happen instead? Any errors? – Robert Oct 30 '19 at 05:46
  • convert your project to androidx follow [these](https://stackoverflow.com/a/55428961) steps – kam1234 Oct 30 '19 at 07:36

1 Answers1

0

You are using AndroidX so the package you need to import is -

import androidx.appcompat.widget.Toolbar
Naresh NK
  • 1,036
  • 1
  • 9
  • 16