21 package com.arm.malideveloper.openglessdk;
24 import java.io.IOException;
25 import java.io.InputStream;
26 import java.io.RandomAccessFile;
27 import android.os.Bundle;
28 import android.util.Log;
29 import android.app.Activity;
30 import android.content.res.AssetFileDescriptor;
31 import android.content.res.AssetManager;
36 protected static String
LOG_TAG =
"MaliSamplesActivity";
39 protected void onCreate(Bundle savedInstanceState) {
40 super.onCreate(savedInstanceState);
53 String res =
"/data/data/"+this.getPackageName();
59 AssetFileDescriptor ad = null;
66 ad = mAppContext.getResources().getAssets().openFd( path );
67 int off = (
int) ad.getStartOffset();
68 int len = (
int) ad.getLength();
69 int res[] = { off, len };
75 Log.e(
LOG_TAG,
"MaliSamples.openAsset(): " + e.toString());
80 public static void extractAsset(String resource_file_dir, String asset_path)
82 String resource_file_path = resource_file_dir +
"/" + asset_path;
85 File resfile =
new File(resource_file_path);
90 File dirs =
new File(resource_file_dir);
92 resfile.createNewFile();
93 RandomAccessFile out =
new RandomAccessFile(resfile,
"rw");
96 AssetManager am = mAppContext.getResources().getAssets();
99 InputStream inputStream = am.open( asset_path );
101 byte
buffer[] =
new byte[1024];
108 count = inputStream.read(
buffer, 0, 1024);
116 Log.e(
LOG_TAG,
"MaliSamples.extractAsset(): " + e.toString() +
" " + resource_file_path);
118 Log.d(
LOG_TAG, resource_file_path);
119 File resfile =
new File(resource_file_path);
122 Log.d(
LOG_TAG,
"File loaded successfully");
void extractAssetToRes(String filename)
static int[] openAsset(String path)
static android.content.Context mAppContext
GLenum GLenum GLsizei count
static void extractAsset(String resource_file_dir, String asset_path)
void onCreate(Bundle savedInstanceState)