Sorry, that got sent incomplete. The logcat gives me:

01-08 14:55:41.757: E/ACRA(15317): java.lang.RuntimeException: Unable to
start activity
ComponentInfo{com.raghavsood.gravity/com.raghavsood.gravity.Forceometer}:
java.lang.ClassCastException: android.widget.TextView cannot be cast to
android.widget.Button
01-08 14:55:41.757: E/ACRA(15317): at
android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1956)
01-08 14:55:41.757: E/ACRA(15317): at
android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1981)
01-08 14:55:41.757: E/ACRA(15317): at
android.app.ActivityThread.access$600(ActivityThread.java:123)
01-08 14:55:41.757: E/ACRA(15317): at
android.app.ActivityThread$H.handleMessage(ActivityThread.java:1147)
01-08 14:55:41.757: E/ACRA(15317): at
android.os.Handler.dispatchMessage(Handler.java:99)
01-08 14:55:41.757: E/ACRA(15317): at
android.os.Looper.loop(Looper.java:137)
01-08 14:55:41.757: E/ACRA(15317): at
android.app.ActivityThread.main(ActivityThread.java:4424)
01-08 14:55:41.757: E/ACRA(15317): at
java.lang.reflect.Method.invokeNative(Native Method)
01-08 14:55:41.757: E/ACRA(15317): at
java.lang.reflect.Method.invoke(Method.java:511)
01-08 14:55:41.757: E/ACRA(15317): at
com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:784)
01-08 14:55:41.757: E/ACRA(15317): at
com.android.internal.os.ZygoteInit.main(ZygoteInit.java:551)
01-08 14:55:41.757: E/ACRA(15317): at dalvik.system.NativeStart.main(Native
Method)
01-08 14:55:41.757: E/ACRA(15317): Caused by: java.lang.ClassCastException:
android.widget.TextView cannot be cast to android.widget.Button
01-08 14:55:41.757: E/ACRA(15317): at
com.raghavsood.gravity.Forceometer.onCreate(Forceometer.java:87)
01-08 14:55:41.757: E/ACRA(15317): at
android.app.Activity.performCreate(Activity.java:4465)
01-08 14:55:41.757: E/ACRA(15317): at
android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1049)
01-08 14:55:41.757: E/ACRA(15317): at
android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1920)
01-08 14:55:41.757: E/ACRA(15317): ... 11 more

I know the font is fine as I use it in two other textviews and it works
brilliantly. I have tried this on a 2.3 device, and ICS on the Nexus S.
Doesn't work on either.

Thanks

On Sun, Jan 8, 2012 at 2:55 PM, Raghav Sood
<raghavs...@androidactivist.org>wrote:

> Hi all,
>
> I was updating the ui to one of my apps, and encountered a problem setting
> the typeface of the button. According to the online docs, calling
> setTypeface() on a button should work. However, I get the following error:
>
>  java.lang.RuntimeException: Unable to start activity
> ComponentInfo{com.raghavsood.gravity/com.raghavsood.gravity.Forceometer}:
> java.lang.ClassCastException: android.widget.TextView cannot be cast to
> android.widget.Button
> 01-08 14:55:41.757: E/ACRA(15317): at
> android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1956)
> 01-08 14:55:41.757: E/ACRA(15317): at
> android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1981)
> 01-08 14:55:41.757: E/ACRA(15317): at
> android.app.ActivityThread.access$600(ActivityThread.java:123)
> 01-08 14:55:41.757: E/ACRA(15317): at
> android.app.ActivityThread$H.handleMessage(ActivityThread.java:1147)
> 01-08 14:55:41.757: E/ACRA(15317): at
> android.os.Handler.dispatchMessage(Handler.java:99)
> 01-08 14:55:41.757: E/ACRA(15317): at
> android.os.Looper.loop(Looper.java:137)
> 01-08 14:55:41.757: E/ACRA(15317): at
> android.app.ActivityThread.main(ActivityThread.java:4424)
> 01-08 14:55:41.757: E/ACRA(15317): at
> java.lang.reflect.Method.invokeNative(Native Method)
> 01-08 14:55:41.757: E/ACRA(15317): at
> java.lang.reflect.Method.invoke(Method.java:511)
> 01-08 14:55:41.757: E/ACRA(15317): at
> com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:784)
>   at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:551)
>   at dalvik.system.NativeStart.main(Native Method)
>         Caused by: java.lang.ClassCastException: android.widget.TextView
> cannot be cast to android.widget.Button
>   at com.raghavsood.gravity.Forceometer.onCreate(Forceometer.java:87)
>   at android.app.Activity.performCreate(Activity.java:4465)
>   at
> android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1049)
>   at
> android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1920)
> ... 11 more
>
>
> --
> Raghav Sood
> http://www.androidactivist.org/ - Author
> http://www.appaholics.in/ - Founder
>
>


-- 
Raghav Sood
http://www.androidactivist.org/ - Author
http://www.appaholics.in/ - Founder

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to