当前位置: 首页>>代码示例>>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;未经允许,请勿转载。