2017-03-19 68 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 
} 
相關問題