I need to create a local server which would be able to serve local files of device. I have found this library and it seems like it able to satisfy my needs.
I have tried sample inside this project and it works fine! But it posts .html page and I need pictures.
I was following this post where .mp3 was served. But that doesn't work for me. Probably that's because library was updated from that time.
@Override
public Response serve(IHTTPSession session) {
    FileInputStream fis = null;
    try {
        File file = new File(Environment.getExternalStoragePublicDirectory(ROOT)
                + PATH + "picture.jpg"); //path exists and its correct
        fis = new FileInputStream(file);
    } catch (FileNotFoundException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    }
    return new NanoHTTPD.Response(Response.Status.OK, "image/jpeg", fis, 1000000); //the last parameter is totalBytes. Not sure what to put there
}
Server is started in onCreate:
//start web server
    try {
        server = new WebServer();
        server.start();
    } catch (IOException e) {
        e.printStackTrace();
    }
The aim is to access files like that: 192.168.1.2:8080/picture.jpg
Can anyone suggest solution? Thanks in advance.
                        
So I have downloaded previous version of NanoHttpd and that worked for me. Probably developers changed the behaviour somehow in new version. I didn't have time to dig inside the problem.
This worked for me.
This is not actually a correct answer since it doesn't solve problem with new version.