本文整理汇总了Java中com.parse.ParseException.USERNAME_TAKEN属性的典型用法代码示例。如果您正苦于以下问题:Java ParseException.USERNAME_TAKEN属性的具体用法?Java ParseException.USERNAME_TAKEN怎么用?Java ParseException.USERNAME_TAKEN使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类com.parse.ParseException
的用法示例。
在下文中一共展示了ParseException.USERNAME_TAKEN属性的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onPostExecute
@Override
protected void onPostExecute(Integer errorCode) {
super.onPostExecute(errorCode);
signUpDialog.dismiss();
if (errorCode == 0){//Registration succeeded! Open home activity!
((MainApplication)getActivity().getApplication()).currentPage=0;
//record successful login
SecurePreferences preferences = new SecurePreferences(getContext(),getString(R.string.pref_login),SecurePreferences.generateDeviceUUID(getContext()),true);
preferences.put(getString(R.string.pref_login_username),emailTxt.getText().toString());
preferences.put(getString(R.string.pref_login_password), passTxt.getText().toString());
Toast.makeText(fragmentContainer.getContext(), R.string.registerSuccessMsg, Toast.LENGTH_SHORT).show();
Intent intent = new Intent(view.getContext(), HomeActivity.class);
startActivity(intent);
getActivity().finish();
}else{
//Something went wrong, display a new dialog explaining what happened
AlertDialog.Builder builder = new AlertDialog.Builder(fragmentContainer.getContext());
builder.setTitle(R.string.app_name);
builder.setPositiveButton(R.string.dialogConfirm, null);
switch (errorCode){
case -1://no internet connection
builder.setMessage(R.string.noNetworkConnectionMsg);
break;
case ParseException.EMAIL_TAKEN:
case ParseException.USERNAME_TAKEN:
builder.setMessage(user.getEmail() + context.getString(R.string.emailAlreadyInUse));
break;
case ParseException.INVALID_EMAIL_ADDRESS:
builder.setMessage("\"" + user.getEmail() + "\"" +
context.getString(R.string.isNotAValidEmail));
break;
default://handles all other parse exceptions
builder.setMessage("Error (" + errorCode + ") ");
break;
}
//build and display alert dialog for the user
AlertDialog errorDialog = builder.create();
errorDialog.show();
}
}