I'm new to azure, I don't know how to connect to the table that I created in the Azure database. I want to get table data (SELECT *) and populate it in a GridView in android. I know the “filling” part with the adapter, all I want to know is how to connect and receive data from the table :)
I tried the IT tutorial from Microsoft, but I have some difficulties applying the same tutorial to my scenario.
Here is what I tried:
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_home_screen);
try {
mClient = new MobileServiceClient(
"LINK",
"KEY",
this);
} catch (MalformedURLException e) {
}
refreshItemsFromTable();
}
private void refreshItemsFromTable()
{
new AsyncTask<Void, Void, Void>() {
@Override
protected Void doInBackground(Void... params) {
try {
final MobileServiceList<ActivityData> result = mToDoTable.eq(false).execute().get();
runOnUiThread(new Runnable() {
@Override
public void run() {
mAdapter.clear();
for (ActivityData item : result) {
mAdapter.add(item);
}
}
});
} catch (Exception exception) {
Toast.makeText(HomeScreen.this, exception.toString(),Toast.LENGTH_LONG);
}
return null;
}
}.execute();
}
How to specify SQL SELECT query in this script? Seems like this code is not a way to do this? I would like to populate the GridView with tabular data :)