Notice
Recent Posts
Recent Comments
Link
«   2024/05   »
1 2 3 4
5 6 7 8 9 10 11
12 13 14 15 16 17 18
19 20 21 22 23 24 25
26 27 28 29 30 31
Archives
Today
Total
관리 메뉴

개발새발 블로그

저장된 Json 데이터 읽기 본문

android

저장된 Json 데이터 읽기

SeanBlog 2019. 12. 11. 14:52
public String loadJSONFromAsset() {
        String json = null;
        try {
 
            InputStream is = getAssets().open("파일명.json");
            int size = is.available();
            byte[] buffer = new byte[size];
            is.read(buffer);
            is.close();
            json = new String(buffer, "UTF-8");
 
        } catch (IOException ex) {
            ex.printStackTrace();
            return null;
        }
        return json;
 
    }
 
 
JSONObject obj = new JSONObject(json_return_by_the_function); 
//JSONObject를 파싱하여 원하는 대로 리스트에 그려주면 됩니다.
Comments