0

i have made MultiAutoCompleteTextView here and i get multiple pieces of Strings and i collected them using string-array . I want to insert them into MySql database.

here is my android code:

  @Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_work_now);

    String[] str = {"Andoid", "Jelly Bean", "Froyo",
            "Ginger Bread", "Eclipse Indigo", "Eclipse Juno"};

    MultiAutoCompleteTextView mt = (MultiAutoCompleteTextView)
            findViewById(R.id.multiAutoCompleteTextView1);

    mt.setTokenizer(new MultiAutoCompleteTextView.CommaTokenizer());

    ArrayAdapter<String> adp = new ArrayAdapter<String>(this,android.R.layout.simple_dropdown_item_1line, str);

    mt.setThreshold(1);
    mt.setAdapter(adp);


}
        @Override
    public boolean onCreateOptionsMenu (Menu menu){
        getMenuInflater().inflate(R.menu.menu_main, menu);
        return true;
    }
}
William Willi
  • 194
  • 1
  • 2
  • 19

1 Answers1

0

MySQL will obviously need to know how you want to store that array.. I think we need to know more about that. are you splitting the array into different columns in the table or just storing it as a csv string for example?

This depends on how you might be using the data in the future.

Fundamentally is it going into one cell in MySQL table or different cells? And does the data require different type handling by MySQL?

  • yea, from multiAutocomple the user is allowed to choose all thier fav options from the list . Once they are finished the entries must be transferred to the Mysql in column one by one. – William Willi Jul 17 '16 at 12:12
  • mySql contains two columns 1)fav_OS , 2)user_id..... so that from multiAutoComplete i can get the user "fav_OS" and insert it into the database column consecutively in corresponding to the user_id ... So that i can retrieve the user fav_os by using user_id – William Willi Jul 17 '16 at 12:24