android - W/IInputConnectionWrapper(1066) : showStatusIcon on inactive InputConnection

标签 android

这是我的课:

public class Insert extends Activity 
{

    EditText name,surname,age;
    Button insert;

    @Override
    protected void onCreate(Bundle savedInstanceState) 
     {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.insert);
        StrictMode.ThreadPolicy policy = new StrictMode.ThreadPolicy.Builder().permitAll().build();

        StrictMode.setThreadPolicy(policy);
        name =(EditText)findViewById(R.id.name);
        surname =(EditText)findViewById(R.id.surname);
        age =(EditText)findViewById(R.id.age);
        insert=(Button)findViewById(R.id.click);
        insert.setOnClickListener(new OnClickListener()
        {
              public void onClick(View arg0)
            {
                // TODO Auto-generated method stub
                String nm = name.getText().toString();
                String ct = surname.getText().toString();
                String emailid = age.getText().toString();
                 insertRecords(nm, ct, emailid);
              }
            private void insertRecords(String nm,String ct,String emailid)
            {
                 ArrayList<NameValuePair> nameValuePairs = new ArrayList<NameValuePair>(5);
                    nameValuePairs.add(new BasicNameValuePair("name", nm));
                    nameValuePairs.add(new BasicNameValuePair("surname",ct));
                    nameValuePairs.add(new BasicNameValuePair("age",emailid));
                    sendData(nameValuePairs);
            }
            private void sendData(ArrayList<NameValuePair> data)
            {
                try 
                {
                    HttpClient httpclient = new DefaultHttpClient();
                    HttpPost httppost = new HttpPost("http://10.0.2.2:81/new/insert.php");
                    httppost.setEntity(new UrlEncodedFormEntity(data));
                    HttpResponse response = httpclient.execute(httppost);

                }
                catch (Exception e) {
                    // TODO: handle exception
                    Log.e("log_tag", "Error:  "+e.toString());
                }
            }
        });
    }
    ...
}

在 LogCat 中

04-23 12:12:10.263: W/IInputConnectionWrapper(1066): showStatusIcon on inactive InputConnection

最佳答案

当上一页(或类)中的输入连接尚未关闭时,就会出现此类问题。检查你是否关闭了上一个类中的输入连接(通过给出connection.close())。

当您离开 Activity 并保持 HTTP 连接打开时会出现此问题。为了防止这种情况,您可以尝试调用

httpClient.getConnectionManager().closeIdleConnections();

您可以阅读此方法的文档 here .

关于android - W/IInputConnectionWrapper(1066) : showStatusIcon on inactive InputConnection,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16170449/

相关文章:

Android - match_parent 忽略 layout_margin

android - 谁在 mvp android 中调用 db 查询和 http get

java - Android Activity 问题 startActivity (我只想显示)

android - 格式错误的 url 异常 :protocol not found while adding or deleting data from xml in android?

android - 在 OnClickListener 事件的数据库中插入多个值

android - 在android中的服务器和客户端之间流式传输语音

android - 无法解析方法 'show(android.support.v4.app.FragmentManager, null)'

java - LibGDX 针对不同分辨率(如 Android)的不同 Assets

java - findViewById 时不需要强制转换?

android - 毕加索和httpClient无法解析