title: Android: Fragment cannot be converted to Context
body: <p>I have an application where I used sqlite as my database in which it has a login and registration. And also a user can view all the accounts. In my view class, I used a fragment but I receive an error that says, "Error:(58, 55) error: incompatible types: _6_ViewAll cannot be converted to Context", in this line</p>
  
  <pre><code>databaseHelper = new DatabaseHelper(_6_ViewAll.this);
  </code></pre>
  
  <p>How can I resolve this?</p>
  
  <p>Here is my source code:</p>
  
  <p>_6_ViewAll.java</p>
  
  <pre><code>public class _6_ViewAll extends Fragment {
  
  private AppCompatTextView textViewName;
  private RecyclerView recyclerViewUsers;
  private List&lt;UserInfo&gt; listUsers;
  private UsersRecyclerAdapter usersRecyclerAdapter;
  private DatabaseHelper databaseHelper;
  
  View myView;
  @Nullable
  @Override
  public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, Bundle savedInstanceState) {
  
      myView = inflater.inflate(R.layout.activity__6__view_all, container, false);
  
      textViewName = (AppCompatTextView) getView().findViewById(R.id.textViewName);
      recyclerViewUsers = (RecyclerView) getView().findViewById(R.id.recycleViewUsers);
  
      initObjects();
  
      return myView;
  }
  
  private void initObjects() {
      listUsers = new ArrayList&lt;&gt;();
      usersRecyclerAdapter = new UsersRecyclerAdapter(listUsers);
  
      RecyclerView.LayoutManager mLayoutManager = new LinearLayoutManager(getActivity().getApplicationContext());
      recyclerViewUsers.setLayoutManager(mLayoutManager);
      recyclerViewUsers.setItemAnimator(new DefaultItemAnimator());
      recyclerViewUsers.setHasFixedSize(true);
      recyclerViewUsers.setAdapter(usersRecyclerAdapter);
      databaseHelper = new DatabaseHelper(_6_ViewAll.this);
  
      String emailFromIntent = getActivity().getIntent().getStringExtra("EMAIL");
      textViewName.setText(emailFromIntent);
  
      getDataFromSQLite();
  }
  
  private void getDataFromSQLite() {
      // AsyncTask is used that SQLite operation not blocks the UI Thread.
      new AsyncTask&lt;Void, Void, Void&gt;() {
          @Override
          protected Void doInBackground(Void... params) {
              listUsers.clear();
              listUsers.addAll(databaseHelper.getAllUser());
  
              return null;
          }
  
          @Override
          protected void onPostExecute(Void aVoid) {
              super.onPostExecute(aVoid);
              usersRecyclerAdapter.notifyDataSetChanged();
          }
      }.execute();
  }
   }
  </code></pre>
  
  <p>Thank you!</p>