调试器不会到达断点

时间:2013-08-08 21:52:13

标签: java android eclipse debugging

我正在设置断点:

public ContentValues getValues() {
然而,代码似乎永远无法达到它,我不知道为什么。

(非常感谢任何输入)

来源:

public class ConfigFinalActivity extends Activity implements OnClickListener {
    private static final String TAG = "ConfigActivity";
    TelephonyManager tm;
    AlertDialog mErrorAlert = null;
    private Notification mNotification = null;
    private Button assist_update_btn = null;

    private ImageView mProgressImageview1;
    private ImageView mProgressImageview2;
    private ImageView mProgressImageview3;
    private ImageView mProgressImageview4;
    private ImageView mProgressImageview5;
    private Button mAssistUpdateButton = null;
    private ImageView mLoadingCircle;
    private int mInstructionNumber = 0;

    public ArrayList<String> ValueArr = new ArrayList<String>();
    public ArrayList<String> nameArr = new ArrayList<String>();
    public ArrayList<String> ApnArr = new ArrayList<String>();
    public ArrayList<String> mmscArr = new ArrayList<String>();
    public ArrayList<String> mmsportArr = new ArrayList<String>();
    public ArrayList<String> mmsproxyArr = new ArrayList<String>();
    public ArrayList<String> portArr = new ArrayList<String>();
    public ArrayList<String> proxyArr = new ArrayList<String>();
    private Button mAssistInstrButton = null;
    private TextView mReadAgainButton = null;
    public static int TotalSteps = 8;
    public static int count;
    int i, g = 0;
    Context ctx;
    public static ContentValues Values = new ContentValues();
    XmlParserHandlerFinal handler;
    public static BigInteger id1, id2;
    BigInteger[] id;
    public static Integer mdn1, mdn2;
    public static String car;
    public static final Uri APN_TABLE_URI = Uri
            .parse("content://telephony/carriers");
    public static String Base_URL = "https://www.mysettings.com/";
    NetworkTask task = new NetworkTask();
    NetworkTask tasks = new NetworkTask();
    InputStream stream = null;
    private AnimationDrawable loadingAnimation;

    /** Called when the activity is first created. */
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        int version = android.os.Build.VERSION.SDK_INT;
        tm = (TelephonyManager) getSystemService(TELEPHONY_SERVICE);
        int networkType = tm.getNetworkType();
        int phoneType = tm.getPhoneType();
        task = new NetworkTask();
        handler = new XmlParserHandlerFinal();

        handler.setContext(ctx);
        getImpVariablesForQuery();

        if (version < VERSION_CODES.ICE_CREAM_SANDWICH) {

            try {
                // updating layout initially has updating text with 1 dot in the

                // This image view has the updating text to be progressively
                // updated
                // with dots addition
                ImageView loading = (ImageView) findViewById(R.id.loading_empty1);

                // Set updating button to drawable animation
                loading.setBackgroundResource(R.drawable.updating1);
                loadingAnimation = (AnimationDrawable) loading.getBackground();

                ImageView loading2 = (ImageView) findViewById(R.id.loading_empty2);

                // Set updating button to drawable animation
                loading2.setBackgroundResource(R.drawable.updating2);
                loadingAnimation = (AnimationDrawable) loading2.getBackground();

                ImageView loading3 = (ImageView) findViewById(R.id.loading_empty3);

                // Set updating button to drawable animation
                loading.setBackgroundResource(R.drawable.updating3);
                loadingAnimation = (AnimationDrawable) loading.getBackground();

                ImageView loading4 = (ImageView) findViewById(R.id.loading_empty4);

                // Set updating button to drawable animation
                loading.setBackgroundResource(R.drawable.updating4);
                loadingAnimation = (AnimationDrawable) loading.getBackground();

                ImageView loading5 = (ImageView) findViewById(R.id.loading_empty5);

                // Set updating button to drawable animation
                loading.setBackgroundResource(R.drawable.updating5);
                loadingAnimation = (AnimationDrawable) loading.getBackground();

                tasks.execute("https://dl.dropboxusercontent.com/u/31771876/GetPhoneSettings-ST-rsp-eng.xml");
                if (tasks.get() != null) {
                    stream = tasks.getInputStream();
                    Log.v("CfA", "here");

                } else if (tasks.get() == null) {
                    setContentView(R.layout.error);


                }

                handler.getQueryResponse(stream);

                Values = getContentValues();

            } catch (SAXException e) {
                // TODO Auto-generated catch block
                e.printStackTrace();
            } catch (InterruptedException e) {
                // TODO Auto-generated catch block
                e.printStackTrace();
            } catch (ExecutionException e) {
                // TODO Auto-generated catch block
                e.printStackTrace();
            } catch (IOException e) {
                // TODO Auto-generated catch block
                e.printStackTrace();
            }

            // Update APN table in separate thread
            new TableUpdateRequestTask().execute("");

        } else {// ICS and later versions

            // startActivity(new Intent(Settings.ACTION_APN_SETTINGS));
            try {

                handler.getQueryResponse(stream);

                Values = getContentValues();
                showNotification();
            } catch (SAXException e) {
                // TODO Auto-generated catch block
                e.printStackTrace();
            } catch (ParserConfigurationException e) {
                // TODO Auto-generated catch block
                e.printStackTrace();

                // TODO Auto-generated catch block
                e.printStackTrace();
            } catch (IOException e) {
                // TODO Auto-generated catch block
                e.printStackTrace();
            }
            new TableUpdateRequestTask().execute("");
        }
    }

    private ContentValues getContentValues() {
        ContentValues values = new ContentValues();


        System.out.println("count" + count);
        values.put("name", nameArr.get(i));
        values.put("apn", ApnArr.get(i));
        values.put("mmsc", mmscArr.get(i));
        values.put("mmsproxy", mmsproxyArr.get(i));
        values.put("mmsport", mmsportArr.get(i));
        values.put("proxy", proxyArr.get(i));
        values.put("port", portArr.get(i));
        if ((tm.getSimOperator()).equals(getString(R.string.numeric_tmo))) {
            values.put("numeric", getString(R.string.numeric_tmo));
            values.put("mnc", (getString(R.string.mnc_tmo)));
        } else if ((tm.getSimOperator())
                .equals(getString(R.string.numeric_att))) {
            values.put("numeric", getString(R.string.numeric_att));
            values.put("mnc", (getString(R.string.mnc_att)));
        }

        return values;
    }

    private void getImpVariablesForQuery() {

        // to get MDN
        Integer MDN = Integer.parseInt(tm.getSimOperator());
        Log.d("MDN", MDN.toString());
        mdn1 = MDN % 1234;
        Log.d("mdn1", mdn1.toString());
        mdn2 = MDN / 1234;
        Log.d("mdn2", mdn2.toString());
        // to retrieve ICCID number of the SIM

        String ICCID = tm.getSimSerialNumber();

        Log.d("ICCID", ICCID);

        long d = 1234;
        BigInteger divisor = BigInteger.valueOf(d);
        BigInteger bInteger = new BigInteger(ICCID);

        id = bInteger.divideAndRemainder(divisor);
        id1 = id[1];
        System.out.println("ICCID%1234 = " + id1);
        id2 = id[0];
        System.out.println("ICCID/1234 = " + id2);
        // Check for the Carrier Type
        if ((tm.getSimOperator()).equals(getString(R.string.numeric_tmo))) {
            car = "TMO";
        } else if ((tm.getSimOperator())
                .equals(getString(R.string.numeric_att))) {
            car = "ATT";
        }

    }

    @SuppressWarnings("unused")
    public ContentValues generateTFConfig() throws IOException, SAXException,
            ParserConfigurationException {

        String operator = tm.getSimOperator();
        ContentValues values = new ContentValues();
        // Query the carrier table for the current data settings
        Cursor c = getContentResolver().query(APN_TABLE_URI, null, "current=?",
                new String[] { "1" }, null);
        values = copyRecordFields(c);

        String charset = "UTF-8";
        String Append_URL = "settingsquery?";
        String param1 = "mdn1=";
        String param2 = "&mdn2=";
        String param3 = "&car=";
        String param4 = "&id1=";
        String param5 = "&id2=";
        String URL = "";
        String parameters = param1 + mdn1 + param2 + mdn2 + param3 + car
                + param4 + id1 + param5 + id2;
        URL = Base_URL + Append_URL + parameters;
        Log.i("url...", URL);
        new NetworkTask().execute(URL);

        return values;
    }

    public int InsertAPN() throws SecurityException {

        int id = -1;
        if (i < nameArr.size()) {
            for (i = 0; i < nameArr.size(); i++) {
                ContentValues values2 = new ContentValues();

                values2 = getValues();
                ContentResolver resolver = getContentResolver();
                Cursor c = null;
                try {
                    Uri newRow = resolver.insert(APN_TABLE_URI, values2);
                    // System.out.println("values in insertAPN" + values1);
                    if (newRow != null) {
                        c = resolver.query(newRow, null, null, null, null);
                        Log.d(TAG, "Newly added APN:");
                        // TF Settings have been inserted
                        // Obtain the apn id
                        int idindex = c.getColumnIndex("_id");
                        c.moveToFirst();
                        id = c.getShort(idindex);

                        Log.d(TAG, "New ID: " + id
                                + ": Inserting new APN succeeded!");
                    }
                } catch (SQLException e) {
                    Log.d(TAG, e.getMessage());
                }
                if (c != null)
                    c.close();
            }
        }
        return id;

    }

    public ContentValues getValues() {

        ContentValues values = new ContentValues();
        values.put("name", nameArr.get(i));
        values.put("apn", ApnArr.get(i));
        values.put("mmsc", mmscArr.get(i));
        values.put("mmsproxy", mmsproxyArr.get(i));
        values.put("mmsport", mmsportArr.get(i));
        values.put("proxy", proxyArr.get(i));
        values.put("port", portArr.get(i));
        if ((tm.getSimOperator()).equals(getString(R.string.numeric_tmo))) {
            values.put("numeric", getString(R.string.numeric_tmo));
            values.put("mnc", (getString(R.string.mnc_tmo)));
        } else if ((tm.getSimOperator())
                .equals(getString(R.string.numeric_att))) {
            values.put("numeric", getString(R.string.numeric_att));
            values.put("mnc", (getString(R.string.mnc_att)));
        }

        return values;

    }

    /*
     * Delete APN data where the indicated field has the values Entire table is
     * deleted if both field and value are null
     */
    private void DeleteAPNs(String field, String[] values)
            throws SecurityException {
        int c = 0;
        c = getContentResolver().delete(APN_TABLE_URI, null, null);
        if (c != 0) {
            String s = "APNs Deleted:\n";
            Log.d(TAG, s);

        }

    }

    /*
     * Return all column names stored in the string array
     */
    private String getAllColumnNames(String[] columnNames) {
        String s = "Column Names:\n";
        for (String t : columnNames) {
            s += t + ":\t";
        }
        return s + "\n";
    }

    /*
     * Copy all data associated with the 1st record Cursor c. Return a
     * ContentValues that contains all record data.
     */
    private ContentValues copyRecordFields(Cursor c) {
        if (c == null)
            return null;
        int row_cnt = c.getCount();
        Log.d(TAG, "Total # of records: " + row_cnt);
        ContentValues values = new ContentValues();//
        if (c.moveToFirst()) {
            String[] columnNames = c.getColumnNames();
            Log.d(TAG, getAllColumnNames(columnNames));
            String row = "";
            for (String columnIndex : columnNames) {
                int i = c.getColumnIndex(columnIndex);
                row += c.getString(i) + ":\t";

                // id to be auto-generated upon record insertion
                values.put(columnIndex, c.getString(i));
            }
            row += "\n";
            Log.d(TAG, row);
            Log.d(TAG, "End Of Records");
        }
        return values;
    }

    // showAlert displays the text contained in message as an alert
    public void showAlert(String message) {
        AlertDialog.Builder builder = new AlertDialog.Builder(this);
        builder.setMessage(message).setPositiveButton("OK",
                new DialogInterface.OnClickListener() {
                    public void onClick(DialogInterface dialog, int id) {
                        ConfigFinalActivity.this.finish();
                    }
                });
        mErrorAlert = builder.create();
        mErrorAlert.show();
    }

    // showErrorAlert displays an alert with layout and a title
    private void showErrorAlert(int layoutRes, String title) {
        AlertDialog.Builder builder = new AlertDialog.Builder(this);
        // Get the layout inflater
        LayoutInflater inflater = ConfigFinalActivity.this.getLayoutInflater();

        // Inflate and set the layout for the dialog
        // Pass null as the parent view because its going in the dialog layout
        builder.setTitle(title)
                .setView(inflater.inflate(layoutRes, null))
                .setPositiveButton(getString(R.string.assisted_button),
                        new DialogInterface.OnClickListener() {
                            public void onClick(DialogInterface dialog, int id) {
                                startActivity(new Intent(
                                        Settings.ACTION_APN_SETTINGS));
                                try {
                                    showNotification();
                                } catch (SAXException e) {
                                    // TODO Auto-generated catch block
                                    e.printStackTrace();
                                } catch (ParserConfigurationException e) {
                                    // TODO Auto-generated catch block
                                    e.printStackTrace();
                                }
                            }
                        });
        mErrorAlert = builder.create();
        mErrorAlert.show();
    }

    // showNotification starts the process of sending notifications to the bar
    // to assist the user in updating the data settings on ICS and later
    // versions of Android
    @TargetApi(Build.VERSION_CODES.ICE_CREAM_SANDWICH)
    void showNotification() throws SAXException, ParserConfigurationException {


        String field = getString(R.string.config_name_label);
        // Log.d(Values);
        String value = Values.get("name").toString();
        System.out.println("DEBUG THIS");
        System.out.println(Values);
        int mId = 1;
        String title = "1 of " + UpdateActivity.TotalSteps + " (Update "
                + field + ":)";
        Notification.Builder mBuilder = new Notification.Builder(this)
                .setSmallIcon(R.drawable.ic_launcher).setContentTitle(title)
                .setContentText(value);
        Intent resultIntent = new Intent(this,
                NotificationActivityForMultiProf.class);
        resultIntent.putExtra(field, value);
        PendingIntent resultPendingIntent = PendingIntent.getActivity(
                getApplicationContext(), 0, resultIntent,
                PendingIntent.FLAG_UPDATE_CURRENT);
        mBuilder.setContentIntent(resultPendingIntent);
        NotificationManager mNotificationManager = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);
        // mId allows you to update the notification later on.
        mNotification = mBuilder.getNotification();
        mNotification.flags |= Notification.FLAG_AUTO_CANCEL;
        mNotificationManager.notify(mId, mNotification);
        finish();
    }

    @Override
    protected void onSaveInstanceState(Bundle outState) {
        // TODO Auto-generated method stub
        super.onSaveInstanceState(outState);
        if (mNotification != null) {
            outState.putString("NOTIFICATIONB", mNotification.toString());
        }
    }

    @Override
    protected void onRestart() {
        super.onRestart();
        if (mErrorAlert != null)
            mErrorAlert.dismiss();
    }

    public void onClick(View v) {
        if (v == assist_update_btn) {

            // /// add instructions here
            // Update button for ICS and up is selected
            // Get the TextView in the Assist Update UI
            TextView tv = (TextView) findViewById(R.id.apn_app_text_cta2);
            String text = "";
            CharSequence styledText = text;
            switch (mInstructionNumber) {
            case 0:
                // Retrieve the instruction string resource corresponding the
                // 2nd set of instructions
                text = String.format(getString(R.string.apn_app_text_instr),
                        TotalSteps);
                styledText = Html.fromHtml(text);
                // Update the TextView with the correct set of instructions
                tv.setText(styledText);
                // Increment instruction number so the correct instructions
                // string resource can be retrieve the next time the update
                // button is pressed
                mInstructionNumber++;
                break;
            case 1:
                text = getString(R.string.apn_app_text_instr2);
                styledText = Html.fromHtml(text);
                tv.setText(styledText);
                // Increment instruction number so the correct instructions
                // string resource can be retrieve the next time the update
                // button is pressed
                mInstructionNumber++;
                break;
            case 2:
                // Final set of instructions-Change to the corresponding layout

                setContentView(R.layout.assist_instructions);
                String assistUpdateInstr = String.format(
                        getString(R.string.apn_app_text_instr3), TotalSteps);
                styledText = Html.fromHtml(assistUpdateInstr);
                TextView assistInstrText = (TextView) findViewById(R.id.updated_text);
                assistInstrText.setText(styledText);
                mAssistInstrButton = (Button) findViewById(R.id.assist_instr_btn);
                mReadAgainButton = (TextView) findViewById(R.id.read_again_btn);
                mAssistInstrButton.setOnClickListener(this);
                mReadAgainButton.setOnClickListener(this);


            }
        } else if (v == mAssistInstrButton) {


            startActivity(new Intent(Settings.ACTION_APN_SETTINGS));

            try {
                showNotification();
            } catch (SAXException e) {
                // TODO Auto-generated catch block
                e.printStackTrace();
            } catch (ParserConfigurationException e) {
                // TODO Auto-generated catch block
                e.printStackTrace();
            }
            finish();
        }
    }

    // This thread performs the setting update and shows pseudo progress update
    public class TableUpdateRequestTask extends
            AsyncTask<String, Integer, String> {

        @Override
        protected void onPreExecute() {
            super.onPreExecute();
            //
        }

        @Override
        protected String doInBackground(String... params) {
            int result = 0;

            {

                // The code below plays a ST Promo animation
                // prior to displaying update success or failure message
                for (int incr = 0; incr < 2; incr++) {
                    // Sleep for 1/2 second
                    // Invoke UI to change updating text to show 1 dot
                    // And Increasing the level to reduce the amount of clipping
                    // and
                    // slowly reveals the hand image
                    publishProgress(R.drawable.loading_full,
                            R.drawable.loading_empty, R.drawable.loading_empty,
                            R.drawable.loading_empty, R.drawable.loading_empty);
                    try {
                        Thread.sleep(500);
                    } catch (InterruptedException e) {
                        // TODO Auto-generated catch block
                        Log.d(TAG, "sleep failure");
                    }
                    publishProgress(R.drawable.loading_full,
                            R.drawable.loading_full, R.drawable.loading_empty,
                            R.drawable.loading_empty, R.drawable.loading_empty);
                    try {
                        Thread.sleep(500);
                    } catch (InterruptedException e) {
                        // TODO Auto-generated catch block
                        Log.d(TAG, "sleep failure");
                    }
                    publishProgress(R.drawable.loading_full,
                            R.drawable.loading_full, R.drawable.loading_full,
                            R.drawable.loading_empty, R.drawable.loading_empty);
                    try {
                        Thread.sleep(500);
                    } catch (InterruptedException e) {
                        // TODO Auto-generated catch block
                        Log.d(TAG, "sleep failure");
                    }
                    publishProgress(R.drawable.loading_full,
                            R.drawable.loading_full, R.drawable.loading_full,
                            R.drawable.loading_full, R.drawable.loading_empty);
                    try {
                        Thread.sleep(500);
                    } catch (InterruptedException e) {
                        // TODO Auto-generated catch block
                        Log.d(TAG, "sleep failure");
                    }
                    publishProgress(R.drawable.loading_full,
                            R.drawable.loading_full, R.drawable.loading_full,
                            R.drawable.loading_full, R.drawable.loading_full);

                    // Sleep for 1/2 second
                    try {
                        Thread.sleep(500);
                    } catch (InterruptedException e) {
                        // TODO Auto-generated catch block
                        Log.d(TAG, "sleep failure");
                    }
                }
                if (result != -1)
                    return "success";
                else
                    return "failure";
            }
        }

        @Override
        protected void onPostExecute(String result) {
            // TODO Auto-generated method stub
            super.onPostExecute(result);
            // Show updated screen if table was successfully updated
            // Or alert indicating settings are not updated
            if (result.equals("success")) {
                assistUpdate();
            } else
                setContentView(R.layout.error);

        }

        // Framework UI thread method corresponding to publishProgress call in
        // worker thread
        protected void onProgressUpdate(Integer... progress) {
            // Call function to update image view
            setProgressImgView(progress[0], progress[1], progress[2],
                    progress[3], progress[4]);
        }

    }

    private int updateTable() throws IOException, SAXException,
            ParserConfigurationException {
        int insertResult = -1;// returned value if table is not properly updated
        try {
            ContentValues TFCarrierTableEntry = generateTFConfig();

            if (tm.getSimState() == TelephonyManager.SIM_STATE_ABSENT
                    || (tm.getSimOperator())
                            .equals(getString(R.string.numeric_tmo))) {

                // delete all APNs before adding new APNs
                DeleteAPNs("numeric=?",
                        new String[] { getString(R.string.numeric_tmo) });
                // Insert NET10 Data Settings into Carrier table

                insertResult = InsertAPN();

            } else if (tm.getSimState() == TelephonyManager.SIM_STATE_ABSENT
                    || (tm.getSimOperator())
                            .equals(getString(R.string.numeric_att))) {
                // Delete all APNs before adding new APNs
                DeleteAPNs("numeric=?",
                        new String[] { getString(R.string.numeric_att) });
                // Insert NET10 Data Settings into Carrier table

                insertResult = InsertAPN();

            } else
                // non SM/ non T-Mo SIM
                showAlert(getString(R.string.insert_sm_dialog));
        } catch (SecurityException e) {
            showErrorAlert(R.layout.assisted_setting,
                    getString(R.string.assited_title));
            Log.d(TAG, e.getMessage());
        }
        return insertResult;
    }

    private void assistUpdate() {
        // Displaying final layout after pre-ICS automatic settings update
        setContentView(R.layout.assist_update);
        assist_update_btn = (Button) findViewById(R.id.assist_update_btn);
        assist_update_btn.setOnClickListener(this);

    }

    // This function return a cursor to the table holding the
    // the APN configurations (Carrier table)
    public Cursor getConfigTableCursor() {
        return getContentResolver()
                .query(APN_TABLE_URI, null, null, null, null);
    }

    public ArrayList<String> getnameArr() {
        System.out.println("test");
        System.out.println(nameArr);
        nameArr.add("testing123");
        return nameArr;

    }

    public ArrayList<String> getApnArr() {
        System.out.println(ApnArr);
        return ApnArr;
    }

    public ArrayList<String> getMMSCArr() {
        System.out.println(mmscArr);
        return mmscArr;
    }

    public ArrayList<String> getMmscProxyArr() {
        System.out.println(mmsproxyArr);
        return mmsproxyArr;
    }

    public ArrayList<String> getMmsPortArr() {
        System.out.println(mmsportArr);
        return mmsportArr;
    }

    public int getCount() {
        System.out.println(count);
        return count;
    }

    public ArrayList<String> getProxyArr() {
        System.out.println(proxyArr);
        return proxyArr;
    }

    public ArrayList<String> getPortArr() {
        System.out.println(portArr);
        return portArr;
    }

    private void setProgressImgView(Integer imgViewId1, Integer imgViewId2,
            Integer imgViewId3, Integer imgViewId4, Integer imgViewId5) {
        // update image view with the updating dots
        // Reset view layout in case orientation while updating
        setContentView(R.layout.updating);
        mProgressImageview1 = (ImageView) findViewById(R.id.loading_empty1);
        mProgressImageview2 = (ImageView) findViewById(R.id.loading_empty2);
        mProgressImageview3 = (ImageView) findViewById(R.id.loading_empty3);
        mProgressImageview4 = (ImageView) findViewById(R.id.loading_empty4);
        mProgressImageview5 = (ImageView) findViewById(R.id.loading_empty5);
        mProgressImageview1.setImageResource(imgViewId1);
        mProgressImageview2.setImageResource(imgViewId2);
        mProgressImageview3.setImageResource(imgViewId3);
        mProgressImageview4.setImageResource(imgViewId4);
        mProgressImageview5.setImageResource(imgViewId5);
        // mLoadingCircle = (ImageView) findViewById(R.id.loading_empty);

    }

    class NetworkTask extends AsyncTask<String, String, InputStream> {
        private static final String LOG_TAG = "STDataSettings";
        private static final String TAG_RESULT = "success";
        private InputStream stream;

        @Override
        protected InputStream doInBackground(String... params) {
            Bundle queryResults = null;

            String urlQueryString = params[0];

            try {

                stream = getQueryResults("https://dl.dropboxusercontent.com/u/33333333/GetPhoneSettings-ST-rsp-eng.xml");

            } catch (IOException e) {
                // TODO Auto-generated catch block
                e.printStackTrace();
            } catch (SAXException e) {
                // TODO Auto-generated catch block
                e.printStackTrace();
            } catch (Exception e) {
                // TODO Auto-generated catch block
                e.printStackTrace();
            }

            return stream;
        }

        /*
         * Sends a query to server and gets back the parsed results in a bundle
         * urlQueryString - URL for calling the webservice
         */
        protected synchronized InputStream getQueryResults(String urlQueryString)
                throws IOException, SAXException, SSLException,
                SocketTimeoutException, Exception {
            // HttpsURLConnection https = null;
            Bundle queryResults = new Bundle();

            HttpsURLConnection https = null;
            String uri = urlQueryString;
            // URL urlo = new URL(urlQueryString);
            URL urlo = new URL(uri);

            https = (HttpsURLConnection) urlo.openConnection();
            https.setConnectTimeout(50000); // 20 second timeout
            https.setRequestProperty("Connection", "Keep-Alive");
            try {
                https = (HttpsURLConnection) urlo.openConnection();


                // xmlStream = new BufferedInputStream(https.getInputStream());

                if ("gzip".equals(https.getContentEncoding())) {
                    stream = new GZIPInputStream(stream);
                } else
                    stream = https.getInputStream();


            } catch (SSLException e) {
                Log.e(LOG_TAG, e.toString());
                e.printStackTrace();

            } catch (SocketTimeoutException e) {
                Log.e(LOG_TAG, e.toString());
                e.printStackTrace();
            } catch (IOException e) {
                Log.e(LOG_TAG, e.toString());
                e.printStackTrace();

            } catch (Exception e) {
                Log.e(LOG_TAG, e.toString());
                e.printStackTrace();

            } finally {
                // https.disconnect();
            }
            // String queryResult = handler.getQueryResponse(stream );
            String queryResult = null;
            queryResults.putString(TAG_RESULT, queryResult);

            return stream;
        }

        public InputStream getInputStream() {
            return stream;
        }

        @Override
        protected void onPostExecute(InputStream stream) {

        }
    }
}

1 个答案:

答案 0 :(得分:1)

没有被召唤。

对它的调用是在

public int InsertAPN() throws SecurityException {

    int id = -1;
    if (i < nameArr.size()) {
        for (i = 0; i < nameArr.size(); i++) {
            ContentValues values2 = new ContentValues();

            values2 = getValues();

该调用位于nameArr的每个元素的循环中,该元素使用零元素初始化:

public ArrayList<String> nameArr = new ArrayList<String>();

因此循环将运行零次。向List添加元素的唯一函数是getnameArr()函数,它永远不会被调用。