I have MainActivity
and trying to extend this activity to create About Us
page for users. I have text
About Us on menu when clicked to open the extended activity.
Here is the XML for About Us page:
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
xmlns:ads="http://schemas.android.com/apk/res-auto"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<ScrollView
android:id="@+id/scrollView1"
android:layout_width="match_parent"
android:layout_height="match_parent" >
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_alignParentTop="true"
android:layout_centerHorizontal="true"
android:gravity="center_horizontal"
android:orientation="vertical" >
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Maihan Nijat is making app."
android:id="@+id/textView" />
</LinearLayout>
</ScrollView>
</RelativeLayout>
And the extended About Us Activity
public class AboutUs extends ActivityMain {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.full_about);
}
}
And this is how I linked:
else if (id == R.id.nav_about) {
Intent i = new Intent(getApplicationContext(), AboutUs.class);
startActivity(i);
}
I have imported all the required importings.
When I run the app and click on the About Us
it says "unfortunately the app has stopped'
Log Cat:
Process: com.revittechnology.pashtodictionary, PID: 25122
android.content.ActivityNotFoundException: Unable to find explicit
activity class
{com.revittechnology.pashtodictionary/com.revittechnology.pashtodictionary.AboutUs};
have you declared this activity in your AndroidManifest.xml?
at
android.app.Instrumentation.checkStartActivityResult(Instrumentation.java:1794)
at
android.app.Instrumentation.execStartActivity(Instrumentation.java:1512)
at android.app.Activity.startActivityForResult(Activity.java:3917)
at android.app.Activity.startActivityForResult(Activity.java:3877)
at
android.support.v4.app.FragmentActivity.startActivityForResult(FragmentActivity.java:784)
at android.app.Activity.startActivity(Activity.java:4200)
at android.app.Activity.startActivity(Activity.java:4168)
at
com.revittechnology.pashtodictionary.ActivityMain.onNavigationSelected(ActivityMain.java:148)
at
com.revittechnology.pashtodictionary.ActivityMain$2.onNavigationItemSelected(ActivityMain.java:94)
at
android.support.design.widget.NavigationView$1.onMenuItemSelected(NavigationView.java:150)
at
android.support.v7.view.menu.MenuBuilder.dispatchMenuItemSelected(MenuBuilder.java:811)
at
android.support.v7.view.menu.MenuItemImpl.invoke(MenuItemImpl.java:152)
at
android.support.v7.view.menu.MenuBuilder.performItemAction(MenuBuilder.java:958)
at
android.support.design.internal.NavigationMenuPresenter$1.onClick(NavigationMenuPresenter.java:308)
at android.view.View.performClick(View.java:5198)
at android.view.View$PerformClick.run(View.java:21147)
at android.os.Handler.handleCallback(Handler.java:739)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:148)
at android.app.ActivityThread.main(ActivityThread.java:5417)
at java.lang.reflect.Method.invoke(Native Method)
at
com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)