當前位置: 首頁>>代碼示例>>Java>>正文


Java ParseException.USERNAME_TAKEN屬性代碼示例

本文整理匯總了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();
    }
}
 
開發者ID:stuartsoft,項目名稱:PingIT,代碼行數:45,代碼來源:RegisterFragment.java


注:本文中的com.parse.ParseException.USERNAME_TAKEN屬性示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。