Android Context Get getFromAssets(Context con, String fileName)

Here you can find the source of getFromAssets(Context con, String fileName)

Description

get From Assets

Declaration

public static String getFromAssets(Context con, String fileName) 

Method Source Code

//package com.java2s;
import android.content.*;
import java.io.*;
import org.apache.http.util.*;

public class Main {
    public static String getFromAssets(Context con, String fileName) {
        String result = "";
        try {/*  w w  w .  j a  v a2 s  .  c o m*/
            InputStream in = con.getResources().getAssets().open(fileName);
            int lenght = in.available();
            byte[] buffer = new byte[lenght];
            in.read(buffer);
            result = EncodingUtils.getString(buffer, "UTF-8");
        } catch (Exception e) {
            e.printStackTrace();
        }
        return result;
    }
}

Related

  1. getExternalCacheDir(Context context)
  2. getExternalCacheDir(Context context)
  3. getExternalCacheDir(Context context)
  4. getFAFont(Context context)
  5. getFiles(Context context, String ext)
  6. getHelpUrl(Context context, String s)
  7. getImei(Context context, String imei)
  8. getInstalleApps(Context mContext)
  9. getInstance(Context context)