I am creating a SQLiteOpenHelper and want to send multiple column with columns as key and returned values as associated string. Cant find any associated arrays in Android except using HashMap. Can I use contentValues as associated arrays?
You haven't described what you are trying to achieve very well, but there are two options:
HashMap (or any
Map for that matter) - and put values in it:
Map<String, String> values = new HashMap<String, String>(); values.put("key1", "value1"); values.put("key2", "value2");
Then, when you need to get the values, retrieve them from the map.
You can use
ContentValues - and put values in it. The code would be pretty much the same.
Which option you choose depends on your preference and also on what you're trying to do. If inside your SQLite Helper you are planning to use these values to insert/update records in a database, then you might as well just use
ContentValues - otherwise you'd need to extract them from the
HashMap and put into