Note that there are some explanatory texts on larger screens.

plurals
  1. POHoloEverywhere AutoCompleteTextView java.lang.ClassCastException
    primarykey
    data
    text
    <p>I am trying to get the HoloEverywhere class AutoCompleteTextView to work with my app. The main reason for this is I want the Holo theme to work on pre 3.0 devices (specifically API levels 8-10) Here is my main activity code:</p> <pre><code>package com.example.testautocomp; import org.holoeverywhere.widget.AutoCompleteTextView; import android.app.Activity; import android.os.Bundle; import android.widget.ArrayAdapter; public class MainActivity extends Activity { private AutoCompleteTextView m_edit; private static final String[] items = { "lorem", "ipsum", "dolor", "sit", "amet", "consectetuer", "adipiscing", "elit", "morbi", "vel", "augue", "purus", "sitter", "sitting", "sither", "sithar" }; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); m_edit = (AutoCompleteTextView)findViewById(R.id.edit2); m_edit.setAdapter(new ArrayAdapter&lt;String&gt;(this, android.R.layout.simple_dropdown_item_1line, items)); } } </code></pre> <p>also my activity_main.xml code:</p> <pre><code>&lt;LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical" &gt; &lt;AutoCompleteTextView android:id="@+id/edit2" android:layout_width="match_parent" android:layout_height="wrap_content" android:completionThreshold="1" android:hint="Testing" /&gt; &lt;/LinearLayout&gt; </code></pre> <p>When I run my app, it goes into the debugger for eclipse and after pressing resume (or F8) to continue the thread, my app crashes/force closes and I get the following error in my LogCat:</p> <pre><code>04-19 17:52:56.342: W/dalvikvm(675): threadid=1: thread exiting with uncaught exception (group=0x409c01f8) 04-19 17:52:56.422: E/AndroidRuntime(675): FATAL EXCEPTION: main 04-19 17:52:56.422: E/AndroidRuntime(675): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.testautocomp/com.example.testautocomp.MainActivity}: java.lang.ClassCastException: android.widget.AutoCompleteTextView cannot be cast to org.holoeverywhere.widget.AutoCompleteTextView 04-19 17:52:56.422: E/AndroidRuntime(675): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1956) 04-19 17:52:56.422: E/AndroidRuntime(675): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1981) 04-19 17:52:56.422: E/AndroidRuntime(675): at android.app.ActivityThread.access$600(ActivityThread.java:123) 04-19 17:52:56.422: E/AndroidRuntime(675): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1147) 04-19 17:52:56.422: E/AndroidRuntime(675): at android.os.Handler.dispatchMessage(Handler.java:99) 04-19 17:52:56.422: E/AndroidRuntime(675): at android.os.Looper.loop(Looper.java:137) 04-19 17:52:56.422: E/AndroidRuntime(675): at android.app.ActivityThread.main(ActivityThread.java:4424) 04-19 17:52:56.422: E/AndroidRuntime(675): at java.lang.reflect.Method.invokeNative(Native Method) 04-19 17:52:56.422: E/AndroidRuntime(675): at java.lang.reflect.Method.invoke(Method.java:511) 04-19 17:52:56.422: E/AndroidRuntime(675): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:784) 04-19 17:52:56.422: E/AndroidRuntime(675): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:551) 04-19 17:52:56.422: E/AndroidRuntime(675): at dalvik.system.NativeStart.main(Native Method) 04-19 17:52:56.422: E/AndroidRuntime(675): Caused by: java.lang.ClassCastException: android.widget.AutoCompleteTextView cannot be cast to org.holoeverywhere.widget.AutoCompleteTextView 04-19 17:52:56.422: E/AndroidRuntime(675): at com.example.testautocomp.MainActivity.onCreate(MainActivity.java:22) 04-19 17:52:56.422: E/AndroidRuntime(675): at android.app.Activity.performCreate(Activity.java:4465) 04-19 17:52:56.422: E/AndroidRuntime(675): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1049) 04-19 17:52:56.422: E/AndroidRuntime(675): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1920) 04-19 17:52:56.422: E/AndroidRuntime(675): ... 11 more </code></pre> <p>How do i fix this CastClassException?</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload