如何获取本地JSON文件中的数据?文件、数据、JSON

由网友(柠檬不该羡慕西瓜的甜)分享简介:我在本地创建的JSON文件。我可以查看数据>数据> com.example.storage>文件> filename.json。使用这个我想在本地及放取所有的文本值;下载所有图像,并将其保存在SD卡上的图片网址这是在JSON文件中。而在离线本身,我可以从SD卡中加载从JSON文件,以及图像中的所有文本值。 I cre...

我在本地创建的JSON文件。我可以查看数据>数据> com.example.storage>文件> filename.json。使用这个我想在本地及放取所有的文本值;下载所有图像,并将其保存在SD卡上的图片网址这是在JSON文件中。而在离线本身,我可以从SD卡中加载从JSON文件,以及图像中的所有文本值。

I created json file locally. I can view that in data>data>com.example.storage>files>filename.json. Using this I want to fetch all the text values locally & download all images and save it in SD card from Image URL which is available in json file. And in offline Itself I can load all the text values from json file as well as images from SD card.

请让我知道这个想法会锻炼与否。如果没有,请建议一些其他的方式来做到这一点。

Please let me know this idea will workout or not. If not Please suggest some other way to do this.

任务是使用本地JSON文件我想获取的数据。如何做到这一点?(我是用单独的ID为每个数据)。

Task is using local json file I want to fetch data. How to do that?(I an using seperate ID for each data).

样品JSON文件.. {的ImageData:[{ImageId:12,ImageName:IMG1,ImageDesc:IMG1 Img1Img1,的ImageUrl:img_url / pro1.jpg},{ImageId: 13,ImageName:Img13,ImageDesc:Img13 Img13 Img13Img13,的ImageUrl:img_url / pro2.jpg},{ImageId:14,ImageName:Img14 ,ImageDesc:Img14 Img14 Img14 Img14 Img14,的ImageUrl:img_url / pro3.jpg.jpg},]}

Sample JSON file is.. {"ImageData":[{"ImageId":"12","ImageName":"Img1","ImageDesc":"Img1 Img1Img1 ","ImageUrl":"img_url/pro1.jpg"},{"ImageId":"13","ImageName":"Img13","ImageDesc":"Img13 Img13 Img13Img13 ","ImageUrl":"img_url/pro2.jpg"},{"ImageId":"14","ImageName":"Img14","ImageDesc":"Img14 Img14 Img14 Img14 Img14 ","ImageUrl":"img_url/pro3.jpg.jpg"},]}

推荐答案

是的,这是可能的。下一次提供一些code所以我们有东西,没有太多人能做到的,解决这一问题的工作。

Yes, it is possible. Next time provide some code so we have something to work with, there is not much people can do to solve this issue.

为您开始看​​这个教程的JSON: http://www.vogella.com/tutorials/AndroidJSON/article.html

To get you started look at this tutorial about JSON: http://www.vogella.com/tutorials/AndroidJSON/article.html

这个问题将有助于你在本地读取文件: 我如何读取Android的一个文本文件?

This question will help you read a file locally: How can I read a text file in Android?

当你得到了文件作为字符串,您可以创建一个的JSONObject 并解析URL和检索图像。

When you got the file as a string you can create a JSONObject and parse the URLs and retrieve the images.

阅读全文

相关推荐

最新文章