• 5

A PHP Error was encountered

Severity: Notice

Message: Undefined index: userid

Filename: views/question.php

Line Number: 191


File: /home/prodcxja/public_html/questions/application/views/question.php
Line: 191
Function: _error_handler

File: /home/prodcxja/public_html/questions/application/controllers/Questions.php
Line: 433
Function: view

File: /home/prodcxja/public_html/questions/index.php
Line: 315
Function: require_once

i am getting error while using OnCompleteListerner in Java 8 SE Anonymous new OnCompleteListener() can be replaced with lambda less... (Ctrl+F1) Inspection info: This inspection reports all anonymous classes which can be replaced with lambda expressions Lambda syntax is not supported under Java 1.7 or earlier JVMs.

            mAuth.createUserWithEmailAndPassword(email1, pass ).addOnCompleteListener(new OnCompleteListener<AuthResult>() {
                public void onComplete(@NonNull Task<AuthResult> task) {
                    if (task.isSuccessful())
                        String uid= currentuser.getUid();
                        HashMap<String, String> userMap= new HashMap<>();
                        userMap.put("image_url", profileimageUrl);

                        Log.e("DB Called","DatabaseCalled");
                        secondaryDB.setValue(userMap).addOnCompleteListener(new OnCompleteListener<Void>() {
                            public void onComplete(@NonNull Task<Void> task) {

                                if (task.isSuccessful())

      • 2
    • That isn't an error, its a warning. Feel free to ignore it- there's nothing wrong with using lambdas, but it has no practical advantage to switching if you have already written code.

Here's the lambda style

.createUserWithEmailAndPassword(email, pass)
.addOnCompleteListener(task -> {
    if (!task.isSuccessful()) {
        //error message
        //success message

Additionally, you can put the cursor over the grayed area saying it can be replaced by lambda and press ALT+Enter, a prompt will appear, select Replace with lambda

  • 1
Reply Report

As Lambda is introduce in Java 8. Make sure you have installed Java 8 and above JDK Version. Lambda expression for "createUserWithEmailAndPassword" :

mAuth.createUserWithEmailAndPassword(emailId, password)
                    .addOnCompleteListener(OnCompleteListener { task ->
                        if (task.isSuccessful) {

  • 0
Reply Report