Android : onbackpressed of my listactvity this error occur,

on Thursday, October 30, 2014


/*error


java.lang.RuntimeException: Failure delivering result ResultInfo{who=null, request=1, result=0, data=null} to activity {com.example.mydatabaseapp/com.example.mydatabaseapp.CashRecieved}: java.lang.NullPointerException8"/


//onabackpressed function


public boolean onKeyDown(int keyCode, KeyEvent event) { // TODO Auto-generated method stub



if(keyCode==KeyEvent.KEYCODE_BACK){
new AlertDialog.Builder(ShowSAVED.this).setTitle(
"Attention").setMessage(
"Want to exit ?")
.setPositiveButton("YES",
new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog,
int which) {
finish();
}
}).setNegativeButton("NO",
new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog,
int which) {

}
}).show();
return true;
}else{
return false;
}

//return super.onKeyDown(keyCode, event);

}

0 comments:

Post a Comment