'Incompatible types. Found: 'com.example.myapplication.MainMenu_test', required: 'androidx.fragment.app.Fragment'
I'm trying to integrate my project with MapBox.
Here is it:
@Override
public void onResponse(Call<User> call, Response<User> response) {
if(response.isSuccessful()){
if (response.body() != null) {
String token = response.body().getToken();
SharedPreferences preferences = getActivity().getSharedPreferences("myPrefs", Context.MODE_PRIVATE);
SharedPreferences.Editor prefLoginEdit = preferences.edit();
prefLoginEdit.putBoolean("loggedin", true);
prefLoginEdit.putString("token", token);
prefLoginEdit.commit();
Toast.makeText(getContext(), token, Toast.LENGTH_SHORT).show();
Fragment fragment = null;
fragment = new MainMenu_test();
replaceFragment(fragment);
}
}else {
Toast.makeText(getContext(), "wrong login or password :(", Toast.LENGTH_SHORT).show();
}
When i'm trying to put in fragment = new MainMenu_test i'm getting error
Incompatible types. Found: 'com.example.myapplication.MainMenu_test', required: 'androidx.fragment.app.Fragment'
When i put instead of MainMenu_test (Empty Activity), MainMenu (Java class which i created) everything is okay.
How I can fix this error ?
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
