IInputConnectionWrapper showStatusIcon在非活动的InputConnection上

时间:2014-11-17 00:59:05

标签: java android android-asynctask android-networking

关于这个具体问题有很多主题,但没有什么对我有用。我有这段代码:

class MyAsyncTask extends AsyncTask<String, Void, ArrayList<MyObject>> {

private ProgressDialog dialog;
private FragmentActivity context;

public MyAsyncTask(FragmentActivity activity) {
    context = activity;
    dialog = new ProgressDialog(context);
}

protected void onPreExecute() {
    this.dialog.setMessage("...");
    this.dialog.show();
}

@Override
protected ArrayList<MyObject> doInBackground(String... params) {
    URL url = new URL(params[0]);
    HttpURLConnection connection = (HttpURLConnection) url.openConnection();
    ArrayList<MyObject> objects = null;

    try {
        InputStream in = connection.getInputStream();
        BufferedReader reader = new BufferedReader(
                new InputStreamReader(in));
        if (connection.getResponseCode() != HttpURLConnection.HTTP_OK) {
            return null;
        }
        String line;
        objects = new ArrayList<MyObject>();
        MyObject mo = new MyObject();

        while ((line = reader.readLine()) != null) {
            // Process data
        }

        reader.close();

    } catch (Exception e) {
        return null;
    } finally {
        if (connection != null)
            connection.disconnect();
    }

    return objects;

}

@Override
protected void onPostExecute(ArrayList<MyObject> data) {
    if (dialog.isShowing()) {
        dialog.dismiss();
    }

    if (data == null) {
        Toast.makeText(context, "fail", Toast.LENGTH_SHORT).show();
    }

    else {

    }

}
}

问题在于每次执行AsyncTask并按我的应用程序上的back按钮时,都会收到以下警告:

IInputConnectionWrapper showStatusIcon on inactive InputConnection

因此,当我下次运行我的应用程序时,我无法从URL获取输入流。我做错了什么?

0 个答案:

没有答案