2017-03-19 70 views
0

我有天蓝色的移动应用程序的体面背景,但不是在android端。Azure移动应用程序获取方法android结冰应用程序

也是完整的java初学者。

今天,我正在尝试我的手,蔚蓝的移动应用程序在本地运行。

它拥有简单todotable 1列“名称”

表控制器,这是我的代码。

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:在蔚蓝的边桌控制器,可以完美兼容小提琴手,所以没有问题。)

+0

做,如果你在GETALL方法添加日志语句后端,你得到什么? –

回答

1

尝试使用:

MobileServiceList<TodoItem> results = mTable.execute().get(100, TimeUnit.MILLISECONDS); 

你也应该得到一个AsyncTask这些结果。

私人无效的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"); 
      String str=""; 
      } 
     catch(Exception e) 
      { 

      } 
     return null; 
     } 
    }.execute 
} 
相关问题