java.lang.NullPointerException: Attempt to invoke virtual method 'android.view.View .MainActivity.findViewById(int)' on a null object reference

后端 未结 4 827
青春惊慌失措
青春惊慌失措 2020-12-17 20:25

I have a class called MainActivity.java that call an AsyncTask class. The last class have a findViewById() that in execution retur

4条回答
  •  无人及你
    2020-12-17 20:48

    You did not specify what parameter you pass to Connection.java AsyncTask.

    One of my student is also having same problem. Although he is using Volley Library for HttpConnection (posting data) and main issue was: he is writing URL directly without the http protocol prefix i.e.

    String post_url ="api/do_post";

    Simply add http/https at front of your post url:

    String post_url ="http://api/do_post";

提交回复
热议问题