Confused by "Sorry! The application ____ (process ___ ) has stopped unexpectedly..." message

by illiniwatcher » Mon, 03 Nov 2008 05:39:36 GMT


Sponsored Links
 i, folks:

I am really confused about Android at this point. I'm writing a very
simple application called "Counter" (a starting point) that uses a
drawabl PNG image and no matter what I do, when I run it in the
emulator, I get this annoying message:

"Sorry! The application Counter (process mine.counter) has
stopped unexpectedly. Please try again. [Force close buttton]"

All I want my application to do is to display a Drawable called
"n0.png" which I have defined to my "rsc\drawable" folder.

I've looked at other sample applications, including the ones in the
SDK and tried emulating the coding, without success. I'm very
confused about how the Java, XML, and other files interact. I just
don't see why the program is freezing when I've practically followed
the structure of other applications to the letter.

Below, I've replicated the code. Thanks for any help you can provide.

Charles

***************

FILE STRUCTURE

Counter
res
drawable
n0.png
layout
bkcounter.xml
main.xml
values
colors.xml
strings.xml
src
mine
counter
Counter.java
CounterView.java
R.java


In BKCOUNTER.XML:

<?xml version="1.0" encoding="UTF-8"?>

<!-- Demonstrates using a relative layout to create a form -->
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/
android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:padding="10px"
android:background="@color/blueback">

<!-- My connection to the view; THIS TIES IN ANDROID CLASSES (!) -->
<!-- "id" value will show up when using auto-complete -->

<mine.counter.CounterView
android:id="@+id/cview"
android:layout_width="fill_parent"
android:layout_height="fill_parent" />

<ImageView android:id="@+id/firstdigit"
android:layout_height="fill_parent"
android:layout_width="fill_parent"></ImageView>

</FrameLayout>


In MAIN.XML:

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/
android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
>
<TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="@string/hello"
/>
</LinearLayout>


In COLORS.XML:

<?xml version="1.0" encoding="UTF-8"?>
<resources>
<color name="blueback">#0071BC</color>
</resources>


In STRINGS.XML:

<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="hello">Hello World, Counter</string>
<string name="app_name">Counter</string>
</resources>


In COUNTER.JAVA:

package mine.counter;

import android.app.Activity;
import android.content.DialogInterface;
import android.content.DialogInterface.OnClickListener;
import android.os.Bun



Other Threads

1. App not visible in market for some users

I have an live wallpaper app in the market and I get about one email a
day from people saying they cannot find it in the market even if they
use the QR code. Copy protection is off and build target is 2.2,
supports screen and minSdkVersion included in manifest in order to get
full compatibility.

Any help on this matter would be appreciated :)
More info below to save time...


manifest.xml:
supports-screens
  android:largeScreens="true"
  android:normalScreens="true"
  android:smallScreens="true"
  android:anyDensity="false"

uses-sdk android:minSdkVersion="7"
uses-feature android:name="android.software.live_wallpaper"
uses-permission android:name="com.android.vending.CHECK_LICENSE"
uses-permission android:name="android.permission.BATTERY_STATS"



$aapt dump bading

package: name='com.stealthcopter.nexusrevampedpro' versionCode='30'
versionName='1.1.14'
application: label='Nexus Revamped Pro' icon='res/drawable/
nexus_thumb.png'
sdkVersion:'7'
uses-feature:'android.software.live_wallpaper'
uses-permission:'com.android.vending.CHECK_LICENSE'
uses-permission:'android.permission.BATTERY_STATS'
wallpaper
other-activities
supports-screens: 'small' 'normal' 'large'
locales: '--_--'
densities: '160'

-- 

2. display menu all the time

I was wondering, is there a way to display a menu all the time instead of
when the menu button is pressed.

The reason being is a I have an activity that has a list view, but I want to
display a "New" button so that the user can add to the list.  I don't know
where to put the button, and I would rather not hide the new button in the
normal menu.  I was hoping I could display something like the menu all the
time.

The other option is to add a new item selection to the list.  However I am
using a simple cursor adapter to fill the list and I'm not sure how to add
to this list after its populated from the cursor.

Thanks

-- 

3. Sysinfo CPU load in DDMS not working with 2.2 devices?

4. How to adjust screen bright immediately in service not activity?

5. Acquiring Location Message on websites, requesting location.

6. Problem with test response from license check

7. get "black screen" when call unlockCanvasAndPost