Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
99 views
in Technique[技术] by (71.8m points)

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

Here is my class:

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());
                }
            }
        });
    }
    ...
}

In LogCat

04-23 12:12:10.263: W/IInputConnectionWrapper(1066): showStatusIcon on inactive InputConnection
question from:https://stackoverflow.com/questions/16170449/w-iinputconnectionwrapper1066-showstatusicon-on-inactive-inputconnection

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

Such problems occur when the input connection in the previous page(or class) has not been closed. Check whether you've closed the input connection in the previous class (by giving connection.close()).

This problem arises when you leave the activity and keep an HTTP connection open. To prevent that, you can try calling

httpClient.getConnectionManager().closeIdleConnections();

You can read the documentation for this method here.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...