Start an activity from a fragment

mFragmentFavorite in your code is a FragmentActivity which is not the same thing as a Fragment. That’s why you’re getting the type mismatch. Also, you should never call new on an Activity as that is not the proper way to start one. If you want to start a new instance of mFragmentFavorite, you can do so via an Intent. From a Fragment: From an Activity If you … Read more

Default Activity not found in Android Studio

In Android Studio, right click on the project and choose Open Module Settings. Then go to the Sources tab in your module, find the src folder, right click on it and mark it as Sources (blue color). EDIT: There is no sources tab in later versions of Android Studio, but you can edit the build.gradle file instead: https://stackoverflow.com/a/22028681/1101730 (thanks for comment Josh)