I have built a navigation drawer. Once the app launches I direct the user from "MainActivity" to MainMenuActivity through an intent through the following code inside "MainActivity":
Intent Activity = new Intent(MainActivity.this, MainMenuActivity.class);
startActivity(Activity);
but when the app launches, it crashes directly with a logcat of:
Caused by: android.content.ActivityNotFoundException: Unable to find explicit activity class {package.allineed/Package.MainMenuActivity}; have you declared this activity in your AndroidManifest.xml?
I declared MainMenuActivity inside AndroidManifest.xml by adding to the application the following code:
<activity android:name=".MainMenuActivity"></activity>
but the app crashed and gave me the following logcat:
java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{..allineed/...allineed.MainMenuActivity}: java.lang.ClassCastException: ...allineed.MainMenuActivity cannot be cast to android.app.Activity
This is is MainMenuActivity:
public class MainMenuActivity extends Fragment{
View myView;
@Nullable
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
myView=inflater.inflate(R.layout.activity_main_menu,container,false);
return myView;
}
}
I consumed a lot of time on it, ho possibly could it be solved?