android:三星Mini特有的crashFatal Spin-On-Suspend / Stuck on ThreadID

时间:2014-05-22 11:20:51

标签: android performance android-manifest

你好我有一个应用程序,除了三星迷你型S4,Ace等以外的所有手机都能正常工作。我在某处读到添加支持屏幕可以解决问题,我甚至去了清单中禁用相机硬件功能但没有作品。当我通过一个线程向服务器发送请求时,它会在进度对话框中停留,但随后崩溃显示:threadid = 2:卡在threadid = 1上,放弃,致命信号16.关于这个问题的任何领导或建议?我是否需要发布我的清单?(最小sdk为8,最大值为19)启动线程的代码如下:

    public void onClick(View v) {

                progress.show();

                Thread a = new Thread(new Runnable() {

                    @Override
                    public void run() {

                        temp = 3;
                        test = false;



                        username1 = username.getText().toString();
                        password1 = pass.getText().toString();
                        System.out.println(username1);
                        System.out.println(password1);
                        JSONObject jsonObj = new JSONObject();

                        try {

                            jsonObj.put("username", username.getText()
                                    .toString());
                        } catch (JSONException e) {

                            e.printStackTrace();
                        }
                        try {

                            jsonObj.put("password", pass.getText()
                                    .toString());

                        } catch (JSONException e) {

                            e.printStackTrace();

                        } else {
                            httpPost = new HttpPost(URL);

                        }

                        StringEntity entity = null;
                        try {
                            entity = new StringEntity(jsonObj.toString(),
                                    HTTP.UTF_8);
                        } catch (UnsupportedEncodingException e) {

                            e.printStackTrace();
                        }

                        entity.setContentType("application/json");
                        httpPost.setEntity(entity);
                        HttpClient client = new DefaultHttpClient();
                        try {
                            HttpResponse response = client
                                    .execute(httpPost);



                                    InputStream stream = responseEntity
                                            .getContent();

                                    InputStreamReader reader = new InputStreamReader(
                                            stream);

                                    reader.read(buffer);

                                    stream.close();

                                    String result = new String(buffer);


                                    try {

                                        JSONObject jObject = new JSONObject(
                                                result);


                                        String uid = jObject
                                                .getString("uid");

                                        LdapServices ldapservices = new LdapServices();
                                        c1 = ldapservices
                                                .searchCollabo(username
                                                        .getText()
                                                        .toString());

                                        if (c1.getUid().equals("null")) {
                                            Bundle b = new Bundle();
                                            Intent intent = new Intent(
                                                    AuthenticateActivity.this,
                                                    EditProfilActivity.class);
                                            b.putString("uid", uid);
                                            intent.putExtras(b);
                                            startActivity(intent);
                                            progress.dismiss();
                                        } else {

                                            groupItems = new ArrayList<RowItem>();

                                            final LdapServices l = new LdapServices();

                                            List<UserLdap> liste = l
                                                    .getAllusersbyGroup();

                                            List<Collabo> listeusers = l
                                                    .getAllCollabo();

                                            LdapServices ldap = new LdapServices();

                                            List<ImageType> listeimagetype = ldap
                                                    .getmString();

                                            boolean a = false;


                                                    }

                                                }

                                            }

                                            groupItems.clear();
                                            boolean trouve = false;
                                            for (UserLdap u : liste) {
                                                trouve = false;
                                                for (Collabo col : listeusers) {
                                                    for (UserLdap u1 : liste) {
                                                        a = false;
                                                        if (u.getUid()
                                                                .equals(u1
                                                                        .getUid())) {
                                                            if (u.getUid()
                                                                    .toString()
                                                                    .equals(col
                                                                            .getUid()
                                                                            .toString())) {
                                                                trouve = true;


                                                                            groupItems
                                                                                    .add(item);
                                                                        }

                                                                    }

                                                                }

                                                            }

                                                        }

                                                    }

                                                }

                                                a = false;
                                                if (trouve == false) {
                                                    for (ImageType iu : listeimagetype) {
                                                                                                                            groupItems
                                                                        .add(item);
                                                            }


                                                                groupItems
                                                                        .add(item);
                                                            }

                                                        }

                                                    }

                                                }


                                            startActivity(intent);
                                            progress.dismiss();
                                        }
                                    }

                                    catch (Exception e) {

                                    }

                                } else {

                                    runOnUiThread(new Runnable() {
                                        @Override
                                        public void run() {

                                            alert.showAlertDialog(
                                                    AuthenticateActivity.this,
                                                    false);

                                            pass.setText("");
                                            temp = 3;

                                            progress.dismiss();
                                        }
                                    });

                                }
                            } else {

                                runOnUiThread(new Runnable() {
                                    @Override
                                    public void run() {

                                        alert.showAlertDialog(
                                                AuthenticateActivity.this,
                                                "Votre authentification a échoué",
                                                "Veuillez ressaisir votre login CORP et password",
                                                false);

                                        pass.setText("");
                                        temp = 3;

                                        progress.dismiss();

                                    }
                                });
                            }

                        } catch (ClientProtocolException e) {

                        } catch (IOException e) {

                        }
                        test = true;
                    }
                });
                a.start();

0 个答案:

没有答案