I have a String imagepath which has path of the selected image. If user selects image i have to upload it on sever. I want to check wheter imagepath is null. I have tried this but it give NullPointerException.
This is my code.
public String imagepath = null;
public String imagepath1 = null;
and I am checking if it is null as:
   Log.e("imagepath",""+imagepath);
            Log.e("imagepath1", ""+imagepath1);
            if (imagepath.equals(null)){
                Log.e("no image path","dfdsfdsfdsfdsfdf");
            }
            else {
                uploadFile(imagepath);
            }
            if (imagepath1.equals(null)){
                Log.e("no imagepath1 path","imagepath1");
            }
            else {
                uploadFile2(imagepath);
            }
If I do not select any image, it shows NullPointerException. Please help me. What is wrong here.
 
     
     
     
    