Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Activity Declaration in AndroidManifest.xml

Tags:

I have a runtime error on my stock quoting application. I have an app where you input your a stock (as in stock market) code and will list it with two buttons. One button to display a quote and the other to view more info from the web. The web function is fine but the app crashes when I hit the quote button.

LogCat is asking me whether I declared my activity in my AndroidManifest.xml. I am still new to Android development so this is the best of which I can analyze the problem. I am not sure where to look for these errors.

Just use 'mstf' as a stock code if you need to test a fix.

You can find my app here: https://github.com/xamroc/StockQuote/tree/bug-quote

I would also appreciate any tips on debugging tools or techniques for Android.

like image 817
Marco Lau Avatar asked Oct 01 '13 17:10

Marco Lau


People also ask

What is AndroidManifest XML?

In this article, I’ll be exploring everything you need to know about the AndroidManifest.xml file, ranging from the Manifest attributes that are present in every single Android project, through to communicating with other applications via intent filters, and even how to merge multiple Manifests inside the same Android project.

What is the difference between AndroidManifest and application in Android?

manifest is the root element of the AndroidManifest.xml file. It has package attribute that describes the package name of the activity class. application is the subelement of the manifest.

How do I declare an activity in Android?

To declare your activity, open your manifest file and add an <activity> element as a child of the <application> element. For example: <manifest ... > <application ... > <activity android:name=".ExampleActivity" /> ... </application ... > ... </manifest >

How do I declare my activity in the manifest file?

You must declare your activity in the manifest file in order for it to be accessible to the system. To declare your activity, open your manifest file and add an <activity> element as a child of the <application> element. For example:


Video Answer


1 Answers

You have two activities in your package, but have only declared one in manifest.

Declare the other Activity class:

Add this to your manifest:

<activity      android:name="com.example.stockquote.StockInfoActivity"      android:label="@string/app_name" /> 
like image 77
Manishika Avatar answered Sep 18 '22 15:09

Manishika