Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6634077
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T22:53:16+00:00 2026-05-25T22:53:16+00:00

I always get the error: 10-03 09:55:44.517: ERROR/AndroidRuntime(819): Caused by: java.lang.ClassCastException: android.widget.EditText In my

  • 0

I always get the error:

10-03 09:55:44.517: ERROR/AndroidRuntime(819): Caused by: java.lang.ClassCastException: android.widget.EditText

In my code I don’t have the word EditText so why does that error occur?

The MultiAutoCompleteTextView was a EditText before. Please help

Code:

public class AddPizza extends Activity {
    private ImageView iv;
    private MultiAutoCompleteTextView name;
    private RatingBar rating;
    private SQLiteDatabase myDB;
    final String MY_DB_NAME = "PizzaCounter";
    final String MY_DB_TABLE = "Pizza";

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        // TODO Auto-generated method stub
        super.onCreate(savedInstanceState);
        setContentView(R.layout.addpizza);

        iv = (ImageView) findViewById(R.id.imageViewPizza);
        name = (MultiAutoCompleteTextView) findViewById(R.id.multiAutoCompleteTextView1);
        rating = (RatingBar) findViewById(R.id.ratingBar1);
        Button bt = (Button) findViewById(R.id.bt_addform);

        iv.setOnClickListener(new OnClickListener() {

            @Override
            public void onClick(View v) {
                startActivityForResult(new Intent(MediaStore.ACTION_IMAGE_CAPTURE),1337);
            }
        });

        bt.setOnClickListener(new OnClickListener() {

            @Override
            public void onClick(View v) {
                addData();
                finish();
            }


        });

         addAutoSuggest();
    }
    @Override
    protected void onActivityResult(int requestCode, int resultCode, Intent data) {
        if (requestCode == 1337) {
            iv.setImageBitmap((Bitmap) data.getExtras().get("data"));
        }
    }
    private void addData() {
        myDB = this.openOrCreateDatabase(MY_DB_NAME, MODE_PRIVATE, null);
        //myDB.execSQL("DROP TABLE " + MY_DB_TABLE);
        myDB.execSQL("CREATE TABLE IF NOT EXISTS " + MY_DB_TABLE
                    + " (_id integer primary key autoincrement, name varchar(100), rate integer(1), eattime varchar(100),image BLOB)"
                    +";");
        if(!name.getText().equals("") && rating.getRating()!=0.0)
        {
            Log.e("XXX", "Enter_Insert");
            Calendar cal = Calendar.getInstance(); 
            DateFormat formatter = new SimpleDateFormat(); 
            ByteArrayOutputStream out = new ByteArrayOutputStream();
            Bitmap bt = ((BitmapDrawable)iv.getDrawable()).getBitmap();
            bt.compress(Bitmap.CompressFormat.PNG, 100, out);
            ContentValues cv = new ContentValues();
            cv.put("image", out.toByteArray());            
            cv.put("name", name.getText().toString());
            cv.put("eattime", formatter.format(cal.getTime()));
            cv.put("rate", rating.getRating());
            myDB.insert(MY_DB_TABLE, null, cv);

            //myDB.execSQL("INSERT INTO "+ MY_DB_TABLE + "(name,rate,eattime,image) VALUES +" +  + ", " ++ " , datetime('now', 'localtime'), " );
        }

    }

    void addAutoSuggest ()

    {
         myDB = this.openOrCreateDatabase(MY_DB_NAME, MODE_PRIVATE, null);
         ArrayList<String> list = new ArrayList<String>();
         Cursor cursor = this.myDB.query(MY_DB_TABLE, new String[] {"name"},null,null,null,null,null,null);
          if (cursor.moveToFirst()) {
             do {
                list.add(cursor.getString(0)); 
                } 
             while (cursor.moveToNext());
          }
          if (cursor != null && !cursor.isClosed()) {
             cursor.close();
          }
        name.setAdapter( new ArrayAdapter<String>(this, android.R.layout.simple_dropdown_item_1line, list));
    }


}

Layout:

<LinearLayout
  xmlns:android="http://schemas.android.com/apk/res/android"
  android:layout_width="fill_parent"
  android:layout_height="fill_parent" android:orientation="vertical">
    <TextView android:text="Name" android:id="@+id/textView1" android:layout_width="wrap_content" android:layout_height="wrap_content"></TextView>
    <MultiAutoCompleteTextView android:id="@+id/multiAutoCompleteTextView1" android:layout_height="wrap_content" android:text="MultiAutoCompleteTextView" android:layout_width="fill_parent"></MultiAutoCompleteTextView>

    <TextView android:text="Bewertung" android:id="@+id/textView2" android:layout_width="wrap_content" android:layout_height="wrap_content"></TextView>
    <RatingBar android:id="@+id/ratingBar1" android:layout_width="wrap_content" android:layout_height="wrap_content"></RatingBar>
    <TextView android:text="Foto hinzufügen" android:id="@+id/textView3" android:layout_width="wrap_content" android:layout_height="wrap_content"></TextView>
    <ImageView android:layout_height="wrap_content" android:src="@drawable/icon" android:layout_width="wrap_content" android:id="@+id/imageViewPizza"></ImageView>
    <RelativeLayout android:id="@+id/relativeLayout1" android:layout_width="fill_parent" android:layout_height="fill_parent">
        <Button android:text="hinzufügen" android:layout_height="wrap_content" android:id="@+id/bt_addform" android:layout_alignParentBottom="true" android:layout_width="fill_parent"></Button>
    </RelativeLayout>
</LinearLayout>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-25T22:53:16+00:00Added an answer on May 25, 2026 at 10:53 pm
    1. Clean project
    2. Save files
    3. Build & Run

    have fun ^^!

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am using following PHP code for trigger creation but always get error, please
I am trying to use the following code, but I always get an error
I'm querying Wikipedia using the following code, but I always get an error (403
Why I always get WSAETIMEDOUT error in this code : var fUDPBuf: array [1..UdpPacketSize]
When I compile my Android Project I always get this Error: Error generating final
When trying to connect to mysql I always get this error: java.sql.SQLException: No suitable
I want get exeption code from wcf method but i always get NotFound error.
I always get this error when trying to compile my file with Boost::GIL PNG
I am trying to deserialize a stream but I always get this error End
I can't seem to compile ironruby in ruby 1.8.7. I always get this error:

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.