final JSONObject jsonobj;
try {
jsonobj = new JSONObject();
jsonobj.put("latitude", fetLatitude);
jsonobj.put("longitude", fetLongitude);
final String message;
final String name = fetPlaceName;
final String placeID = fetPlaceID;
if (edittxtMessageBox != null){
message = edittxtMessageBox.getText().toString();
} else {
message = "I am at: " + fetPlaceName + " using MyAppName";
}
new AlertDialog.Builder(this).setTitle(R.string.check_in_title)
.setMessage(String.format(this.getString(R.string.check_in_at), name))
.setPositiveButton(R.string.checkin, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
Bundle params = new Bundle();
params.putString("place", placeID);
params.putString("message", message);
params.putString("coordinates", jsonobj.toString());
Utility.mAsyncRunner.request("me/checkins", params, "POST",
new placesCheckInListener(), null);
}
}).setNegativeButton(R.string.cancel, null).show();
} catch (Exception e) {
e.printStackTrace();
}