I'm new to azure, I don't know how to connect to a Table I created on an Azure Database. I want to get the table data (SELECT *) and populate them in a GridView in android. I know the 'populating' part using an adapter, all I want to know is how to connect and receive the data from the Table :)
I've tried THIS tutorial by Microsoft however, I'm facing some difficulties when applying the same tutorial to my scenario.
Here's 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()
{
//ActivityData is my Entity class
new AsyncTask<Void, Void, Void>() {
//
@Override
protected Void doInBackground(Void... params) {
try {
//This is the problematic area. My actual table's name is "Activity" on the Azure SQL
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 do I specify the SQL SELECT query in this scenario? Looks like this code isn't the way to do it? I would like to populate a GridView with the table data :)