Android Context Get cacheJson(Context context, URI uri, String jsonSource)

Here you can find the source of cacheJson(Context context, URI uri, String jsonSource)

Description

cache Json

Declaration

private static void cacheJson(Context context, URI uri,
            String jsonSource) 

Method Source Code

//package com.java2s;

import java.io.IOException;

import java.io.PrintWriter;
import java.net.URI;

import android.content.Context;

import android.util.Log;

public class Main {
    private static final String TAG = "SOHelper";

    private static void cacheJson(Context context, URI uri,
            String jsonSource) {/*from   w  ww .  jav  a 2 s.c o m*/
        try {
            PrintWriter out = new PrintWriter(context.openFileOutput(
                    String.format("%d.json", uri.hashCode()),
                    Context.MODE_PRIVATE));
            out.write(jsonSource);
            out.close();
        } catch (IOException ex) {
            Log.e(TAG, String.format("error caching %s", uri));
        }
    }
}

Related

  1. loadImageFromAsset(Context context, String id)
  2. hasTelephony(@Nonnull Context context)
  3. getDataColumn(Context context, Uri uri, String selection, String[] selectionArgs)
  4. getPath(final Context context, final Uri uri)
  5. cachedJson(Context context, URI uri)
  6. getSharedPreferences(Context context)
  7. getAndroidDBDir(Context context)
  8. getAnimId(Context paramContext, String paramString)
  9. getApp(Context ctx, String packageName)