Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;
//License from project: AGPLv3 

import android.content.Context;

import java.io.IOException;
import java.io.InputStream;

public class Main {
    private static String getStringFromResource(Context context, String dbname) {
        InputStream inputStream;
        byte[] buffer;
        try {
            inputStream = context.getResources().getAssets().open("database/" + dbname);
            int size = inputStream.available();
            buffer = new byte[size];
            inputStream.read(buffer);
            inputStream.close();

            String text = new String(buffer);

            return text;
        } catch (IOException e) {

        }

        return null;
    }
}