I am saving array list value into sq-lite database. I am getting the value into this format after the loop [1,2] before loop [[1,2]] but i want to get value in loop like:
1
2
What is the proper way to do this?
here is my code, This is where i am saving arraylist value into database
public ArrayList<String> getpid (int id){
sqLiteDatabase =this.getReadableDatabase();
ArrayList<String> list=new ArrayList<>();
String sql="select p_id from cart where customer_id = '" + id + "' ";
Cursor cursor=sqLiteDatabase.rawQuery(sql,null);
if (cursor.moveToFirst()) {
do {
String idd = cursor.getString(0);
String pid = cursor.getString(cursor.getColumnIndex("p_id"));
list.add(pid);
System.out.println("===pid"+pid);
} while (cursor.moveToNext());
}return list;
and this code where i am trying to get value into string format one by one
enter code here ArrayList<String> arrayList=mydatabase.getpid(idd);
System.out.println("--outside"+arrayList);
for(int i =0; i<arrayList.size(); i++){
String value=arrayList.get(i).toString();
System.out.println("---size"+value);
}