How to get list of *.jpg files on server? - android

I'm trying to find simplest solution to make app where I can download all the images from the specifed, hardcoded directory.
So far, my idea is to get list of all .jpg images (since it will be the only image format in this directory) and put it in places on ViewPager so each image will be on seperate page.
Anyone has nice snippet or friendly library to use to make it happen?

You can create a txt file on the server in which the URLs of all images will be kept; then program your app to download this file first; then use input stream to read the URLs from the file and create a loop to download all urls until they finish, by checking if the input is null.
On server side either add the urls manually to the file or write a JavaScript to automatically write the URLs when uploading the image.

Related

Displaying images from dataDirectory in ionic2

I'm working on an app, using ionic2.
I'm storing a set of images that I downloaded from the server in the dataDirectory to save mobile traffic when the app is used without wi-fi.
Now, I would like to display them inside my template.
Is there a recommended way how the image should best be inserted?
I tried giving the ion-img or img-tag
the complete path (file.dataDirectory + “myImg.jpg” -> "file:///data/user/0/io.ionic.starter/files/myImg.jpg”
(stored in my imgPath variable, the path is written after the platform.ready event), but only a broken image symbol is shown. When accessing images from my assets folder I do not encounter any problems, but how can I access the dataDirectory’s images?
<img width=“200” height=“200” [src]=“imgPath” *ngIf=“imgPath”>
Or do I have to read each image from the dataDirectory and store them in a local variable as a base64 string?
There are many reason for showing broken image in IONIC.
If you are using live reload then sometime images are shown as broken image. You can run directly to see if it resolves your issue.
If you want to use base64 image, either you can save it SQLite or in local variable which may resolve your issue.

how to display .jpg image in android?

I am using .net web services and I am having list of folders and files. I am successful in retrieving list of files(.jpg Image, .pdf, .TIF) but can anybody let me know how we can open .jpg, .pdf, .tif or other files format which I am getting from web services. Is there any specific code to open particular format or we can use path (/) to open that particular file?
Thanks.
if you need to download and display an image, check my answer on this post, that is probably what you are looking for. Common extensions for displaying images in Android are .png and .jpeg, you will not be able to show a .pdf file using an ImageView. You can also use the method mentioned in my answer inside an AsyncTask to perform the download in background and then update your UI thread

How to create html files with incoming data from a server in Android?

I want to know if it is possible to create a html file as a background process while showing a temporary html file on screen. After downloading necessary files from server and creating/generating the new html file, i want to know how to put that newly created file into view? I am currently working on creating a html file but couldn't find a way to do it.
To be more clear, what I am trying to make is an app which will communicate with a server and get some media objects from it. (e.g text,rss feed, movies, images ..) That app will be the client side of server. It will serve as a digital signage application. However i couldn't figure out how to represent layouts with android. I don't know if it is possible to make it but what is on my mind is making a html file for each layout and show it through WebView.
Any idea or suggestion will be so helpful.

How to avoid downloading xml in android and directly open it in url

I have a url which directly downloads .pl file as xml on passing latitude and longitude within url. Now I have to first dowload it and then extract data from XML. However, i guess again and again downloading will not be a gud solution as it will make app slower. Hence, I was thinking is there a way where i can avoid downloading and make that xml directly open in browser and then parse it using SAX parser. Can I store it some variable or something similar and then can parse it?
Thanks
Astha
You need to download the data, which means retrieve the information from a distant server. What you could achieve is to try reading the file as you download it instead of downloading (ie saving in a temp file) then reading it.
It's the same idea as watching a streaming video (youtube ...) instead of downloading then watching a video.
I have no idea though on how to read directly a stream being downloaded.

Android: How to get file list from url

I want to list files from url. For example, there are some jpeg files inside http://www.example.com/jpegfile/ that i want to list these files on my android app.
I know how to list files inside the phone, but i dont know how to list from url.
thank!!!
Well, before you can list your files from URL, you need to download them. Check this link, it will help you properly download your images, then you'll have to just show them where you want.
Multithreading for Performance

Categories

Resources