在Parse注册上获取NullPointerException?

时间:2015-11-19 19:20:17

标签: android parse-platform nullpointerexception

这是我的注册方法:

{ [Error: /Path/To/My/Application/app.js: Unexpected token: punc ())]
message: '/Path/To/My/Application/app.js: Unexpected token: punc ())',
        fileName: '/Path/To/My/Application/app.js',
        lineNumber: 41,
        stack: 'Error\n    at new JS_Parse_Error (eval at <anonymous> (/Path/To/My/Application/node_modules/gulp-uglify/node_modules/uglify-js/tools/node.js:24:4), <anonymous>:1526:18)\n    at js_error (eval at <anonymous> (/Path/To/My/Application/node_modules/gulp-uglify/node_modules/uglify-js/tools/node.js:24:4), <anonymous>:1534:11)\n    at croak (eval at <anonymous> (/Path/To/My/Application/node_modules/gulp-uglify/node_modules/uglify-js/tools/node.js:24:4), <anonymous>:2025:9)\n    at token_error (eval at <anonymous> (/Path/To/My/Application/node_modules/gulp-uglify/node_modules/uglify-js/tools/node.js:24:4), <anonymous>:2033:9)\n    at unexpected (eval at <anonymous> (/Path/To/My/Application/node_modules/gulp-uglify/node_modules/uglify-js/tools/node.js:24:4), <anonymous>:2039:9)\n    at expr_atom (eval at <anonymous> (/Path/To/My/Application/node_modules/gulp-uglify/node_modules/uglify-js/tools/node.js:24:4), <anonymous>:2534:13)\n    at maybe_unary (eval at <anonymous> (/Path/To/My/Application/node_modules/gulp-uglify/node_modules/uglify-js/tools/node.js:24:4), <anonymous>:2708:19)\n    at expr_ops (eval at <anonymous> (/Path/To/My/Application/node_modules/gulp-uglify/node_modules/uglify-js/tools/node.js:24:4), <anonymous>:2743:24)\n    at maybe_conditional (eval at <anonymous> (/Path/To/My/Application/node_modules/gulp-uglify/node_modules/uglify-js/tools/node.js:24:4), <anonymous>:2748:20)\n    at maybe_assign (eval at <anonymous> (/Path/To/My/Application/node_modules/gulp-uglify/node_modules/uglify-js/tools/node.js:24:4), <anonymous>:2772:20)',
        showStack: false,
        showProperties: true,
        plugin: 'gulp-uglify' }

我已经尝试过评论if语句,但是没有好处。我知道nullpoinerexception的含义,但我无法找到错误的位置。 在添加一些if语句之前它正在工作,然后发生了错误。所以我删除了它们仍然无法正常工作! logcat的:

    public void signUp(View v) {
         String firstNameString = FirstName.getText().toString();
         String familyNameString = LastName.getText().toString();
         String emailString = email.getText().toString();
         String passwordString = password.getText().toString();

//        final String passwordConfirmString = passwordConfirm.getText().toString();
//    if( passwordConfirmString != passwordString){
//        Toast passwordsDoNotMatch = Toast.makeText(getApplicationContext(),"Passwords do not match",Toast.LENGTH_SHORT);
//        passwordsDoNotMatch.show();
//    }

         ParseUser user = new ParseUser();
//        if (firstNameString.length() < 2 && firstNameString.isEmpty()) {
//            FNTooShort.setVisibility(View.VISIBLE);
//        }
//        if (familyNameString.length()<2){
//            FANTooShort.setVisibility(View.VISIBLE);
//        }
//        if (firstNameString ==null){
//            FNEmpty.setVisibility(View.VISIBLE);
//        }
//        if (familyNameString==null){
//            FANEmpty.setVisibility(View.VISIBLE);
//        }
//        if(passwordString==null){
//            PSempty.setVisibility(View.VISIBLE);
//        }
//        if(passwordString.length()<8){
//            PSempty.setVisibility(View.VISIBLE);
//        }
//        else {
            user.setUsername(firstNameString + familyNameString);
            user.setEmail(emailString);
            user.setPassword(passwordString);
            user.signUpInBackground(new SignUpCallback() {
                public void done(ParseException e) {
                    if (e == null) {
                        Context context = getApplicationContext();
                        CharSequence success = "Sign up Successfull";
                        int duration = Toast.LENGTH_SHORT;

                        Toast successfullTostConformation = Toast.makeText(context, success, duration);
                        successfullTostConformation.show();
//                        String userIDString = user.getObjectId().toString();
//                        editor.putString("user_id", userIDString);
//                        editor.putString("username", firstNameString + " " + familyNameString);
//                        editor.putString("password", passwordString);
//                        editor.putString("email", emailString);
//                        editor.commit();
                        Intent startLogin = new Intent(SignUpActivity.this, LoginActivity.class);
                        SignUpActivity.this.startActivity(startLogin);

                    } else {
//                    There was an error making the user

                    }
                }
            });
//        }
    }

0 个答案:

没有答案