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;
    }
}
5
  • What problem you are getting in inserting data in db? Commented Jul 17, 2016 at 11:53
  • i want to know the exact way to push my array in Mysql. Commented Jul 17, 2016 at 11:54
  • Passing an array of data into a SQLite Database in android Commented Jul 17, 2016 at 12:10
  • i want to insert into MySql Commented Jul 17, 2016 at 12:33
  • If you want to put CSV data into one column, think first. See association tables or Junction Tables Commented Jul 17, 2016 at 16:55

1 Answer 1

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?

Sign up to request clarification or add additional context in comments.

2 Comments

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.