I have created Android app with Azure table storage data..I Will open every time my app Azure data loading in slow..
My table mBranchListTable = mClient.getTable(BranchList.class);
my RemoteDataTask()
code
private class RemoteDataTask extends AsyncTask<Void, Void, Void> {
@Override
protected void onPreExecute() {
super.onPreExecute();
mProgressDialog = new ProgressDialog(Branchs.this);
mProgressDialog.setMessage("Loading...");
mProgressDialog.setIndeterminate(true);
mProgressDialog.show();
}
@Override
protected Void doInBackground(Void... params) {
try {
final List<BranchList> results = mBranchListTable.where().field("enable").eq(val(true)).orderBy("sort", QueryOrder.Ascending).execute().get();
runOnUiThread(new Runnable() {
@Override
public void run() {
mAdapter.clear();
for (BranchList item : results) {
mAdapter.add(item);
}
}
});
} catch (Exception e) {
createAndShowDialog(e, "Error");
}
return null;
}
@Override
protected void onPostExecute(Void result) {
mProgressDialog.dismiss();
}
}
OnCreate
new RemoteDataTask().execute();
mAdapter = new ToDoItemAdapter(this, R.layout.listview_item);
ListView listViewToDo = (ListView) findViewById(R.id.LViewBranchList);
listViewToDo.setAdapter(mAdapter);