4 steps:

(1) break line 70 into two:
View myFoundView = findViewById(R.id.btnReferesh);
Button b = (Button)myFoundView;

(2) Put a breakpoint on the 1st line above

(3) Step over the 1st line and then inspect myFoundView;

(4) Workout why whatever is in myFoundView cannot be cast to a Button


On Aug 20, 9:51 pm, Spica <[email protected]> wrote:
> This is line 70;
>  Button b = (Button) findViewById(R.id.btnReferesh);
>
> On Aug 20, 4:39 pm, RichardC <[email protected]> wrote:
>
>
>
>
>
>
>
> > E/AndroidRuntime( 1335): Caused by: java.lang.ClassCastException:
> > android.widget
> > .EditText
> > E/AndroidRuntime( 1335):        at
> > com.myApp.DashBoard.onCreate(DashBoard.java
> > :70)
>
> > What's at line 70 in DashBoard.java?
>
> > On Aug 20, 5:16 pm, Spica <[email protected]> wrote:
>
> > > I removed EditText from my layout and after that i started getting
> > > "Force close" error. My app is not starting at all. Here is the trace
> > > i captured with logcat;
>
> > > =====================================================
> > > E/AndroidRuntime( 1335): FATAL EXCEPTION: main
> > > E/AndroidRuntime( 1335): java.lang.RuntimeException: Unable to start
> > > activity Co
> > > mponentInfo{com.myApp/com.myApp.DashBoard}:
> > > java.lang.ClassCastException: android.widget.EditText
> > > E/AndroidRuntime( 1335):        at
> > > android.app.ActivityThread.performLaunchActiv
> > > ity(ActivityThread.java:2781)
> > > E/AndroidRuntime( 1335):        at
> > > android.app.ActivityThread.handleLaunchActivi
> > > ty(ActivityThread.java:2797)
> > > E/AndroidRuntime( 1335):        at android.app.ActivityThread.access
> > > $2300(Activi
> > > tyThread.java:135)
> > > E/AndroidRuntime( 1335):        at android.app.ActivityThread
> > > $H.handleMessage(Ac
> > > tivityThread.java:2132)
> > > E/AndroidRuntime( 1335):        at
> > > android.os.Handler.dispatchMessage(Handler.ja
> > > va:99)
> > > E/AndroidRuntime( 1335):        at android.os.Looper.loop(Looper.java:
> > > 143)
> > > E/AndroidRuntime( 1335):        at
> > > android.app.ActivityThread.main(ActivityThrea
> > > d.java:4914)
> > > E/AndroidRuntime( 1335):        at
> > > java.lang.reflect.Method.invokeNative(Native
> > > Method)
> > > E/AndroidRuntime( 1335):        at
> > > java.lang.reflect.Method.invoke(Method.java:5
> > > 21)
> > > E/AndroidRuntime( 1335):        at com.android.internal.os.ZygoteInit
> > > $MethodAndA
> > > rgsCaller.run(ZygoteInit.java:858)
> > > E/AndroidRuntime( 1335):        at
> > > com.android.internal.os.ZygoteInit.main(Zygot
> > > eInit.java:616)
> > > E/AndroidRuntime( 1335):        at
> > > dalvik.system.NativeStart.main(Native Method)
>
> > > E/AndroidRuntime( 1335): Caused by: java.lang.ClassCastException:
> > > android.widget
> > > .EditText
> > > E/AndroidRuntime( 1335):        at
> > > com.myApp.DashBoard.onCreate(DashBoard.java
> > > :70)
> > > E/AndroidRuntime( 1335):        at
> > > android.app.Instrumentation.callActivityOnCre
> > > ate(Instrumentation.java:1065)
> > > E/AndroidRuntime( 1335):        at
> > > android.app.ActivityThread.performLaunchActiv
> > > ity(ActivityThread.java:2745)
> > > ============================================
>
> > > I am not using the removed EditText in the code even then it is
> > > throwing this error...

-- 
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

Reply via email to