Android 从服务解析

Android 从服务解析,android,arrays,Android,Arrays,我试图从服务中解析布尔值true,但我做不到,当我进行调试时,我在这方面得到一个错误int lengthJsonArr=jsonMainNode.length()发送get_用户名和get_密码值后需要解析我应该取布尔值,代码如下请帮助我 String chck; boolean b = false; @Override public void onClick(View v) { // TODO Auto-generated method st

我试图从服务中解析布尔值true,但我做不到,当我进行调试时,我在这方面得到一个错误
int lengthJsonArr=jsonMainNode.length()发送get_用户名和get_密码值后需要解析我应该取布尔值,代码如下请帮助我

    String chck;
     boolean b = false;

    @Override
    public void onClick(View v) {
        // TODO Auto-generated method stub

        switch (v.getId()) {

            case R.id.btn_girisyap:

                get_userName = userName.getText().toString();
                Log.i("@User_Control", "" + get_userName);
                get_password = password.getText().toString();
                Log.i("@User_Control", "" + get_password);

               if( (get_userName.equals("") || get_userName == null) && (get_password.equals("") || get_password == null) ){

                    Toast.makeText(getApplicationContext(), "Lütfen Kullanıcı adı ve şifrenizi giriniz", 
                            Toast.LENGTH_SHORT).show();

                }

               else if(get_userName.equals("") || get_userName == null){

                    Toast.makeText(getApplicationContext(), "Kullanıcı adı boş", 
                            Toast.LENGTH_SHORT).show();

                }

               else if(get_password.equals("") || get_password == null){

                     Toast.makeText(getApplicationContext(), "Şifre boş", 
                     Toast.LENGTH_SHORT).show();

                 }

               else{

                try {
                    new Thread(new Runnable() {
                        @Override
                        public void run() {


                    JSONObject returndata = null;
                    HttpClient httpclient = new DefaultHttpClient();
                    HttpPost httppost = new HttpPost(
                            "http://78.186.62.169:8210/AnketServis.asmx/UserControl");
                    httppost.setHeader("Content-type", "application/json");
                    JSONObject jsonparameter = new JSONObject();

                    try {

                     jsonparameter.put("UserName", get_userName);
                     jsonparameter.put("Password", get_password);

                        httppost.setEntity(new StringEntity(jsonparameter.toString(),
                                "UTF-8"));
                        HttpResponse response = httpclient.execute(httppost);
                        HttpEntity entity = response.getEntity();
                        String responseString = EntityUtils.toString(entity);

                        Log.i("@User_Control", "" + responseString);

                        // final TextView textViewhdn1 = (TextView)
                        // findViewById(R.id.txthdn1);

                        try {
                            returndata = new JSONObject(responseString);
                            JSONArray jsonMainNode = returndata.optJSONArray("d");
                            int lengthJsonArr = jsonMainNode.length();
                            int sorusayisi = lengthJsonArr;
                            Log.i("Log_jsonAkış", "" + sorusayisi);

                            for (int i = 0; i < sorusayisi; i++) {

                                // if (i == sorusayisi)
                                // break;
                                JSONObject jsonChildNode = jsonMainNode
                                        .getJSONObject(i);

                                try {

                                    if (jsonChildNode.optBoolean("UserControlResult",true)) {

                                        Intent im = new Intent(getApplicationContext(),Deneme.class);
                                        startActivity(im);
                                    }

                                } catch (Exception e) {
                                    Log.i("ErrorMessage", "" + e.getMessage());

                                }
                            }

                        } catch (JSONException e) {

                        }

                    } catch (Exception e) {

                    }

                        }
                    }).start();

                } catch (Exception e) {
                    e.printStackTrace();
                }
                    }

                break;
        }
    }
String-chck;
布尔b=假;
@凌驾
公共void onClick(视图v){
//TODO自动生成的方法存根
开关(v.getId()){
案例R.id.btn_girisyap:
get_userName=userName.getText().toString();
Log.i(“@User\u Control”,”“+get\u userName);
get_password=password.getText().toString();
Log.i(“@User\u Control”,”“+get\u password);
if((get|u userName.equals(“”| get|u userName==null)和&(get|u password.equals(“”| get|u password==null)){
Toast.makeText(getApplicationContext(),“Lütfen Kullanıcıadıveşifrenizi girizing”,
吐司。长度(短)。show();
}
else if(get_userName.equals(“”)get_userName==null){
Toast.makeText(getApplicationContext(),“Kullanıcıadıboş”,
吐司。长度(短)。show();
}
else if(get_password.equals(“”)get_password==null){
Toast.makeText(getApplicationContext(),“Şifre boş”,
吐司。长度(短)。show();
}
否则{
试一试{
新线程(newrunnable()){
@凌驾
公开募捐{
JSONObject returndata=null;
HttpClient HttpClient=新的DefaultHttpClient();
HttpPost HttpPost=新的HttpPost(
"http://78.186.62.169:8210/AnketServis.asmx/UserControl");
setHeader(“内容类型”、“应用程序/json”);
JSONObject jsonparameter=新的JSONObject();
试一试{
jsonparameter.put(“用户名”,获取用户名);
jsonparameter.put(“密码”,获取密码);
httppost.setEntity(新的StringEntity(jsonparameter.toString()),
“UTF-8”);
HttpResponse response=httpclient.execute(httppost);
HttpEntity=response.getEntity();
字符串responseString=EntityUtils.toString(实体);
Log.i(“@User\u Control”,”+responseString);
//最终文本视图文本视图HDN1=(文本视图)
//findviewbyd(R.id.txthdn1);
试一试{
returndata=新的JSONObject(responseString);
JSONArray jsonMainNode=returndata.optJSONArray(“d”);
int lengthJsonArr=jsonMainNode.length();
int sorusayisi=长度JSONARR;
Log.i(“Log_jsonAkış,”+sorusaysi);
for(int i=0;i
什么问题?什么错误?什么时候发布您的日志,请不要出错,但当我进行调试时,它不起作用,并且我在这方面出错int lengthJsonArr=jsonMainNode.length();调试处理关闭当我在调试模式下运行时,它进入倒数第二个catch blokasp.net,它有一个内置的javascript登录。你为什么不用它?然后可以在asp.net Web服务中执行ISAuthenticated()?