IllegalStateException: Content has been consumed

前端 未结 4 2049
你的背包
你的背包 2020-12-08 10:17

I got struck because of IllegalStateException in the following code. Can anybody please help me? Code:

import java.io.BufferedReader;
import jav         


        
4条回答
  •  鱼传尺愫
    2020-12-08 10:46

    First, this has to be a mistake that every single new android programmer makes and it's asked here every single day. You have

    user.getText().toString()!= ""&& pw.getText().toString()!= ""
    

    This doesn't do what you want it to. You need

     !user.getText().toString().equals("")&& !pw.getText().toString().equals("")
    

    Also, you need to print the stacktrace. In your exception, you need

    e.printStackTrace()
    

    instead of logging

    e.toString()
    

提交回复
热议问题