2016-05-30 34 views
0

我是Kumulos開發新手。從Kumulos的表中選擇數據

我想從kumulos表中選擇數據。

贊如果用戶輸入用戶名和密碼,我從表中檢查數據是否存在。

但問題是,檢查數據插入表中,而不是給我正確的輸出。

在瀏覽器中測試API時,它工作正常。

我的代碼從表中選擇如下。

public void CallApiLogin(){ 


     final String Uname=editUname.getText().toString(); 
     final String pass=editPass.getText().toString(); 

     HashMap<String, String> params = new HashMap<String, String>(); 
     params.put("name", Uname); 
     params.put("password",pass); 

     Kumulos.call("user_register", params, new ResponseHandler() { 
      @Override 
      public void didCompleteWithResult(Object result) { 
       // Do updates to UI/data models based on result 

       ArrayList<LinkedHashMap<String, Object>> objects = (ArrayList<LinkedHashMap<String,Object>>) result; 
       for (LinkedHashMap<String, Object> item : objects) { 
        String name = (String) item.get("name"); 
        String password = (String) item.get("password"); 

        if(name.equalsIgnoreCase(Uname) && password.equalsIgnoreCase(pass)){ 
         Intent i=new Intent(Login.this,Home.class); 
         startActivity(i); 
        }else{ 
         Toast.makeText(getApplicationContext(),"Please enter valid username and password.",Toast.LENGTH_SHORT).show(); 
        } 
       } 

      } 
     }); 

    } 

請建議我哪裏出錯了,因爲請求的數據插入表中。

但我想請求數據存在或不?

回答

0

花費數小時後,我得到了解決方案。

問題正在創建api。在Kumulos中,你必須創建不同的api。

我正在使用API​​「user_register」,現在我創建了其他api調用「Select_user」。

這個API工作得很好,我想要什麼結果。

我希望這個問題可以幫助其他人。