0

I'm new to java programming so I apologize for the possibly incorrect wording of the question. I have a boolean function updateEntryDB that should return false if the response from my database is "Error" and true if it is "Success". How do I get the boolean response from the @override method OnSuccessBool, so that my updateEntryDB function will return the proper response? Thanks for any help.

 private boolean updateEntryDB(final String tag)
{
    //Log.i(TAG, "updateEntryDB");
    String np = numPlate.getText().toString();
    dbWork dbWork = new dbWork();

    dbWork.updateEntryTime(tag, np, requestQueue, new dbWork.VolleyCallback() {
        @Override
        public void onSuccess(String result) {
        }
        @Override
        public boolean onSuccessBool(String result) {
            String dbResponse = result;
            test.setText(dbResponse);

            String[] errSucc = dbResponse.split(":");
            if(errSucc[0].equals("Error"))
            {
                return false;
            }
            else if(errSucc[0].equals("Success"))
            {
                return true;
            }

            return false;
        }

    });
}
Mi-Creativity
  • 9,554
  • 10
  • 38
  • 47
rejy11
  • 742
  • 2
  • 12
  • 25
  • what is the error you are facing? – Naman Feb 20 '16 at 16:03
  • Your code shows that you're already doing that. Please elaborate what you really want to achieve with your method, or at least say what errors you're getting in order to get help. – Patrick W Feb 20 '16 at 16:04
  • Sorry, am new to android and java so finding it hard to word things.. Im calling the updateEntryDB function from somewhere else in my program and want it to either return true or false based upon the if statements inside onSuccessBool. So if onSuccessBool returns false, I want updateEntryDB to return false as well, and vice versa – rejy11 Feb 20 '16 at 16:16
  • 1
    It looks like you're having trouble understanding how multi-threading works, read this: http://stackoverflow.com/questions/9458258/return-value-from-async-task-in-android – Daniel Nugent Feb 20 '16 at 16:36

0 Answers0