Java Android ArrayList json connect

Java Android ArrayList json connect,java,android,json,Java,Android,Json,在我的应用程序中,我使用了ArrayList来显示值。从ArrayList中获取值并通过JSON显示结果。但是应用程序没有显示值 我上传的代码,请检查,如果有任何错误,请帮助 活性 String klno; TextView tv101; private ProgressDialog pDialog; JSONParser jsonParser = new JSONParser(); private static final String url_ka

在我的应用程序中,我使用了ArrayList来显示值。从ArrayList中获取值并通过JSON显示结果。但是应用程序没有显示值

我上传的代码,请检查,如果有任何错误,请帮助

活性

String klno;
    TextView tv101;


    private ProgressDialog pDialog;


    JSONParser jsonParser = new JSONParser();

     private static final String url_karmic_lesson = "http://iascpl.com/app/get_karmic_lesson.php";


        private static final String TAG_SUCCESS = "success";
        private static final String TAG_PRODUCT = "product";
        private static final String TAG_KARMIC = "karmic";

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.firstactivity_xm);


        new GetProductDetails().execute();



        //tv1.setText("");
        //for (int j = 0; j < list.size(); j++){
        //   tv1.append("KarmicLesson " + list.get(j) + "\n");


        //}

        TextView tv2 = (TextView) findViewById (R.id.textView2);

        tv2.setText(getIntent().getStringExtra("name2"));


}
    class GetProductDetails extends AsyncTask<String, String, String> {

        /**
         * Before starting background thread Show Progress Dialog
         * */
        @Override
        protected void onPreExecute() {
            super.onPreExecute();
            pDialog = new ProgressDialog(FirstActivity.this);
            pDialog.setMessage("Loading the result... Please wait...");
            pDialog.setIndeterminate(false);
            pDialog.setCancelable(true);
            pDialog.show();
        }

        /**
         * Getting product details in background thread
         * */
        protected String doInBackground(String... args) 
        {

            ArrayList<Integer> klno = getIntent().getIntegerArrayListExtra("sum1");

            List<NameValuePair> params = new ArrayList<NameValuePair>();
            params.add(new BasicNameValuePair("klno", String.valueOf(klno)));

            JSONObject json = jsonParser.makeHttpRequest(
                    url_karmic_lesson, "GET", params);

            Log.d("Single Product Details", json.toString());

            try {
                int success = json.getInt(TAG_SUCCESS);
                if (success == 1) {
                    // successfully received product details
                    JSONArray productObj = json
                            .getJSONArray(TAG_PRODUCT); // JSON Array

                    // get first product object from JSON Array
                    final JSONObject product = productObj.getJSONObject(0);

                    // product with this pid found
                    // Edit Text
                    final TextView tv1 = (TextView) findViewById (R.id.textView1);
                    final ArrayList<Integer> klno1 = getIntent().getIntegerArrayListExtra("sum1");

                    runOnUiThread(new Runnable() 

                    {  
                        @Override
                        public void run() 
                        {
                            // TODO Auto-generated method stub
                            try {
                                //tv1.setText("");
                                //for (int j = 0; j < list.size(); j++){
                                //   tv1.append("KarmicLesson " + list.get(j) + "\n");


                                //}
                                tv1.setText("");
                                for (int j = 0; j < klno1.size(); j++){
                                tv1.setText(product.getString(TAG_KARMIC));

                            }} catch (JSONException e) {
                                // TODO Auto-generated catch block
                                e.printStackTrace();
                            }
                        }
                    });

                }else{
                    // product with pid not found
                }


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




    return null;
}


/**
 * After completing background task Dismiss the progress dialog
 * **/
protected void onPostExecute(String file_url) {
    // dismiss the dialog once got all details
    pDialog.dismiss();
}
            }
        }

您是否已将
添加到清单中?在清单“消息”中添加
:“未找到产品”,“成功”:0}。。我添加了许可。。现在我可以连接json了,但是这个mesage是在logcat中出现的,@roshanpeter open this
http://iascpl.com/app/get_karmic_lesson.php
在broswer中。你看到了什么?成功的信息来了。。。。
  12-12 12:51:34.797: I/Process(9856): Sending signal. PID: 9856 SIG: 9
12-12 12:59:23.098: D/gralloc_goldfish(10054): Emulator without GPU emulation detected.
12-12 12:59:27.527: D/InputEventConsistencyVerifier(10054): KeyEvent: ACTION_UP but key was not down.
12-12 12:59:27.527: D/InputEventConsistencyVerifier(10054):   in android.widget.EditText{40d10060 VFED..CL .F....I. 80,85-400,144 #7f080001 app:id/editText2}
12-12 12:59:27.527: D/InputEventConsistencyVerifier(10054):   0: sent at 27507962000000, KeyEvent { action=ACTION_UP, keyCode=KEYCODE_TAB, scanCode=15, metaState=0, flags=0x8, repeatCount=0, eventTime=27507962, downTime=27507855, deviceId=0, source=0x101 }
12-12 12:59:27.667: D/dalvikvm(10054): GC_CONCURRENT freed 88K, 8% free 2683K/2892K, paused 78ms+12ms, total 225ms
12-12 12:59:37.727: I/Choreographer(10054): Skipped 30 frames!  The application may be doing too much work on its main thread.
12-12 12:59:42.397: D/dalvikvm(10054): GC_FOR_ALLOC freed 139K, 9% free 2859K/3120K, paused 558ms, total 599ms
12-12 12:59:42.517: I/dalvikvm-heap(10054): Grow heap (frag case) to 3.513MB for 635812-byte allocation
12-12 12:59:42.867: D/dalvikvm(10054): GC_FOR_ALLOC freed 2K, 8% free 3478K/3744K, paused 348ms, total 348ms
12-12 12:59:43.638: D/dalvikvm(10054): GC_CONCURRENT freed 14K, 8% free 3473K/3744K, paused 18ms+76ms, total 774ms
doing too much work on its main thread.
12-12 13:00:34.857: D/Single Product Details(10054): {"message":"No product found","success":0}
12-12 13:00:38.547: I/Choreographer(10054): Skipped 38 frames!  The application may be doing too much work on its main thread.