this is my first question, but this forum helped me a lot in the last 2 months!!!
I tried to make an "Gallery" on my Android app, i solved it for 1 Gallery, but after i tried to make more "Galleries", i got an error in my "OnCreate".
This is my onCreate:
public void onCreate(Bundle savedInstanceState) {
//try {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_create_combination);
Gallery h = (Gallery) findViewById(R.id.gallery_head);
h.setAdapter(new ImageAdapter_head(this));
h.setOnItemClickListener(new OnItemClickListener() {
public void onItemClick(AdapterView parent, View v, int position, long id) {
Toast.makeText(Create_combination.this, "" + position,
Toast.LENGTH_SHORT).show();
}
});
i make this for 3 times (for 3 Galleries)
My class "ImageAdapter:head":
public class ImageAdapter_head extends BaseAdapter {
int mGalleryItemBackground;
private Context hContext;
private Integer[] mImageIds_head = { R.drawable.layout, R.drawable.ic_launcher,
R.drawable.test2, R.drawable.layout, R.drawable.layout,
R.drawable.layout, R.drawable.layout };
public ImageAdapter_head(Create_combination create_combination) {
// TODO Auto-generated constructor stub
}
public void ImageAdapter(Context h) {
hContext = h;
TypedArray a = obtainStyledAttributes(R.styleable.Gallery1);
mGalleryItemBackground = a.getResourceId(
R.styleable.Gallery1_android_galleryItemBackground , 0);
a.recycle();
}
public int getCount() {
return mImageIds_head.length;
//return mImageIds_upper.length;
//return mImageIds_lower.length;
}
public Object getItem(int position) {
return position;
}
public long getItemId(int position) {
return position;
}
ImageView h = new ImageView(hContext);
#SuppressWarnings("deprecation")
public View getView(int position, View convertView, ViewGroup parent) {
h.setImageResource(mImageIds_head[position]);
h.setLayoutParams(new Gallery.LayoutParams(150, 100));
h.setScaleType(ImageView.ScaleType.FIT_XY);
h.setBackgroundResource(mGalleryItemBackground);
return (h);
}
}
And here are my Errors:
Thread [<1> main] (Suspended (exception RuntimeException))
<VM does not provide monitor information>
ActivityThread.performLaunchActivity(ActivityThread$ActivityClientRecord, Intent) line: 1956
ActivityThread.handleLaunchActivity(ActivityThread$ActivityClientRecord, Intent) line: 1981
ActivityThread.access$600(ActivityThread, ActivityThread$ActivityClientRecord, Intent) line: 123
ActivityThread$H.handleMessage(Message) line: 1147
ActivityThread$H(Handler).dispatchMessage(Message) line: 99
Looper.loop() line: 137
ActivityThread.main(String[]) line: 4424
Method.invokeNative(Object, Object[], Class, Class[], Class, int, boolean) line: not available [native method]
Method.invoke(Object, Object...) line: 511
ZygoteInit$MethodAndArgsCaller.run() line: 784
ZygoteInit.main(String[]) line: 551
NativeStart.main(String[]) line: not available [native method]
Thread [<10> Binder Thread #2] (Running)
Thread [<9> Binder Thread #1] (Running)
Daemon Thread [<8> FinalizerWatchdogDaemon] (Running)
Daemon Thread [<7> FinalizerDaemon] (Running)
Daemon Thread [<6> ReferenceQueueDaemon] (Running)
Thread [<11> AsyncTask #1] (Running)
logcat:
11-18 18:24:07.371: I/ActivityManager(159): START {cmp=in.dressin/com.example.hellogallery.Create_combination} from pid 1890
11-18 18:24:07.511: D/dalvikvm(159): GC_CONCURRENT freed 552K, 20% free 9123K/11335K, paused 3ms+7ms
11-18 18:24:07.901: I/Process(159): Sending signal. PID: 1890 SIG: 3
11-18 18:24:07.901: I/dalvikvm(1890): threadid=3: reacting to signal 3
11-18 18:24:07.911: D/dalvikvm(1890): threadid=1: still suspended after undo (sc=1 dc=1)
11-18 18:24:07.911: I/dalvikvm(1890): Wrote stack traces to '/data/anr/traces.txt'
11-18 18:24:08.401: I/Process(159): Sending signal. PID: 1890 SIG: 3
11-18 18:24:08.401: I/dalvikvm(1890): threadid=3: reacting to signal 3
11-18 18:24:08.411: D/dalvikvm(1890): threadid=1: still suspended after undo (sc=1 dc=1)
11-18 18:24:08.411: I/dalvikvm(1890): Wrote stack traces to '/data/anr/traces.txt'
11-18 18:24:08.901: I/Process(159): Sending signal. PID: 1890 SIG: 3
11-18 18:24:08.901: I/dalvikvm(1890): threadid=3: reacting to signal 3
11-18 18:24:08.911: D/dalvikvm(1890): threadid=1: still suspended after undo (sc=1 dc=1)
11-18 18:24:08.911: I/dalvikvm(1890): Wrote stack traces to '/data/anr/traces.txt'
11-18 18:24:09.401: I/Process(159): Sending signal. PID: 1890 SIG: 3
11-18 18:24:09.401: I/dalvikvm(1890): threadid=3: reacting to signal 3
11-18 18:24:09.411: D/dalvikvm(1890): threadid=1: still suspended after undo (sc=1 dc=1)
11-18 18:24:09.411: I/dalvikvm(1890): Wrote stack traces to '/data/anr/traces.txt'
11-18 18:24:09.911: I/Process(159): Sending signal. PID: 1890 SIG: 3
11-18 18:24:09.911: I/dalvikvm(1890): threadid=3: reacting to signal 3
11-18 18:24:09.911: D/dalvikvm(1890): threadid=1: still suspended after undo (sc=1 dc=1)
11-18 18:24:09.911: I/dalvikvm(1890): Wrote stack traces to '/data/anr/traces.txt'
11-18 18:24:10.411: I/Process(159): Sending signal. PID: 1890 SIG: 3
11-18 18:24:10.411: I/dalvikvm(1890): threadid=3: reacting to signal 3
11-18 18:24:10.411: D/dalvikvm(1890): threadid=1: still suspended after undo (sc=1 dc=1)
11-18 18:24:10.411: I/dalvikvm(1890): Wrote stack traces to '/data/anr/traces.txt'
11-18 18:24:10.901: I/Process(159): Sending signal. PID: 1890 SIG: 3
11-18 18:24:10.901: I/dalvikvm(1890): threadid=3: reacting to signal 3
11-18 18:24:10.911: D/dalvikvm(1890): threadid=1: still suspended after undo (sc=1 dc=1)
11-18 18:24:10.911: I/dalvikvm(1890): Wrote stack traces to '/data/anr/traces.txt'
11-18 18:24:11.401: I/Process(159): Sending signal. PID: 1890 SIG: 3
11-18 18:24:11.401: I/dalvikvm(1890): threadid=3: reacting to signal 3
11-18 18:24:11.411: D/dalvikvm(1890): threadid=1: still suspended after undo (sc=1 dc=1)
11-18 18:24:11.411: I/dalvikvm(1890): Wrote stack traces to '/data/anr/traces.txt'
11-18 18:24:11.901: I/Process(159): Sending signal. PID: 1890 SIG: 3
11-18 18:24:11.901: I/dalvikvm(1890): threadid=3: reacting to signal 3
11-18 18:24:11.911: D/dalvikvm(1890): threadid=1: still suspended after undo (sc=1 dc=1)
11-18 18:24:11.911: I/dalvikvm(1890): Wrote stack traces to '/data/anr/traces.txt'
11-18 18:24:12.431: I/Process(159): Sending signal. PID: 1890 SIG: 3
11-18 18:24:12.431: I/dalvikvm(1890): threadid=3: reacting to signal 3
11-18 18:24:12.441: D/dalvikvm(1890): threadid=1: still suspended after undo (sc=1 dc=1)
11-18 18:24:12.441: I/dalvikvm(1890): Wrote stack traces to '/data/anr/traces.txt'
11-18 18:24:12.911: I/Process(159): Sending signal. PID: 1890 SIG: 3
11-18 18:24:12.911: I/dalvikvm(1890): threadid=3: reacting to signal 3
11-18 18:24:12.911: D/dalvikvm(1890): threadid=1: still suspended after undo (sc=1 dc=1)
11-18 18:24:12.911: I/dalvikvm(1890): Wrote stack traces to '/data/anr/traces.txt'
11-18 18:24:13.401: I/Process(159): Sending signal. PID: 1890 SIG: 3
11-18 18:24:13.401: I/dalvikvm(1890): threadid=3: reacting to signal 3
11-18 18:24:13.411: D/dalvikvm(1890): threadid=1: still suspended after undo (sc=1 dc=1)
11-18 18:24:13.411: I/dalvikvm(1890): Wrote stack traces to '/data/anr/traces.txt'
11-18 18:24:13.901: I/Process(159): Sending signal. PID: 1890 SIG: 3
11-18 18:24:13.901: I/dalvikvm(1890): threadid=3: reacting to signal 3
11-18 18:24:13.911: D/dalvikvm(1890): threadid=1: still suspended after undo (sc=1 dc=1)
11-18 18:24:13.911: I/dalvikvm(1890): Wrote stack traces to '/data/anr/traces.txt'
11-18 18:24:14.401: I/Process(159): Sending signal. PID: 1890 SIG: 3
11-18 18:24:14.401: I/dalvikvm(1890): threadid=3: reacting to signal 3
11-18 18:24:14.411: D/dalvikvm(1890): threadid=1: still suspended after undo (sc=1 dc=1)
11-18 18:24:14.411: I/dalvikvm(1890): Wrote stack traces to '/data/anr/traces.txt'
11-18 18:24:14.901: I/Process(159): Sending signal. PID: 1890 SIG: 3
11-18 18:24:14.901: I/dalvikvm(1890): threadid=3: reacting to signal 3
11-18 18:24:14.911: D/dalvikvm(1890): threadid=1: still suspended after undo (sc=1 dc=1)
11-18 18:24:14.911: I/dalvikvm(1890): Wrote stack traces to '/data/anr/traces.txt'
11-18 18:24:15.401: I/Process(159): Sending signal. PID: 1890 SIG: 3
11-18 18:24:15.401: I/dalvikvm(1890): threadid=3: reacting to signal 3
11-18 18:24:15.411: D/dalvikvm(1890): threadid=1: still suspended after undo (sc=1 dc=1)
11-18 18:24:15.411: I/dalvikvm(1890): Wrote stack traces to '/data/anr/traces.txt'
11-18 18:24:15.911: I/Process(159): Sending signal. PID: 1890 SIG: 3
11-18 18:24:15.911: I/dalvikvm(1890): threadid=3: reacting to signal 3
11-18 18:24:15.911: D/dalvikvm(1890): threadid=1: still suspended after undo (sc=1 dc=1)
11-18 18:24:15.911: I/dalvikvm(1890): Wrote stack traces to '/data/anr/traces.txt'
11-18 18:24:16.411: I/Process(159): Sending signal. PID: 1890 SIG: 3
11-18 18:24:16.411: I/dalvikvm(1890): threadid=3: reacting to signal 3
11-18 18:24:16.411: D/dalvikvm(1890): threadid=1: still suspended after undo (sc=1 dc=1)
11-18 18:24:16.411: I/dalvikvm(1890): Wrote stack traces to '/data/anr/traces.txt'
11-18 18:24:16.901: I/Process(159): Sending signal. PID: 1890 SIG: 3
11-18 18:24:16.901: I/dalvikvm(1890): threadid=3: reacting to signal 3
11-18 18:24:16.911: D/dalvikvm(1890): threadid=1: still suspended after undo (sc=1 dc=1)
11-18 18:24:16.911: I/dalvikvm(1890): Wrote stack traces to '/data/anr/traces.txt'
11-18 18:24:17.401: I/Process(159): Sending signal. PID: 1890 SIG: 3
11-18 18:24:17.401: I/dalvikvm(1890): threadid=3: reacting to signal 3
11-18 18:24:17.401: W/ActivityManager(159): Launch timeout has expired, giving up wake lock!
11-18 18:24:17.411: D/dalvikvm(1890): threadid=1: still suspended after undo (sc=1 dc=1)
11-18 18:24:17.421: I/dalvikvm(1890): Wrote stack traces to '/data/anr/traces.txt'
11-18 18:24:17.421: W/ActivityManager(159): Activity idle timeout for ActivityRecord{411fec30 in.dressin/com.example.hellogallery.Create_combination}
11-18 18:24:20.261: I/WindowManager(159): MediaPlayer.is not PlayingVideo
11-18 18:24:22.971: I/WindowManager(159): MediaPlayer.is not PlayingVideo
11-18 18:24:28.741: I/InputDispatcher(159): Application is not responding: AppWindowToken{412958e0 token=Token{413a5178 ActivityRecord{411fec30 in.dressin/com.example.hellogallery.Create_combination}}}. 5001.1ms since event, 5000.8ms since wait started
11-18 18:24:28.741: I/WindowManager(159): Input event dispatching timed out sending to application AppWindowToken{412958e0 token=Token{413a5178 ActivityRecord{411fec30 in.dressin/com.example.hellogallery.Create_combination}}}
11-18 18:24:33.741: I/InputDispatcher(159): Dropped event because it is stale.
Please help me :)
greetings, felix!
Related
I have created a test scene in Unity which has only one cube and a directional lightening. When installed in AVD just the name of app is display and shows up nothing...
I could not figure out what is the error.. or what is making my application to stop running
AVD setting that is used are
Target: 4.0.3 API Level 15
Skin: HVGA
RAM: 512 VM: 32
Internal Storage: 200MB
SDCARD:2GB
I/AndroidRuntime( 474): NOTE: attach of thread 'Binder Thread #3' failed
D/AndroidRuntime( 549):
D/AndroidRuntime( 549): >>>>>> AndroidRuntime START com.android.internal.os.RuntimeInit <<<<<
D/AndroidRuntime( 549): CheckJNI is ON
D/AndroidRuntime( 549): Calling main entry com.android.commands.am.Am
I/ActivityManager( 77): START {act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] flg=0x10200000 cmp=com.asdasd.cd/com.unity3d.player.UnityPlayerNativeActivity} from pid 549
D/PermissionCache( 36): checking android.permission.READ_FRAME_BUFFER for uid=1000 => granted (22624 us)
W/WindowManager( 77): Failure taking screenshot for (130x195) to layer 21005
D/AndroidRuntime( 549): Shutting down VM
D/dalvikvm( 549): GC_CONCURRENT freed 99K, 77% free 480K/2048K, paused 0ms+1ms
I/AndroidRuntime( 549): NOTE: attach of thread 'Binder Thread #3' failed
I/ActivityManager( 77): Start proc com.asdasd.cd for activity com.asdasd.cd/com.unity3d.player.UnityPlayerNativeActivity: pid=559 uid=10041 gids={}
W/NetworkManagementSocketTagger( 77): setKernelCountSet(10041, 1) failed with errno -2
I/dalvikvm( 77): Jit: resizing JitTable from 4096 to 8192
I/ARMAssembler( 36): generated scanline__00000077:03515104_00009002_00000000 [127 ipp] (149 ins) at [0x413fba80:0x413fbcd4] in 869530 ns
I/Process ( 77): Sending signal. PID: 559 SIG: 3
I/dalvikvm( 559): threadid=3: reacting to signal 3
I/dalvikvm( 559): Wrote stack traces to '/data/anr/traces.txt'
D/dalvikvm( 559): Trying to load lib /mnt/asec/com.asdasd.cd-2/lib/libmain.so 0x41023f78
D/dalvikvm( 559): Added shared lib /mnt/asec/com.asdasd.cd-2/lib/libmain.so 0x41023f78
I/Process ( 77): Sending signal. PID: 559 SIG: 3
I/dalvikvm( 559): threadid=3: reacting to signal 3
I/dalvikvm( 559): Wrote stack traces to '/data/anr/traces.txt'
I/Process ( 77): Sending signal. PID: 559 SIG: 3
I/dalvikvm( 559): threadid=3: reacting to signal 3
I/dalvikvm( 559): Wrote stack traces to '/data/anr/traces.txt'
I/Process ( 77): Sending signal. PID: 559 SIG: 3
I/dalvikvm( 559): threadid=3: reacting to signal 3
I/dalvikvm( 559): Wrote stack traces to '/data/anr/traces.txt'
I/Process ( 77): Sending signal. PID: 559 SIG: 3
I/dalvikvm( 559): threadid=3: reacting to signal 3
I/dalvikvm( 559): Wrote stack traces to '/data/anr/traces.txt'
I/Process ( 77): Sending signal. PID: 559 SIG: 3
I/dalvikvm( 559): threadid=3: reacting to signal 3
I/dalvikvm( 559): Wrote stack traces to '/data/anr/traces.txt'
I/Process ( 77): Sending signal. PID: 559 SIG: 3
I/dalvikvm( 559): threadid=3: reacting to signal 3
I/dalvikvm( 559): Wrote stack traces to '/data/anr/traces.txt'
I/Process ( 77): Sending signal. PID: 559 SIG: 3
I/dalvikvm( 559): threadid=3: reacting to signal 3
I/dalvikvm( 559): Wrote stack traces to '/data/anr/traces.txt'
I/Process ( 77): Sending signal. PID: 559 SIG: 3
I/dalvikvm( 559): threadid=3: reacting to signal 3
I/dalvikvm( 559): Wrote stack traces to '/data/anr/traces.txt'
I/Process ( 77): Sending signal. PID: 559 SIG: 3
I/dalvikvm( 559): threadid=3: reacting to signal 3
I/dalvikvm( 559): Wrote stack traces to '/data/anr/traces.txt'
I/Process ( 77): Sending signal. PID: 559 SIG: 3
I/dalvikvm( 559): threadid=3: reacting to signal 3
I/dalvikvm( 559): Wrote stack traces to '/data/anr/traces.txt'
I/Process ( 77): Sending signal. PID: 559 SIG: 3
I/dalvikvm( 559): threadid=3: reacting to signal 3
I/dalvikvm( 559): Wrote stack traces to '/data/anr/traces.txt'
I/Process ( 77): Sending signal. PID: 559 SIG: 3
I/dalvikvm( 559): threadid=3: reacting to signal 3
I/dalvikvm( 559): Wrote stack traces to '/data/anr/traces.txt'
I/Process ( 77): Sending signal. PID: 559 SIG: 3
I/dalvikvm( 559): threadid=3: reacting to signal 3
I/dalvikvm( 559): Wrote stack traces to '/data/anr/traces.txt'
I/Process ( 77): Sending signal. PID: 559 SIG: 3
I/dalvikvm( 559): threadid=3: reacting to signal 3
I/dalvikvm( 559): Wrote stack traces to '/data/anr/traces.txt'
I/Process ( 77): Sending signal. PID: 559 SIG: 3
I/dalvikvm( 559): threadid=3: reacting to signal 3
I/dalvikvm( 559): Wrote stack traces to '/data/anr/traces.txt'
I/Process ( 77): Sending signal. PID: 559 SIG: 3
I/dalvikvm( 559): threadid=3: reacting to signal 3
I/dalvikvm( 559): Wrote stack traces to '/data/anr/traces.txt'
I/Process ( 77): Sending signal. PID: 559 SIG: 3
I/dalvikvm( 559): threadid=3: reacting to signal 3
I/dalvikvm( 559): Wrote stack traces to '/data/anr/traces.txt'
I/Process ( 77): Sending signal. PID: 559 SIG: 3
I/dalvikvm( 559): threadid=3: reacting to signal 3
I/dalvikvm( 559): Wrote stack traces to '/data/anr/traces.txt'
W/ActivityManager( 77): Launch timeout has expired, giving up wake lock!
W/ActivityManager( 77): Activity idle timeout for ActivityRecord{411e1ab0 com.asdasd.cd/com.unity3d.player.UnityPlayerNativeActivity}
D/dalvikvm( 77): GC_CONCURRENT freed 294K, 11% free 8687K/9671K, paused 5ms+7ms
D/dalvikvm( 160): GC_CONCURRENT freed 436K, 8% free 6992K/7559K, paused 4ms+4ms
On Installing on Android the app so similar behavior and generates same similar log
I/ActivityManager( 289): START {act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] flg=0x10200000 cmp=com.asdasd.cd/com.unity3d.player.UnityPlayerNativeActivity bnds=[12,433][125,592]} from pid 546
I/ActivityManager( 289): Start proc com.asdasd.cd for activity com.asdasd.cd/com.unity3d.player.UnityPlayerNativeActivity: pid=4268 uid=10130 gids={}
W/ResourceType( 289): Skipping entry 0x7f040010 in package table 0 because it is not complex!
W/ResourceType( 289): Skipping entry 0x7f04003d in package table 0 because it is not complex!
D/dalvikvm( 4268): Trying to load lib /mnt/asec/com.asdasd.cd-1/lib/libmain.so 0x2bde3080
D/dalvikvm( 4268): Added shared lib /mnt/asec/com.asdasd.cd-1/lib/libmain.so 0x2bde3080
D/SurfaceFlinger( 136): Release buffer at 0xcddd0
W/ActivityManager( 289): Launch timeout has expired, giving up wake lock!
W/ActivityManager( 289): Activity idle timeout for ActivityRecord{2c57c1e8 com.asdasd.cd/com.unity3d.player.UnityPlayerNativeActivity}
For gaming better to use genymotion dont use AVD that doesn't support EGL rendering and in android 4.4 use dalvik instead of ART ...
Hope you get my point.
Finally my app is working..!:D Problem is solved by updating and applying latest patch unity 4.6.6p1.. which removes the bug from older version .Hope this will help someone having a similar problem
I am learning to develop Android applications and have come across a problem with my app. I have created an app that will allow user to type some text and when a button is pressed, a function is called that performs parsing the input string to double and then displays it. I have received no errors, but whenever I run the app on any emulator, it says "Unfortunately, myapp has stopped".
Here is the LogCat:
04-04 14:34:11.579: I/dalvikvm(657): Wrote stack traces to '/data/anr/traces.txt'
04-04 14:34:11.969: I/dalvikvm(657): threadid=3: reacting to signal 3
04-04 14:34:12.089: I/dalvikvm(657): Wrote stack traces to '/data/anr/traces.txt'
04-04 14:34:12.720: I/dalvikvm(657): threadid=3: reacting to signal 3
04-04 14:34:12.860: I/dalvikvm(657): Wrote stack traces to '/data/anr/traces.txt'
04-04 14:34:12.979: I/dalvikvm(657): threadid=3: reacting to signal 3
04-04 14:34:13.069: I/dalvikvm(657): Wrote stack traces to '/data/anr/traces.txt'
04-04 14:34:13.479: I/dalvikvm(657): threadid=3: reacting to signal 3
04-04 14:34:13.599: I/dalvikvm(657): Wrote stack traces to '/data/anr/traces.txt'
04-04 14:34:14.009: I/dalvikvm(657): threadid=3: reacting to signal 3
04-04 14:34:14.129: I/dalvikvm(657): Wrote stack traces to '/data/anr/traces.txt'
04-04 14:34:14.320: D/libEGL(657): loaded /system/lib/egl/libGLES_android.so
04-04 14:34:14.390: D/libEGL(657): loaded /system/lib/egl/libEGL_emulation.so
04-04 14:34:14.409: D/(657): HostConnection::get() New Host Connection established 0xd7820, tid 657
04-04 14:34:14.429: D/libEGL(657): loaded /system/lib/egl/libGLESv1_CM_emulation.so
04-04 14:34:14.449: D/libEGL(657): loaded /system/lib/egl/libGLESv2_emulation.so
04-04 14:34:14.519: I/dalvikvm(657): threadid=3: reacting to signal 3
04-04 14:34:14.579: I/dalvikvm(657): Wrote stack traces to '/data/anr/traces.txt'
04-04 14:34:14.719: W/EGL_emulation(657): eglSurfaceAttrib not implemented
04-04 14:34:14.769: D/OpenGLRenderer(657): Enabling debug mode 0
04-04 14:34:15.049: I/dalvikvm(657): threadid=3: reacting to signal 3
04-04 14:34:15.173: I/dalvikvm(657): Wrote stack traces to '/data/anr/traces.txt'
04-04 14:34:15.579: I/dalvikvm(657): threadid=3: reacting to signal 3
04-04 14:34:15.790: I/dalvikvm(657): Wrote stack traces to '/data/anr/traces.txt'
04-04 14:34:16.030: I/dalvikvm(657): threadid=3: reacting to signal 3
04-04 14:34:16.109: I/dalvikvm(657): Wrote stack traces to '/data/anr/traces.txt'
04-04 14:34:16.549: I/dalvikvm(657): threadid=3: reacting to signal 3
04-04 14:34:16.739: I/dalvikvm(657): Wrote stack traces to '/data/anr/traces.txt'
04-04 14:34:17.029: I/dalvikvm(657): threadid=3: reacting to signal 3
04-04 14:34:17.220: I/dalvikvm(657): Wrote stack traces to '/data/anr/traces.txt'
04-04 14:34:27.099: D/AndroidRuntime(657): Shutting down VM
04-04 14:34:27.099: W/dalvikvm(657): threadid=1: thread exiting with uncaught exception (group=0x409c01f8)
04-04 14:34:27.219: E/AndroidRuntime(657): FATAL EXCEPTION: main
04-04 14:34:27.219: E/AndroidRuntime(657): java.lang.IllegalStateException: Could not execute method of the activity
04-04 14:34:27.219: E/AndroidRuntime(657): at android.view.View$1.onClick(View.java:3044)
04-04 14:34:27.219: E/AndroidRuntime(657): at android.view.View.performClick(View.java:3511)
04-04 14:34:27.219: E/AndroidRuntime(657): at android.view.View$PerformClick.run(View.java:14105)
04-04 14:34:27.219: E/AndroidRuntime(657): at android.os.Handler.handleCallback(Handler.java:605)
04-04 14:34:27.219: E/AndroidRuntime(657): at android.os.Handler.dispatchMessage(Handler.java:92)
04-04 14:34:27.219: E/AndroidRuntime(657): at android.os.Looper.loop(Looper.java:137)
04-04 14:34:27.219: E/AndroidRuntime(657): at android.app.ActivityThread.main(ActivityThread.java:4424)
04-04 14:34:27.219: E/AndroidRuntime(657): at java.lang.reflect.Method.invokeNative(Native Method)
04-04 14:34:27.219: E/AndroidRuntime(657): at java.lang.reflect.Method.invoke(Method.java:511)
04-04 14:34:27.219: E/AndroidRuntime(657): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:784)
04-04 14:34:27.219: E/AndroidRuntime(657): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:551)
04-04 14:34:27.219: E/AndroidRuntime(657): at dalvik.system.NativeStart.main(Native Method)
04-04 14:34:27.219: E/AndroidRuntime(657): Caused by: java.lang.reflect.InvocationTargetException
04-04 14:34:27.219: E/AndroidRuntime(657): at java.lang.reflect.Method.invokeNative(Native Method)
04-04 14:34:27.219: E/AndroidRuntime(657): at java.lang.reflect.Method.invoke(Method.java:511)
04-04 14:34:27.219: E/AndroidRuntime(657): at android.view.View$1.onClick(View.java:3039)
04-04 14:34:27.219: E/AndroidRuntime(657): ... 11 more
04-04 14:34:27.219: E/AndroidRuntime(657): Caused by: java.lang.NumberFormatException: Invalid double: "android.widget.EditText#40f7be40"
04-04 14:34:27.219: E/AndroidRuntime(657): at java.lang.StringToReal.invalidReal(StringToReal.java:63)
04-04 14:34:27.219: E/AndroidRuntime(657): at java.lang.StringToReal.initialParse(StringToReal.java:114)
04-04 14:34:27.219: E/AndroidRuntime(657): at java.lang.StringToReal.parseDouble(StringToReal.java:263)
04-04 14:34:27.219: E/AndroidRuntime(657): at java.lang.Double.parseDouble(Double.java:295)
04-04 14:34:27.219: E/AndroidRuntime(657): at com.example.coinage.MainActivity.convert(MainActivity.java:25)
04-04 14:34:27.219: E/AndroidRuntime(657): ... 14 more
04-04 14:34:28.069: I/dalvikvm(657): threadid=3: reacting to signal 3
04-04 14:34:28.179: I/dalvikvm(657): Wrote stack traces to '/data/anr/traces.txt'
04-04 14:34:29.729: I/Process(657): Sending signal. PID: 657 SIG: 9
Method that performs Computation
public void convert(View view){
int countOf2Po = 0, countOf1Po = 0, countOf50p = 0, countOf20p = 0, countOf2p = 0, countOf1p = 0;
EditText amt = (EditText) findViewById (R.id.amount);
TextView penny = (TextView) findViewById (R.id.penny);
double amount = Double.parseDouble(amt.toString()) * 100;
while(amount >= 200){
amount = amount - 200;
countOf2Po++;
}
while(amount >= 100){
amount = amount - 100;
countOf1Po++;
}
while(amount >= 50){
amount = amount - 50;
countOf50p++;
}
while(amount >= 20){
amount = amount - 20;
countOf20p++;
}
while(amount >= 2){
amount = amount - 2;
countOf2p++;
}
if(amount % 2 != 0){
countOf1p++;
}
penny.setText("Converting " + penny + " into coins.");
penny.setVisibility(View.VISIBLE);
}
You're trying to cast the toString() value of the EditText to a double, which is not the text entered into the EditText like you expected, but the name the name of the class concatenated with the instance's hash code:
The toString method for class Object returns a string consisting of
the name of the class of which the object is an instance, the at-sign
character `#', and the unsigned hexadecimal representation of the hash
code of the object. In other words, this method returns a string equal
to the value of:
getClass().getName() + '#' + Integer.toHexString(hashCode())
What you want to do, is to retrieve the entered text using getText(), and convert that to a String:
double amount = Double.parseDouble(amt.getText().toString()) * 100;
Note that this may lead to a NumberFormatException if the input is not a proper double.
I imported this rajawali tutorial into an working example of a stereoscopic renderer. The class where I insert the rajawali code is based the AbstractRenderer in this API documentation. The import of the .obj file is ok, but as soon as i start to parse with "objParser.parse();" I get the failure: "Unable to start activity" "NUllPointerException" So as is am new to Android I am really lost. Any help would be a gift! Thank you very much!
I also add the LogCat
11-18 23:16:42.359: E/libEGL(6495): call to OpenGL ES API with no current context (logged once per thread)
11-18 23:16:42.359: E/libEGL(6495): call to OpenGL ES API with no current context (logged once per thread)
11-18 23:16:42.359: E/libEGL(6495): call to OpenGL ES API with no current context (logged once per thread)
11-18 23:16:42.359: E/libEGL(6495): call to OpenGL ES API with no current context (logged once per thread)
11-18 23:16:42.359: D/AndroidRuntime(6495): Shutting down VM
11-18 23:16:42.359: W/dalvikvm(6495): threadid=1: thread exiting with uncaught exception (group=0x40a6d1f8)
11-18 23:16:42.359: E/AndroidRuntime(6495): FATAL EXCEPTION: main
11-18 23:16:42.359: E/AndroidRuntime(6495): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.sungame.sdeck.sample/com.sungame.sdeck.sample.SampleActivity}: java.lang.NullPointerException
11-18 23:16:42.359: E/AndroidRuntime(6495): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1956)
11-18 23:16:42.359: E/AndroidRuntime(6495): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1981)
11-18 23:16:42.359: E/AndroidRuntime(6495): at android.app.ActivityThread.access$600(ActivityThread.java:123)
11-18 23:16:42.359: E/AndroidRuntime(6495): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1147)
11-18 23:16:42.359: E/AndroidRuntime(6495): at android.os.Handler.dispatchMessage(Handler.java:99)
11-18 23:16:42.359: E/AndroidRuntime(6495): at android.os.Looper.loop(Looper.java:137)
11-18 23:16:42.359: E/AndroidRuntime(6495): at android.app.ActivityThread.main(ActivityThread.java:4424)
11-18 23:16:42.359: E/AndroidRuntime(6495): at java.lang.reflect.Method.invokeNative(Native Method)
11-18 23:16:42.359: E/AndroidRuntime(6495): at java.lang.reflect.Method.invoke(Method.java:511)
11-18 23:16:42.359: E/AndroidRuntime(6495): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:784)
11-18 23:16:42.359: E/AndroidRuntime(6495): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:551)
11-18 23:16:42.359: E/AndroidRuntime(6495): at dalvik.system.NativeStart.main(Native Method)
11-18 23:16:42.359: E/AndroidRuntime(6495): Caused by: java.lang.NullPointerException
11-18 23:16:42.359: E/AndroidRuntime(6495): at rajawali.materials.MaterialManager.addMaterial(MaterialManager.java:49)
11-18 23:16:42.359: E/AndroidRuntime(6495): at rajawali.Object3D.setMaterial(Object3D.java:568)
11-18 23:16:42.359: E/AndroidRuntime(6495): at rajawali.parser.LoaderOBJ$MaterialLib.setMaterial(LoaderOBJ.java:634)
11-18 23:16:42.359: E/AndroidRuntime(6495): at rajawali.parser.LoaderOBJ.parse(LoaderOBJ.java:338)
11-18 23:16:42.359: E/AndroidRuntime(6495): at com.sungame.sdeck.sample.render.StereoRenderer.<init>(StereoRenderer.java:86)
11-18 23:16:42.359: E/AndroidRuntime(6495): at com.sungame.sdeck.sample.SampleActivity.onCreate(SampleActivity.java:52)
11-18 23:16:42.359: E/AndroidRuntime(6495): at android.app.Activity.performCreate(Activity.java:4465)
11-18 23:16:42.359: E/AndroidRuntime(6495): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1049)
11-18 23:16:42.359: E/AndroidRuntime(6495): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1920)
11-18 23:16:42.359: E/AndroidRuntime(6495): ... 11 more
11-18 23:16:42.757: I/dalvikvm(6495): threadid=3: reacting to signal 3
11-18 23:16:42.757: I/dalvikvm(6495): Wrote stack traces to '/data/anr/traces.txt'
11-18 23:16:42.898: I/dalvikvm(6495): threadid=3: reacting to signal 3
11-18 23:16:42.898: I/dalvikvm(6495): Wrote stack traces to '/data/anr/traces.txt'
In one of my activities you can click on an image button and a dialog opens up to ask you to open up the Gallery. Once opened up you can click on one of those images in your gallery.
What I want that the clicked image is set as the image of the image button. This image should stay there even when the user kills the app (when he opens up the app again the chosen image should still be there).
I chose to do all this work with the shared preferences but can't get it working. I get an error when I click on an image in the gallery. Any suggestions??
UPDATE: The error I receive is:
Unfortunately, the process com.myname.android has stopped
Here is my code, beginning with the onActivityResult:
private String selectedImagePath;
private String mFileName;
#Override
public void onActivityResult(int requestCode, int resultCode, Intent data) {
if (resultCode == RESULT_OK) {
if (requestCode == PICK_FROM_FILE) {
Uri selectedImageUri = data.getData();
selectedImagePath = getPath(selectedImageUri);
Log.v("IMAGE PATH====>>>> ",selectedImagePath);
}
storePath();
retrievePath();
convertPathToImage();
}
}
private void storePath() {
final SharedPreferences sPreference = getSharedPreferences(
"pref_key", MODE_PRIVATE);
final Editor spEditor = sPreference.edit();
spEditor.putString("img_path", mFileName);
spEditor.commit();
}
private void retrievePath() {
final SharedPreferences sharedPreference = getSharedPreferences(
"pref_key", MODE_PRIVATE);
if (sharedPreference.contains("img_path")) {
mFileName = sharedPreference.getString("img_path",
null);
}
}
private void convertPathToImage() {
File imgFile = new File(mFileName);
if(imgFile.exists()){
Bitmap myBitmap = BitmapFactory.decodeFile(imgFile.getAbsolutePath());
ImageButton myImage = (ImageButton) findViewById(R.id.image);
myImage.setImageBitmap(myBitmap);
}
}
And here is the LogCat:
05-30 15:27:14.567: D/dalvikvm(634): GC_CONCURRENT freed 1K, 3% free 11478K/11783K, paused 5ms+4ms
05-30 15:27:14.597: I/dalvikvm(634): threadid=3: reacting to signal 3
05-30 15:27:14.617: I/dalvikvm(634): Wrote stack traces to '/data/anr/traces.txt'
05-30 15:27:14.926: D/gralloc_goldfish(634): Emulator without GPU emulation detected.
05-30 15:27:26.767: I/dalvikvm(634): threadid=3: reacting to signal 3
05-30 15:27:26.877: I/dalvikvm(634): Wrote stack traces to '/data/anr/traces.txt'
05-30 15:27:30.616: I/dalvikvm(634): threadid=3: reacting to signal 3
05-30 15:27:30.626: I/dalvikvm(634): Wrote stack traces to '/data/anr/traces.txt'
05-30 15:27:32.086: W/IInputConnectionWrapper(634): showStatusIcon on inactive InputConnection
05-30 15:27:33.366: E/ActivityThread(634): Activity com.android.internal.app.ChooserActivity has leaked IntentReceiver com.android.internal.app.ResolverActivity$1#4155da80 that was originally registered here. Are you missing a call to unregisterReceiver()?
05-30 15:27:33.366: E/ActivityThread(634): android.app.IntentReceiverLeaked: Activity com.android.internal.app.ChooserActivity has leaked IntentReceiver com.android.internal.app.ResolverActivity$1#4155da80 that was originally registered here. Are you missing a call to unregisterReceiver()?
05-30 15:27:33.366: E/ActivityThread(634): at android.app.LoadedApk$ReceiverDispatcher.<init>(LoadedApk.java:763)
05-30 15:27:33.366: E/ActivityThread(634): at android.app.LoadedApk.getReceiverDispatcher(LoadedApk.java:567)
05-30 15:27:33.366: E/ActivityThread(634): at android.app.ContextImpl.registerReceiverInternal(ContextImpl.java:1043)
05-30 15:27:33.366: E/ActivityThread(634): at android.app.ContextImpl.registerReceiver(ContextImpl.java:1030)
05-30 15:27:33.366: E/ActivityThread(634): at android.app.ContextImpl.registerReceiver(ContextImpl.java:1024)
05-30 15:27:33.366: E/ActivityThread(634): at android.content.ContextWrapper.registerReceiver(ContextWrapper.java:341)
05-30 15:27:33.366: E/ActivityThread(634): at com.android.internal.content.PackageMonitor.register(PackageMonitor.java:65)
05-30 15:27:33.366: E/ActivityThread(634): at com.android.internal.app.ResolverActivity.onCreate(ResolverActivity.java:99)
05-30 15:27:33.366: E/ActivityThread(634): at com.android.internal.app.ChooserActivity.onCreate(ChooserActivity.java:53)
05-30 15:27:33.366: E/ActivityThread(634): at android.app.Activity.performCreate(Activity.java:4465)
05-30 15:27:33.366: E/ActivityThread(634): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1049)
05-30 15:27:33.366: E/ActivityThread(634): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1920)
05-30 15:27:33.366: E/ActivityThread(634): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1981)
05-30 15:27:33.366: E/ActivityThread(634): at android.app.ActivityThread.access$600(ActivityThread.java:123)
05-30 15:27:33.366: E/ActivityThread(634): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1147)
05-30 15:27:33.366: E/ActivityThread(634): at android.os.Handler.dispatchMessage(Handler.java:99)
05-30 15:27:33.366: E/ActivityThread(634): at android.os.Looper.loop(Looper.java:137)
05-30 15:27:33.366: E/ActivityThread(634): at android.app.ActivityThread.main(ActivityThread.java:4424)
05-30 15:27:33.366: E/ActivityThread(634): at java.lang.reflect.Method.invokeNative(Native Method)
05-30 15:27:33.366: E/ActivityThread(634): at java.lang.reflect.Method.invoke(Method.java:511)
05-30 15:27:33.366: E/ActivityThread(634): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:784)
05-30 15:27:33.366: E/ActivityThread(634): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:551)
05-30 15:27:33.366: E/ActivityThread(634): at dalvik.system.NativeStart.main(Native Method)
05-30 15:27:35.987: V/IMAGE PATH====>>>>(634): /mnt/sdcard/Mercedes_SLS_AMG.jpg
05-30 15:27:36.176: D/AndroidRuntime(634): Shutting down VM
05-30 15:27:36.176: W/dalvikvm(634): threadid=1: thread exiting with uncaught exception (group=0x409c01f8)
05-30 15:27:36.206: E/AndroidRuntime(634): FATAL EXCEPTION: main
05-30 15:27:36.206: E/AndroidRuntime(634): java.lang.RuntimeException: Failure delivering result ResultInfo{who=null, request=0, result=-1, data=Intent { dat=content://media/external/images/media/20 }} to activity {com.xyz.android.taskreminder/com.xyz.android.taskreminder.ReminderEditActivity}: java.lang.NullPointerException
05-30 15:27:36.206: E/AndroidRuntime(634): at android.app.ActivityThread.deliverResults(ActivityThread.java:2980)
05-30 15:27:36.206: E/AndroidRuntime(634): at android.app.ActivityThread.handleSendResult(ActivityThread.java:3023)
05-30 15:27:36.206: E/AndroidRuntime(634): at android.app.ActivityThread.access$1100(ActivityThread.java:123)
05-30 15:27:36.206: E/AndroidRuntime(634): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1177)
05-30 15:27:36.206: E/AndroidRuntime(634): at android.os.Handler.dispatchMessage(Handler.java:99)
05-30 15:27:36.206: E/AndroidRuntime(634): at android.os.Looper.loop(Looper.java:137)
05-30 15:27:36.206: E/AndroidRuntime(634): at android.app.ActivityThread.main(ActivityThread.java:4424)
05-30 15:27:36.206: E/AndroidRuntime(634): at java.lang.reflect.Method.invokeNative(Native Method)
05-30 15:27:36.206: E/AndroidRuntime(634): at java.lang.reflect.Method.invoke(Method.java:511)
05-30 15:27:36.206: E/AndroidRuntime(634): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:784)
05-30 15:27:36.206: E/AndroidRuntime(634): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:551)
05-30 15:27:36.206: E/AndroidRuntime(634): at dalvik.system.NativeStart.main(Native Method)
05-30 15:27:36.206: E/AndroidRuntime(634): Caused by: java.lang.NullPointerException
05-30 15:27:36.206: E/AndroidRuntime(634): at java.io.File.fixSlashes(File.java:185)
05-30 15:27:36.206: E/AndroidRuntime(634): at java.io.File.<init>(File.java:134)
05-30 15:27:36.206: E/AndroidRuntime(634): at com.xyz.android.taskreminder.ReminderEditActivity.convertPathToImage(ReminderEditActivity.java:249)
05-30 15:27:36.206: E/AndroidRuntime(634): at com.xyz.android.taskreminder.ReminderEditActivity.onActivityResult(ReminderEditActivity.java:227)
05-30 15:27:36.206: E/AndroidRuntime(634): at android.app.Activity.dispatchActivityResult(Activity.java:4649)
05-30 15:27:36.206: E/AndroidRuntime(634): at android.app.ActivityThread.deliverResults(ActivityThread.java:2976)
05-30 15:27:36.206: E/AndroidRuntime(634): ... 11 more
05-30 15:27:36.376: I/dalvikvm(634): threadid=3: reacting to signal 3
05-30 15:27:36.396: I/dalvikvm(634): Wrote stack traces to '/data/anr/traces.txt'
05-30 15:27:36.787: I/dalvikvm(634): threadid=3: reacting to signal 3
05-30 15:27:36.847: I/dalvikvm(634): Wrote stack traces to '/data/anr/traces.txt'
05-30 15:27:37.386: I/dalvikvm(634): threadid=3: reacting to signal 3
05-30 15:27:37.406: I/dalvikvm(634): Wrote stack traces to '/data/anr/traces.txt'
05-30 15:27:37.887: I/dalvikvm(634): threadid=3: reacting to signal 3
05-30 15:27:37.947: I/dalvikvm(634): Wrote stack traces to '/data/anr/traces.txt'
05-30 15:27:38.396: I/dalvikvm(634): threadid=3: reacting to signal 3
05-30 15:27:38.416: I/dalvikvm(634): Wrote stack traces to '/data/anr/traces.txt'
05-30 15:27:38.897: I/dalvikvm(634): threadid=3: reacting to signal 3
05-30 15:27:38.927: I/dalvikvm(634): Wrote stack traces to '/data/anr/traces.txt'
05-30 15:27:39.406: I/dalvikvm(634): threadid=3: reacting to signal 3
05-30 15:27:39.426: I/dalvikvm(634): Wrote stack traces to '/data/anr/traces.txt'
05-30 15:27:39.917: I/dalvikvm(634): threadid=3: reacting to signal 3
05-30 15:27:39.927: I/dalvikvm(634): Wrote stack traces to '/data/anr/traces.txt'
05-30 15:27:40.426: I/dalvikvm(634): threadid=3: reacting to signal 3
05-30 15:27:40.446: I/dalvikvm(634): Wrote stack traces to '/data/anr/traces.txt'
05-30 15:27:40.917: I/dalvikvm(634): threadid=3: reacting to signal 3
05-30 15:27:40.947: I/dalvikvm(634): Wrote stack traces to '/data/anr/traces.txt'
05-30 15:27:41.426: I/dalvikvm(634): threadid=3: reacting to signal 3
05-30 15:27:41.447: I/dalvikvm(634): Wrote stack traces to '/data/anr/traces.txt'
05-30 15:27:41.937: I/dalvikvm(634): threadid=3: reacting to signal 3
05-30 15:27:41.977: I/dalvikvm(634): Wrote stack traces to '/data/anr/traces.txt'
05-30 15:27:42.446: I/dalvikvm(634): threadid=3: reacting to signal 3
05-30 15:27:42.467: I/dalvikvm(634): Wrote stack traces to '/data/anr/traces.txt'
05-30 15:27:42.937: I/dalvikvm(634): threadid=3: reacting to signal 3
05-30 15:27:42.956: I/dalvikvm(634): Wrote stack traces to '/data/anr/traces.txt'
05-30 15:27:43.446: I/dalvikvm(634): threadid=3: reacting to signal 3
05-30 15:27:43.467: I/dalvikvm(634): Wrote stack traces to '/data/anr/traces.txt'
05-30 15:27:43.947: I/dalvikvm(634): threadid=3: reacting to signal 3
05-30 15:27:43.976: I/dalvikvm(634): Wrote stack traces to '/data/anr/traces.txt'
05-30 15:27:44.456: I/dalvikvm(634): threadid=3: reacting to signal 3
05-30 15:27:44.477: I/dalvikvm(634): Wrote stack traces to '/data/anr/traces.txt'
05-30 15:27:44.966: I/dalvikvm(634): threadid=3: reacting to signal 3
05-30 15:27:44.986: I/dalvikvm(634): Wrote stack traces to '/data/anr/traces.txt'
05-30 15:27:45.466: I/dalvikvm(634): threadid=3: reacting to signal 3
05-30 15:27:45.487: I/dalvikvm(634): Wrote stack traces to '/data/anr/traces.txt'
Activity com.android.internal.app.ChooserActivity has leaked IntentReceiver com.android.internal.app.ResolverActivity$1#4155da80 that was originally registered here. Are you missing a call to unregisterReceiver()?
This is probably a bug in Android. See http://code.google.com/p/android/issues/detail?id=29399. It shouldn't effect the app though which should still be able to get a result back from the gallery.
05-30 15:27:36.206: E/AndroidRuntime(634): java.lang.RuntimeException: Failure delivering result ResultInfo{who=null, request=0, result=-1, data=Intent { dat=content://media/external/images/media/20 }} to activity {com.ndroidstudios.android.taskreminder/com.ndroidstudios.android.taskreminder.ReminderEditActivity}: java.lang.NullPointerException
...
05-30 15:27:36.206: E/AndroidRuntime(634): Caused by: java.lang.NullPointerException
This is the problem. mFileName is null when you try to use it to create a new File. In retrievePath, when you try to pull "img_path" out of your preferences the default value is null, so I'm guessing it's getting set to null there. Check in the debugger to make sure mFileName is getting set to a valid String from your preferences.
I've been working on an android app and test it on the emulator. Parts of this app require some processing time, such as login, could take up to 10 seconds. If the app is processing the login, and I clicked anywhere on the emulator screen, it will cause the app to crash -> a force close/wait window will pop up and even I choose to wait, this login process will never complete.
I wonder did anybody else encounter this situation? What could I do to avoid user clicking during processing and crash the program? Or on a real phone it is not a problem?
Thanks!
EDIT: This is indeed a UI thread problem and I'm using Mono for Android to write this app, I sort my issues out using methods introduced Here!
EDIT:
this is the LOGCAT messages
1-11 00:38:49.165 W/WindowManager( 59): Key dispatching timed out sending to BadumnaAndroidApi1.BadumnaAndroidApi1/badumnaandroidapi1.Activity1
01-11 00:38:49.165 W/WindowManager( 59): Previous dispatch state: {{KeyEvent{action=1 code=66 repeat=0 meta=0 scancode=28 mFlags=8} to Window{44ed87d0 BadumnaAndroidApi1.BadumnaAndroidApi1/badumnaandroidapi1.Activity1 paused=false} # 1326241690617 lw=Window{44ed87d0 BadumnaAndroidApi1.BadumnaAndroidApi1/badumnaandroidapi1.Activity1 paused=false} lb=android.os.BinderProxy#4508a900 fin=false gfw=true ed=true tts=0 wf=false fp=false mcf=Window{44ed87d0 BadumnaAndroidApi1.BadumnaAndroidApi1/badumnaandroidapi1.Activity1 paused=false}}}
01-11 00:38:49.175 W/WindowManager( 59): Current dispatch state: {{null to Window{44ed87d0 BadumnaAndroidApi1.BadumnaAndroidApi1/badumnaandroidapi1.Activity1 paused=false} # 1326242329174 lw=Window{44ed87d0 BadumnaAndroidApi1.BadumnaAndroidApi1/badumnaandroidapi1.Activity1 paused=false} lb=android.os.BinderProxy#4508a900 fin=false gfw=true ed=true tts=0 wf=false fp=false mcf=Window{44ed87d0 BadumnaAndroidApi1.BadumnaAndroidApi1/badumnaandroidapi1.Activity1 paused=false}}}
01-11 00:38:49.276 I/Process ( 59): Sending signal. PID: 316 SIG: 3
01-11 00:38:49.276 I/dalvikvm( 316): threadid=3: reacting to signal 3
01-11 00:38:49.485 I/dalvikvm( 316): Wrote stack traces to '/data/anr/traces.txt'
01-11 00:38:49.485 I/Process ( 59): Sending signal. PID: 59 SIG: 3
01-11 00:38:49.485 I/dalvikvm( 59): threadid=3: reacting to signal 3
01-11 00:38:49.595 I/dalvikvm( 59): Wrote stack traces to '/data/anr/traces.txt'
01-11 00:38:49.616 I/Process ( 59): Sending signal. PID: 114 SIG: 3
01-11 00:38:49.616 I/dalvikvm( 114): threadid=3: reacting to signal 3
01-11 00:38:49.625 I/dalvikvm( 114): Wrote stack traces to '/data/anr/traces.txt'
01-11 00:38:49.636 I/Process ( 59): Sending signal. PID: 107 SIG: 3
01-11 00:38:49.645 I/dalvikvm( 107): threadid=3: reacting to signal 3
01-11 00:38:49.655 I/dalvikvm( 107): Wrote stack traces to '/data/anr/traces.txt'
01-11 00:38:49.673 I/Process ( 59): Sending signal. PID: 254 SIG: 3
01-11 00:38:49.865 I/dalvikvm( 254): threadid=3: reacting to signal 3
01-11 00:38:49.875 I/Process ( 59): Sending signal. PID: 246 SIG: 3
01-11 00:38:49.906 I/dalvikvm( 246): threadid=3: reacting to signal 3
01-11 00:38:50.085 I/Process ( 59): Sending signal. PID: 177 SIG: 3
01-11 00:38:50.115 I/dalvikvm( 177): threadid=3: reacting to signal 3
01-11 00:38:50.285 I/Process ( 59): Sending signal. PID: 221 SIG: 3
01-11 00:38:50.345 I/dalvikvm( 221): threadid=3: reacting to signal 3
01-11 00:38:50.495 I/Process ( 59): Sending signal. PID: 169 SIG: 3
01-11 00:38:50.575 I/dalvikvm( 169): threadid=3: reacting to signal 3
01-11 00:38:50.695 I/Process ( 59): Sending signal. PID: 185 SIG: 3
01-11 00:38:50.735 I/dalvikvm( 185): threadid=3: reacting to signal 3
01-11 00:38:50.905 I/Process ( 59): Sending signal. PID: 111 SIG: 3
01-11 00:38:50.905 I/dalvikvm( 111): threadid=3: reacting to signal 3
01-11 00:38:51.065 I/dalvikvm( 111): Wrote stack traces to '/data/anr/traces.txt'
01-11 00:38:51.065 I/Process ( 59): Sending signal. PID: 205 SIG: 3
01-11 00:38:51.185 I/dalvikvm( 205): threadid=3: reacting to signal 3
01-11 00:38:51.275 I/Process ( 59): Sending signal. PID: 194 SIG: 3
01-11 00:38:51.405 I/dalvikvm( 194): threadid=3: reacting to signal 3
01-11 00:38:51.485 I/Process ( 59): Sending signal. PID: 155 SIG: 3
01-11 00:38:51.605 I/dalvikvm( 155): threadid=3: reacting to signal 3
01-11 00:38:51.685 I/Process ( 59): Sending signal. PID: 149 SIG: 3
01-11 00:38:51.875 I/dalvikvm( 149): threadid=3: reacting to signal 3
01-11 00:38:51.885 I/Process ( 59): Sending signal. PID: 115 SIG: 3
01-11 00:38:51.916 I/dalvikvm( 115): threadid=3: reacting to signal 3
Ok the chances are you might be causing the UI thread to hang due to this heavy processing -but I could be way off without seeing any code -hint-. What you might is put the heavy stuff into a background thread seperate to the GUI thread, which you are currently running in.
Luckily Android has the AsyncTask class to help you here. Lets say (as there is not enough detail in the question) you are logging in to your app by making a web request to a server. When the user presses login you want to show some sort of processing message while doing all the legwork in your background thread.
Take a look at this article in particular the AsyncTask example http://www.vogella.de/articles/AndroidPerformance/article.html
You can see that doInBackground() is where all the heavy lifting is done and that postExecute() runs in the UI thread once again, which is where you will want to update the UI based on the result of what just happened. For example the user logged in sucessfully or an error occured while logging in.
I could go on for quite some time however this is well documented. Another good post by Google themselves can be found here http://android-developers.blogspot.com/2009/05/painless-threading.html