1Answer
  • 15
name

A PHP Error was encountered

Severity: Notice

Message: Undefined index: userid

Filename: views/question.php

Line Number: 191

Backtrace:

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

name Punditsdkoslkdosdkoskdo

Variable that is never used

I have this block of code where my app, supposedly, when the user inserts a right password and a right email, goes to the main activity, although when I used the run method, it says that the variable is never used.

@Override
protected void onPostExecute(final Boolean success) {
    mAuthTask = null;
    showProgress(false);

    if (success) {
         public void run() {
            startActivity(new Intent(getBaseContext(), Second.class));
            finish();
        }
        finish();
    } else {
        mPasswordView.setError(getString(R.string.error_incorrect_password));
        mPasswordView.requestFocus();
    }
}
      • 2
    • mAuthTask is used right here: mAuthTask = null. I assume it's a member variable, so that seems perfectly reasonable. The question remains, which variable is never used? I see nothing declared but unused, so it's likely we're not looking at actual code. A secondary question: what is the "it" that says the variable is never used?

It is because you have incorrect code in your method. Take a look at the following code:

@Override
protected void onPostExecute(final Boolean success) {
    ...

    if (success) {
         public void run() {
            ...
        }
        finish();
    } else {
       ...
    }
}

You have a block of method named run() which is incorrect. So, you need to remove it. Your code should be something like this then:

@Override
protected void onPostExecute(final Boolean success) {
    mAuthTask = null;
    showProgress(false);

    if (success) {
        startActivity(new Intent(getBaseContext(), Second.class));
        finish();
    } else {
        mPasswordView.setError(getString(R.string.error_incorrect_password));
        mPasswordView.requestFocus();
    }
}
  • 1
Reply Report