-1

I have an app in which i am getting error "Attempt to invoke virtual method 'boolean java.lang.String.equalsIgnoreCase(java.lang.String)" please explain meaning and solution for that

code:-

 String receivedResult = parseJsonResultSetFav(result);
            if (receivedResult.equalsIgnoreCase("SUCCESS")) {
                CustomerTicketDialogClass ctdc = new CustomerTicketDialogClass(getActivity(),
                        "successful", "successfully sent mail to your email id ", "ViewDetails");
                ctdc.show();
                ctdc.setCanceledOnTouchOutside(false);
            } else {
                CustomerTicketDialogClass ctdc = new CustomerTicketDialogClass(getActivity(),
                        "failure", receivedResult, "ViewDetails");
                ctdc.show();
                ctdc.setCanceledOnTouchOutside(false);
            }
Niraj
  • 27
  • 1
  • 4

1 Answers1

0

Yes, you are getting NullPointerException, so to in order to avoid this..

if(receivedResut != null && receivedResult.equalsIngnoreCase("SUCCESS"))
Sakura Fukuyoshi
  • 1,461
  • 1
  • 10
  • 14
  • can you explain littel why this was happened – Niraj Sep 01 '17 at 06:16
  • you can check it from here.. https://stackoverflow.com/questions/27895108/nullpointerexception-attempt-to-invoke-virtual-method-boolean-java-lang-string – Sakura Fukuyoshi Sep 01 '17 at 06:22
  • have you tried to log first the value of receivedResult? Then if it is null.. check why it is happening. I guess you can check it in your parseJsonResultSetFav method because it is the one returning the result for receivedResult – Sakura Fukuyoshi Sep 01 '17 at 06:25