您好,再次感谢您的回答,但这不是我想要的
这是我单击按钮时出现的错误
45.266:I/Process(442):发送信号。PID:442 SIG:9
这是按钮点击的代码
public void onClick(View v) {
gps = new NetworkSettings();
Log.d("error on click ", "here is the error in the onclick method ");
if(isGPSEnabled)
{
// Log.d("error on click ", "here is the error in the if statement ");
Intent intent = new Intent(this, AndroidGoogleMapsActivity.class);
mContext.startActivity(intent);
}
Log.d("error on click ", "here is the error out the if statement ");
gps.showSettingsAlert();
}
这是 showSettingsAlert() 方法
public void showSettingsAlert() { alertDialog = new AlertDialog.Builder(mContext);
Log.d("error on click ", "here is the error inthe top of the method ");
// Setting Dialog Title
alertDialog.setTitle("GPS is settings");
// Setting Dialog Message
alertDialog
.setMessage("GPS is not enabled. Do you want to go to settings menu?");
// On pressing Settings button
alertDialog.setPositiveButton("Settings",
new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int which) {
Intent intent = new Intent(
Settings.ACTION_LOCATION_SOURCE_SETTINGS);
mContext.startActivity(intent);
}
});
// on pressing cancel button
alertDialog.setNegativeButton("Cancel",
new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int which) {
dialog.cancel();
}
});
// Showing Alert Message
alertDialog.show();
}
我知道错误出现在单击按钮中,但我不知道它是什么以及如何修复它,所以请帮助我