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


Java ParseException.getCode方法代碼示例

本文整理匯總了Java中com.parse.ParseException.getCode方法的典型用法代碼示例。如果您正苦於以下問題:Java ParseException.getCode方法的具體用法?Java ParseException.getCode怎麽用?Java ParseException.getCode使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在com.parse.ParseException的用法示例。


在下文中一共展示了ParseException.getCode方法的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: doInBackground

import com.parse.ParseException; //導入方法依賴的package包/類
@Override
protected Integer doInBackground(String... params) {
    if (!mNetworkCallback.checkNetworkStatus()){
        return -1;
    }
    try { //Query Parse for the user's pings
        ParseQuery<ParseObject> query = ParseQuery.getQuery("Pings");
        query.whereEqualTo("User", user);
        query.orderByDescending("createdAt");
        pingsList = query.find();
    } catch (ParseException e) {return e.getCode();}//return exception code
    return 0;//no issues
}
 
開發者ID:stuartsoft,項目名稱:PingIT,代碼行數:14,代碼來源:PingsPageFragment.java

示例2: doInBackground

import com.parse.ParseException; //導入方法依賴的package包/類
@Override
protected Integer doInBackground(String... params) {
    if (!mCallback.checkNetworkStatus())
        return -1;//no internet, couldn't even attempt to login

    ParseUser.logOut();//make sure the user is logged out first

    try {
        user.signUp();
        ParseInstallation installation = ParseInstallation.getCurrentInstallation();
        installation.put("user",ParseUser.getCurrentUser());
        installation.saveInBackground();
    } catch (ParseException e) {return e.getCode();}//return exception code
    return 0;//no issues
}
 
開發者ID:stuartsoft,項目名稱:PingIT,代碼行數:16,代碼來源:RegisterFragment.java

示例3: doInBackground

import com.parse.ParseException; //導入方法依賴的package包/類
@Override
protected Integer doInBackground(String... params) {
    if (!mCallback.checkNetworkStatus())
        return -1;//no internet, couldn't even attempt to login

    ParseUser.logOut();//make sure the user is logged out first

    try {
        ParseUser.logIn(email,pass);
        ParseInstallation installation = ParseInstallation.getCurrentInstallation();
        installation.put("user",ParseUser.getCurrentUser());
        installation.saveInBackground();
    } catch (ParseException e) {return e.getCode();}//return exception code
    return 0;//no issues
}
 
開發者ID:stuartsoft,項目名稱:PingIT,代碼行數:16,代碼來源:LoginFragment.java

示例4: doInBackground

import com.parse.ParseException; //導入方法依賴的package包/類
@Override
protected Integer doInBackground(String... params) {
    try { //Query Parse for the user's pings
        ParseQuery<ParseObject> query = ParseQuery.getQuery("FAQ_Category");
        categoryList = new ArrayList<ParseObject>(query.find());
        for (ParseObject category: categoryList) {
            ArrayList<ParseObject> questionQuery = new ArrayList<ParseObject>(category.getRelation("Questions").getQuery().find());
            //Filler
            questionsList.add(questionQuery);
        }
    } catch (ParseException e) {return e.getCode();}//return exception code
    return 0;//no issues
}
 
開發者ID:stuartsoft,項目名稱:PingIT,代碼行數:14,代碼來源:FAQPageFragment.java

示例5: onSnackListUpdateComplete

import com.parse.ParseException; //導入方法依賴的package包/類
@Override
public void onSnackListUpdateComplete(ParseException e) {
    // Start the login activity if the session token is invalid.
    if(e != null && e.getCode() == ParseException.INVALID_SESSION_TOKEN){
        if(myActivity != null){
            Intent startLoginIntent = new Intent(myActivity, LoginActivity.class);
            ParseUser.logOutInBackground();
            myActivity.finish();
            startActivity(startLoginIntent);
        }
    }

    adapter.notifyDataSetChanged();

    if(progressOverlay != null){
        progressOverlay.setVisibility(View.GONE);
    }

    // Show the help message if appropriate.
    // That is, if we haven't already showed it for the current user this session and the
    // current user has zero entries. Only show the help message if the SnackList is pointing
    // at the current user.
    if(lastShowedHelpFor != ParseUser.getCurrentUser()
            && !showingHelp && SnackList.getInstance().size() == 0
            && ParseUser.getCurrentUser().equals(SnackList.getInstance().getUser())){
        try{
            showHelpMessage();
        } catch(IllegalStateException ignored){
            // In the case that onSaveInstanceState has been already been called, we ignore
            // the exception.
        }
    }
}
 
開發者ID:SCCapstone,項目名稱:diet,代碼行數:34,代碼來源:PreviousEntriesFragment.java

示例6: getErrorMessage

import com.parse.ParseException; //導入方法依賴的package包/類
/**
 * Tries to determine a friendly error message to display to the user, given a ParseException.
 *
 * @param e The exception.
 */
public static String getErrorMessage(ParseException e){
    if(e != null){
        switch(e.getCode()){
            case CONNECTION_FAILED:
                return "Connection failed";
            case USERNAME_MISSING:
                return "Username is missing";
            case PASSWORD_MISSING:
                return "Password is missing";
            case EMAIL_MISSING:
                return "Email is missing";
            case USERNAME_TAKEN:
                return "Username is taken";
            case EMAIL_TAKEN:
                return "Email is taken";
            case TIMEOUT:
                return "Request timed out";

            default:
                // If the default exception message isn't null, return it.
                String exceptionMessage = e.getMessage();
                if(exceptionMessage != null){
                    return exceptionMessage;
                }

                // Otherwise, check the cause's message
                else{
                    Throwable cause;
                    String causeMessage;

                    cause = e.getCause();

                    // If the cause isn't null, get its message. Otherwise, set causeMessage to null
                    causeMessage = (cause == null) ? null : cause.getMessage();

                    // If the cause message isn't null, return it.
                    // Otherwise, just return the exception's error code.
                    if(causeMessage != null){
                        return String.format("%s (%d)", causeMessage, e.getCode());
                    } else{
                        return String.format("Error (%d)", e.getCode());
                    }
                }
        }
    } else{
        return "No error";
    }
}
 
開發者ID:SCCapstone,項目名稱:diet,代碼行數:54,代碼來源:Utils.java


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