After finding a very helpful developer with a Samsung Moment who was
willing to test my app on their phone and get the logcat output, I
found the following:
The cause of the application crash was a null pointer exception bug on
a data storage class when a particular activity was opened. It was
very easy to reproduce and occurred every time that activity was
opened on a Samsung Moment device. I don't fully understand why the
bug did not appear on any other devices.
Here is a extract from the activity class:
[code]
public class attView extends MmlActivity implements
SeekBar.OnSeekBarChangeListener{
...
private SeekBar severitySeekBar;
private Attack attack;
public void onCreate(Bundle savedInstanceState)
{
....
this.initControls();
//Instantiate attack object
....
}
initControls()
{
//Do lots of ui init stuff
...
this.severitySeekBar = (SeekBar) findViewById
(R.id.severitySeekBar);
this.severitySeekBar.setOnSeekBarChangeListener(this);
this.severitySeekBar.setProgress
(MmlDbAdapter.DEFAULT_ATT_SEVERITY);
}
public void onProgressChanged(SeekBar seekBar, int progress, boolean
fromTouch)
{
setSeverityText(progress);
attack.setSeverity(progress); <- This is where the exception was
occurring!
}
[/code]
As I have pointed out in the code, the exception occurs in the
onProgressChanged() method. This is because initControls has not fully
completed and the attack instantiated.
It looks like on the Samsung Moment, onProgressChanged() is being
executed before onCreate completes and on other devices (and the
simulators) it is being executed after! This really doesn't make much
sense!
Anyway, i was able to tidy up the code and remove the bug. But still,
there really should be no differences like this on various android
devices (unless they are at diffenet firmware versions, of course).
Don
Here is the logcat:
W/KeyCharacterMap( 3196): Bad keycharmap - filesize=32
D/KeyCharacterMap( 3196): load: dev='melfas_ts_input' path='/system/
usr/keychars/melfas_ts_input.kcm.bin'
W/KeyCharacterMap( 3196): Can't open keycharmap file
W/KeyCharacterMap( 3196): Error loading keycharmap file '/system/usr/
keychars/melfas_ts_input.kcm.bin'. hw.keyboards.
65536.devname='melfas_ts_input'
W/KeyCharacterMap( 3196): Using default keymap: /system/usr/keychars/
qwerty.kcm.bin
I/ActivityManager( 1859): Starting activity: Intent { comp={com.dt.mml/
com.dt.mml.attView} }
D/PhoneWindow( 3196): couldn't save which view has focus because the
focused view com.android.internal.policy.impl.PhoneWindow
$decorv...@4322d1c0 has no id.
I/MigraineDbAdapter( 3196): Closing database - AttackList
D/AndroidRuntime( 3196): Shutting down VM
W/dalvikvm( 3196): threadid=3: thread exiting with uncaught exception
(group=0x4000fe70)
E/AndroidRuntime( 3196): Uncaught handler: thread main exiting due to
uncaught exception
E/AndroidRuntime( 3196): java.lang.RuntimeException: Unable to start
activity ComponentInfo{com.dt.mml/com.dt.mml.attView}:
java.lang.NullPointerException
E/AndroidRuntime( 3196): at
android.app.ActivityThread.performLaunchActivity(ActivityThread.java:
2268)
E/AndroidRuntime( 3196): at
android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:
2284)
E/AndroidRuntime( 3196): at android.app.ActivityThread.access
$1800(ActivityThread.java:112)
E/AndroidRuntime( 3196): at android.app.ActivityThread
$H.handleMessage(ActivityThread.java:1692)
E/AndroidRuntime( 3196): at android.os.Handler.dispatchMessage
(Handler.java:99)
E/AndroidRuntime( 3196): at android.os.Looper.loop(Looper.java:
123)
E/AndroidRuntime( 3196): at android.app.ActivityThread.main
(ActivityThread.java:3948)
E/AndroidRuntime( 3196): at
java.lang.reflect.Method.invokeNative(NativeMethod)
E/AndroidRuntime( 3196): at java.lang.reflect.Method.invoke
(Method.java:521)
E/AndroidRuntime( 3196): at com.android.internal.os.ZygoteInit
$MethodAndArgsCaller.run(ZygoteInit.java:782)
E/AndroidRuntime( 3196): at
com.android.internal.os.ZygoteInit.main(ZygoteInit.java:540)
E/AndroidRuntime( 3196): at dalvik.system.NativeStart.main
(Native Method)
E/AndroidRuntime( 3196): Caused by: java.lang.NullPointerException
E/AndroidRuntime( 3196): at com.dt.mml.attView.onProgressChanged
(attView.java:596)
E/AndroidRuntime( 3196): at
android.widget.SeekBar.onProgressRefresh(SeekBar.java:89)
E/AndroidRuntime( 3196): at
android.widget.ProgressBar.doRefreshProgress(ProgressBar.java:492)
E/AndroidRuntime( 3196): at
android.widget.ProgressBar.refreshProgress(ProgressBar.java:501)
E/AndroidRuntime( 3196): at
android.widget.ProgressBar.setProgress(ProgressBar.java:550)
E/AndroidRuntime( 3196): at
android.widget.ProgressBar.setProgress(ProgressBar.java:531)
E/AndroidRuntime( 3196): at com.dt.mml.attView.initControls
(attView.java:578)
E/AndroidRuntime( 3196): at com.dt.mml.attView.onCreate
(attView.java:83)
E/AndroidRuntime( 3196): at
android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:
1123)
E/AndroidRuntime( 3196): at
android.app.ActivityThread.performLaunchActivity(ActivityThread.java:
2231)
E/AndroidRuntime( 3196): ... 11 more
I/Process ( 1859): Sending signal. PID: 3196 SIG: 3
I/dalvikvm( 3196): threadid=7: reacting to signal 3
I/dalvikvm( 3196): Wrote stack trace to '/data/anr/traces.txt'
W/PowerManagerService( 1859): Timer 0x7->0x3|0x0
W/PowerManagerService( 1859): updateLights 7->3
D/PowerManagerService( 1859): setLight bat=false m=4 v=0
W/ActivityManager( 1859): Launch timeout has expired, giving up wake
lock!
W/ActivityManager( 1859): Activity idle timeout for HistoryRecord
{43334290 {com.
dt.mml/com.dt.mml.attView}}
On Nov 17, 9:02 pm, Don <[email protected]> wrote:
> Hi Niko,
> Thanlk you for the reply. In the particular activity that is crashing,
> the following classes along with some sqlite database stuff are used:
>
> import java.text.SimpleDateFormat;
> import java.util.Calendar;
> import android.app.AlertDialog;
> import android.app.DatePickerDialog;
> import android.app.Dialog;
> import android.app.TimePickerDialog;
> import android.content.Context;
> import android.content.DialogInterface;
> import android.content.Intent;
> import android.content.res.Resources;
> import android.os.Bundle;
> import android.util.Log;
> import android.view.LayoutInflater;
> import android.view.Menu;
> import android.view.MenuItem;
> import android.view.View;
> import android.widget.AdapterView;
> import android.widget.ArrayAdapter;
> import android.widget.Button;
> import android.widget.CheckBox;
> import android.widget.DatePicker;
> import android.widget.EditText;
> import android.widget.ImageButton;
> import android.widget.LinearLayout;
> import android.widget.SeekBar;
> import android.widget.Spinner;
> import android.widget.TextView;
> import android.widget.TimePicker;
> import android.widget.Toast;
> import android.widget.AdapterView.OnItemSelectedListener;
>
> It's quite straight forward stuff I'm doing in the activity, just
> taking in time & date and other info from dialogs & widgets, and
> querying & writing to the database (which is done elsewhere in the app
> and the customer reports is working).
>
> Don
>
> On Nov 17, 8:12 pm, niko20 <[email protected]> wrote:
>
> > I do remember seeing a post yesterday where someone that was using
> > AudioRecord found out that on theMomentit only supports 8Khz sample
> > rate, and he had not correctly checked for error codes in the
> > getMinBufferSize call to AudioRecord. Are you perhaps using that API?
>
> > -niko
>
> > On Nov 17, 2:05 pm, Don <[email protected]> wrote:
>
> > > Hi All,
> > > Has anyone had any problems with their applications crashing on the
> > >SamsungMoment?
>
> > > I have a customer who is reporting that my application keeps crashing
> > > at a certain stage on theirSamsungMoment.
> > > The problem is I can't reproduce the crash on any of the following
> > > devices:
> > > - HTC Tattoo
> > > - HTC Magic
> > > - HTC Hero
> > > - Motorola Droid
>
> > > The customer's firware is at Android 1.5. I've tested my app on the
> > > simulator with 1.5 and no problems.
>
> > > At this stage I'm stumped! Without access to aSamsungMoment, I'm not
> > > sure what else to do!
>
> > > I have sold over 50 copies of my app and this is the first customer
> > > who has reported any problems, so I'm reasonably confident it's not a
> > > programming issue with my app.
>
> > > Any advice on this would be appreciated.
>
> > > Don
>
>
--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en