I am working in android app project in which I am storing data into a local db which is sqlite for store data offline.Data size is minimal which is basically like name,mobile no etc.I store those data into sqlite because i consider that app client don't have internet connection or he store multiple data so he can store data locally,and the next part is send data into a sql server with a button click.I can't work with synchronization because of sql server (Central remote server) have lot's of table and lot's data,i don't want to rush my local android app db.I am tryed to fetch data with while loop and then fetch data from sqlite and then send data sql server directly(i don't use api because security is not a concern here)
enter code here
package com.ohnnu.myofficetool;
import android.content.ContentValues;
import android.content.Context;
import android.database.Cursor;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;
/**
* Created by joy on 11/4/2016.
*/
public class DatabaseHelper extends SQLiteOpenHelper {
public static final String DATABASE_NAME="myofficetool.db";
public static final String TABLE_NAME="orderChalan_table";
public static final String COL_1="ID";
public static final String COL_2="ProdNo";
public static final String COL_3="Qtn";
public static final String COL_4="CusID";
public String delete;
public DatabaseHelper(Context context) {
super(context, DATABASE_NAME, null, 1);
}
@Override
public void onCreate(SQLiteDatabase db) {
db.execSQL("create table "+TABLE_NAME+"(ID INTEGER PRIMARY KEY AUTOINCREMENT,ProdNo TEXT,Qtn TEXT,CusID TEXT)");
}
@Override
public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
db.execSQL("DROP TABLE IF EXISTS "+TABLE_NAME);
onCreate(db);
}
}
public Cursor getAllData(){
SQLiteDatabase db=this.getWritableDatabase();
Cursor res=db.rawQuery("select * from "+TABLE_NAME,null);
return res;
}
}
What i am trying now to fetch information in asynctask after that send the fetch data into sql server.Please suggest me how to fetch information in aynctask,