Android : thread exiting with uncaught exception (group=0x40015560) FATAL EXCEPTION: main

on Wednesday, August 13, 2014


I want to create some application that can search a record from database and when I click one of row that will direct me to the other screen to show me some detail of my row that was I clicked before...


but when I try to click one of list, I got this error threadid=1: thread exiting with uncaught exception (group=0x40015560) FATAL EXCEPTION: main


this is the part of my code...



public void cariInfo(){
if(etCari.getText().length() == 0){
//confirm
Toast.makeText(this, "Please, insert the info", Toast.LENGTH_LONG).show();
lvCustomList.setAdapter(null);
jumlah.setText("");
}else{
cari = etCari.getText().toString();
Cursor cursor = dataSource.cariInfo(cari);
adapter = new SimpleCursorAdapter(this, R.layout.kolom, cursor,
new String [] {"server","app","info"},
new int [] {R.id.server,R.id.app,R.id.info});
Cursor cursor2 = dataSource.hitungDataInfo(cari);
cursor2.moveToFirst();
if(adapter.isEmpty()){
Toast.makeText(this, "Data not found", Toast.LENGTH_LONG).show();
lvCustomList.setAdapter(null);
jumlah.setText("");
}else{
lvCustomList.setAdapter(adapter);
jumlah.setText("Jumlah : "+cursor2.getInt(0));
}
etCari.setText("");
}
}

@Override
public boolean onItemLongClick(final AdapterView<?> adapter, View v, int pos, final long id){
//tampilkan alert dialog

final Dialog dialog = new Dialog(this);
dialog.setContentView(R.layout.dialogview);
dialog.setTitle("Choose the action");
dialog.show();

final Prob p = (Prob) lvCustomList.getAdapter().getItem(pos);
viewButton = (Button) dialog.findViewById(R.id.button_view);
canButton = (Button) dialog.findViewById(R.id.button_cancel);

//if view button was click
viewButton.setOnClickListener(
new OnClickListener()
{
@Override
public void onClick(View v){
Toast.makeText(getApplicationContext(),
"you are rock, dude!!!"
, 50).show();
dialog.dismiss();
}
});
canButton.setOnClickListener(
new OnClickListener()
{
@Override
public void onClick(View v){
Toast.makeText(getApplicationContext(),
"you are fu**in rock, dude!!!"
, 50).show();
dialog.dismiss();
}
});
return true;
}


the Logcat:



08-13 11:29:04.795: W/dalvikvm(403): threadid=1: thread exiting with uncaught exception (group=0x40015560)
08-13 11:29:04.795: E/AndroidRuntime(403): FATAL EXCEPTION: main
08-13 11:29:04.795: E/AndroidRuntime(403): java.lang.ClassCastException: android.database.sqlite.SQLiteCursor
08-13 11:29:04.795: E/AndroidRuntime(403): at com.splatter.sispakprs.CariData.onItemLongClick(CariData.java:133)
08-13 11:29:04.795: E/AndroidRuntime(403): at android.widget.AbsListView.performLongPress(AbsListView.java:1869)
08-13 11:29:04.795: E/AndroidRuntime(403): at android.widget.AbsListView.access$600(AbsListView.java:74)
08-13 11:29:04.795: E/AndroidRuntime(403): at android.widget.AbsListView$CheckForLongPress.run(AbsListView.java:1827)
08-13 11:29:04.795: E/AndroidRuntime(403): at android.os.Handler.handleCallback(Handler.java:587)
08-13 11:29:04.795: E/AndroidRuntime(403): at android.os.Handler.dispatchMessage(Handler.java:92)
08-13 11:29:04.795: E/AndroidRuntime(403): at android.os.Looper.loop(Looper.java:123)
08-13 11:29:04.795: E/AndroidRuntime(403): at android.app.ActivityThread.main(ActivityThread.java:3683)
08-13 11:29:04.795: E/AndroidRuntime(403): at java.lang.reflect.Method.invokeNative(Native Method)
08-13 11:29:04.795: E/AndroidRuntime(403): at java.lang.reflect.Method.invoke(Method.java:507)
08-13 11:29:04.795: E/AndroidRuntime(403): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:839)
08-13 11:29:04.795: E/AndroidRuntime(403): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:597)
08-13 11:29:04.795: E/AndroidRuntime(403): at dalvik.system.NativeStart.main(Native Method)
08-13 11:29:10.386: I/Process(403): Sending signal. PID: 403 SIG: 9


any help will be pleasure :)


0 comments:

Post a Comment