lvchartid.setOnItemClickListener(new OnItemClickListener() {
@Override
public void onItemClick(AdapterView<> parent, View view, int position,long id) {
final String item = ((TextView)view).getText().toString();
new Thread(new Runnable() {
@Override
public void run() {
try {
WebConnectionHelper con = new WebConnectionHelper("PatientChartGynologicalHistroySelect");
con.Addparameter("accountno", "10011065");
con.Addparameter("chartid", item);
con.intiateConnection(Checkcharts.this);
result = con.GetOutPut();
if (result == null) {
Log.e("Search result", "null");
} else
Log.e("Search result", result.toString());
} catch (Exception e) {
e.printStackTrace();
Log.e("Error search", e.toString());
}
if (result == null) {
return;
}
try{
SoapObject tempobj = (SoapObject)result.getProperty(0);
result = (SoapObject) tempobj.getProperty(1);
chartspatient = new ArrayList<getset_chartspatient>();
SoapObject property = (SoapObject) result.getProperty(0);
for (int i = 0; i < property.getPropertyCount(); i++)
{
SoapObject category_list = (SoapObject) property.getProperty(i);
Log.e("Result", category_list.toString());
getset_patientsinglechart chartssingle = new getset_patientsinglechart();
chartssingle.setPATIENT_GYNECOLOGIC_HISTORY_ID(category_list.getPropertySafelyAsString("PATIENT_GYNECOLOGIC_HISTORY_ID","").toString());
chartssingle.setCURRENTLY_SEXUALLY_ACTIVE(category_list.getPropertySafelyAsString("CURRENTLY_SEXUALLY_ACTIVE","").toString());
chartssingle.setAGE_FIRST_SEXUAL_INTERCOURSE(category_list.getPropertySafelyAsString("AGE_FIRST_SEXUAL_INTERCOURSE","").toString());
chartssingle.setSEXUAL_PROBLEMS(category_list.getPropertySafelyAsString("SEXUAL_PROBLEMS","").toString());
chartssingle.setCONTRACEPTION(category_list.getPropertySafelyAsString("CONTRACEPTION","").toString());
chartssingle.setMENOPAUSE(category_list.getPropertySafelyAsString("MENOPAUSE","").toString());
chartssingle.setFIRST_MENARCHE_AGE(category_list.getPropertySafelyAsString("FIRST_MENARCHE_AGE","").toString());
chartssingle.setLNMP(category_list.getPropertySafelyAsString("LNMP","").toString());
chartssingle.setMENARCHE_CYCLE(category_list.getPropertySafelyAsString("MENARCHE_CYCLE","").toString());
chartssingle.setMENARCHE_FLOW(category_list.getPropertySafelyAsString("MENARCHE_FLOW","").toString());
chartssingle.setFREQUENCY(category_list.getPropertySafelyAsString("FREQUENCY","").toString());
chartssingle.setGRAVIDA(category_list.getPropertySafelyAsString("GRAVIDA","").toString());
chartssingle.setPARA(category_list.getPropertySafelyAsString("PARA","").toString());
chartssingle.setABORTIONS(category_list.getPropertySafelyAsString("ABORTIONS","").toString());
chartssingle.setPregnant(category_list.getPropertySafelyAsString("Pregnant","").toString());
chartssingle.setEDD(category_list.getPropertySafelyAsString("EDD","").toString());
singlecharts.add(chartssingle);
// Log.d("Data",""+chartssingle.toString());
}
//the data not adding to the data holder class here
DataHolder.singlechartsofpatient = singlecharts;
// Intent intent = new Intent(Checkcharts.this,Checkcharts.class);
//intent.putExtra("extra_text", item);
// startActivity(intent);
}
//here is the exception
catch (Exception e) {
// TODO: handle exception
}
runOnUiThread(new Runnable() {
@Override
public void run() {
// TODO Auto-generated method stub
}
});
}
}).start();
}
});
答案 0 :(得分:0)
logcat中没有异常,因为默认情况下logcat只显示 uncaught 异常。如果您捕获异常(正如您所做的那样),那么异常永远不会传播到logcat正在侦听的程序的顶层。
如果您希望在捕获之后将异常记录到logcat,则可以执行以下操作:
try {
//raise new Exception("ERROR!!")
} catch (Exception e) {
//Log to logcat:
Log.d("My exception", e.getMessage(), e);
}
作为旁注,你绝不应该仅仅追踪Exception
来做一个通用的“全能”。尝试更具体地说明您要捕获的异常,以便您知道正在正确处理该特定情况。