Azure 移动应用获取方法 android 冻结应用
Azure Mobile app get method android freezes app
我有不错的 Azure 移动应用程序背景,但不是 android 方面的。
并且还完成了 java 初学者。
今天,我正在本地尝试使用 azure 移动应用 运行。
它有 table 带有简单待办事项的控制器table 和 1 列 "Name"
这是我的代码。
public class TodoItem {
private String Id;
private String Name;
}
private void CreateMobileAppClient() {
String mobileAppUrl="http://localhost:58441/";
try {
mobileServiceClient = new MobileServiceClient(new URL(mobileAppUrl), this);
} catch(IOException e){
throw new RuntimeException(e);
}
}
private void GetData() {
MobileServiceTable<TodoItem> mTable=mobileServiceClient.getTable(TodoItem.class);
try {
List<TodoItem> results = mTable.execute().get(100, TimeUnit.MILLISECONDS);
Log.d("debug","data success");
String str="";
} catch(Exception e) {
}
}
在调试期间一切正常,直到我进入execute().get()
方法。
此时我的应用程序完全冻结,既不进入 catch 块,也不进入下一行。
我在日志和消息中也看不到太多内容。
我觉得这个问题和这个类似
App not retrieving data from Azure mobile service table
任何帮助都是有用的。
(P.S: table 天蓝色的控制器,与 fiddler 完美配合,所以没有问题。)
尝试使用:
MobileServiceList<TodoItem> results = mTable.execute().get(100, TimeUnit.MILLISECONDS);
此外,您应该在 AsyncTask
.
中获得这些结果
private void GetData()
{
MobileServiceTable<TodoItem> mTable = mobileServiceClient.getTable(TodoItem.class);
MobileServiceList<TodoItem> results;
new AsyncTask<Void, Void, Void>() {
@Override
protected Void doInBackground(Void... params) {
try {
results = mTable.execute().get(100, TimeUnit.MILLISECONDS);
Log.d("debug","data success");
}
catch(Exception e)
{
}
return null;
}
}.execute();
}
我有不错的 Azure 移动应用程序背景,但不是 android 方面的。
并且还完成了 java 初学者。
今天,我正在本地尝试使用 azure 移动应用 运行。
它有 table 带有简单待办事项的控制器table 和 1 列 "Name"
这是我的代码。
public class TodoItem {
private String Id;
private String Name;
}
private void CreateMobileAppClient() {
String mobileAppUrl="http://localhost:58441/";
try {
mobileServiceClient = new MobileServiceClient(new URL(mobileAppUrl), this);
} catch(IOException e){
throw new RuntimeException(e);
}
}
private void GetData() {
MobileServiceTable<TodoItem> mTable=mobileServiceClient.getTable(TodoItem.class);
try {
List<TodoItem> results = mTable.execute().get(100, TimeUnit.MILLISECONDS);
Log.d("debug","data success");
String str="";
} catch(Exception e) {
}
}
在调试期间一切正常,直到我进入execute().get()
方法。
此时我的应用程序完全冻结,既不进入 catch 块,也不进入下一行。
我在日志和消息中也看不到太多内容。
我觉得这个问题和这个类似 App not retrieving data from Azure mobile service table
任何帮助都是有用的。
(P.S: table 天蓝色的控制器,与 fiddler 完美配合,所以没有问题。)
尝试使用:
MobileServiceList<TodoItem> results = mTable.execute().get(100, TimeUnit.MILLISECONDS);
此外,您应该在 AsyncTask
.
private void GetData()
{
MobileServiceTable<TodoItem> mTable = mobileServiceClient.getTable(TodoItem.class);
MobileServiceList<TodoItem> results;
new AsyncTask<Void, Void, Void>() {
@Override
protected Void doInBackground(Void... params) {
try {
results = mTable.execute().get(100, TimeUnit.MILLISECONDS);
Log.d("debug","data success");
}
catch(Exception e)
{
}
return null;
}
}.execute();
}