如何解决logcat错误?

时间:2011-05-05 07:25:04

标签: java android

您好我创建了一个画廊..我想在我的画廊中创建文件夹。所以,我正在使用文件方法,但现在应用程序崩溃...我的模拟器显示。应用程序库(process gallery.gallery)意外停止。请稍后再试..如何解决这些错误...... logcat错误:

05-05 12:31:09.029: INFO/System.out(333): /mnt/sdcard/myImages
05-05 12:31:09.039: DEBUG/AndroidRuntime(333): Shutting down VM
05-05 12:31:09.039: WARN/dalvikvm(333): threadid=1: thread exiting with uncaught 
exception (group=0x4001d800)
05-05 12:31:09.079: ERROR/AndroidRuntime(333): FATAL EXCEPTION: main
05-05 12:31:09.079: ERROR/AndroidRuntime(333): java.lang.ClassCastException:   
android.widget.Gallery$LayoutParams
05-05 12:31:09.079: ERROR/AndroidRuntime(333):     at 
android.widget.GridView.onMeasure(GridView.java:934)
05-05 12:31:09.079: ERROR/AndroidRuntime(333):     at 
android.view.View.measure(View.java:8171)
05-05 12:31:09.079: ERROR/AndroidRuntime(333):     at 
android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:3132)
05-05 12:31:09.079: ERROR/AndroidRuntime(333):     at 
android.widget.LinearLayout.measureChildBeforeLayout(LinearLayout.java:1012)
05-05 12:31:09.079: ERROR/AndroidRuntime(333):     at 
android.widget.LinearLayout.measureVertical(LinearLayout.java:381)
05-05 12:31:09.079: ERROR/AndroidRuntime(333):     at 
android.widget.LinearLayout.onMeasure(LinearLayout.java:304)
05-05 12:31:09.079: ERROR/AndroidRuntime(333):     at 
android.view.View.measure(View.java:8171)
05-05 12:31:09.079: ERROR/AndroidRuntime(333):     at 
android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:3132)
05-05 12:31:09.079: ERROR/AndroidRuntime(333):     at 
android.widget.FrameLayout.onMeasure(FrameLayout.java:245)
05-05 12:31:09.079: ERROR/AndroidRuntime(333):     at 
android.view.View.measure(View.java:8171)
05-05 12:31:09.079: ERROR/AndroidRuntime(333):     at 
android.widget.LinearLayout.measureVertical(LinearLayout.java:526)
05-05 12:31:09.079: ERROR/AndroidRuntime(333):     at 
android.widget.LinearLayout.onMeasure(LinearLayout.java:304)
05-05 12:31:09.079: ERROR/AndroidRuntime(333):     at 
android.view.View.measure(View.java:8171)
05-05 12:31:09.079: ERROR/AndroidRuntime(333):     at 
android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:3132)
05-05 12:31:09.079: ERROR/AndroidRuntime(333):     at   
android.widget.FrameLayout.onMeasure(FrameLayout.java:245)
05-05 12:31:09.079: ERROR/AndroidRuntime(333):     at   
android.view.View.measure(View.java:8171)
05-05 12:31:09.079: ERROR/AndroidRuntime(333):     at   
android.view.ViewRoot.performTraversals(ViewRoot.java:801)
05-05 12:31:09.079: ERROR/AndroidRuntime(333):     at 
android.view.ViewRoot.handleMessage(ViewRoot.java:1727)
05-05 12:31:09.079: ERROR/AndroidRuntime(333):     at 
android.os.Handler.dispatchMessage(Handler.java:99)
05-05 12:31:09.079: ERROR/AndroidRuntime(333):     at 
android.os.Looper.loop(Looper.java:123)
05-05 12:31:09.079: ERROR/AndroidRuntime(333):     at 
android.app.ActivityThread.main(ActivityThread.java:4627)
05-05 12:31:09.079: ERROR/AndroidRuntime(333):     at 
java.lang.reflect.Method.invokeNative(Native Method)
05-05 12:31:09.079: ERROR/AndroidRuntime(333):     at 
java.lang.reflect.Method.invoke(Method.java:521)
05-05 12:31:09.079: ERROR/AndroidRuntime(333):     at 
com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)
05-05 12:31:09.079: ERROR/AndroidRuntime(333):     at 
com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
05-05 12:31:09.079: ERROR/AndroidRuntime(333):     at 
dalvik.system.NativeStart.main(Native Method)

1 个答案:

答案 0 :(得分:1)

你在做什么

imageView.setLayoutParams(new Gallery.LayoutParams(85, 85));

但是图像视图在这里以ViewGroup.LayoutParams为参数。请参阅Javadoc for ImageView