android-assets

unable to copy database using SQLiteAssetHelper class

非 Y 不嫁゛ 提交于 2019-12-01 01:47:40
I am extending SQLiteAssetHelper class to use my pre-populated database from assets folder but my app crashed and gave an error saying Caused by: android.database.sqlite.SQLiteCantOpenDatabaseException: unknown error (code 14): Could not open database . When I checked in ddms , there was no databases folder or my db file in data/data/com.sqlitetospinner1/ . So to just test, I created a folder named databases and pushed the db file into it. After this the app started to work perfectly. It means my AssetsHelper class failed to copy database. AssetsHelper class:- public class AssetsHelper extends

Exception in Drawable.createFromResourceStream() — HTC ONLY?

主宰稳场 提交于 2019-11-30 23:37:35
I've released an IME (soft keyboard) app and I am getting crash reports from HTC phones only . Here is the stack trace: java.lang.NullPointerException at android.graphics.BitmapFactory.decodeResourceStream(BitmapFactory.java:465) at android.graphics.drawable.Drawable.createFromResourceStream(Drawable.java:697) at android.graphics.drawable.Drawable.createFromResourceStream(Drawable.java:666) at com.comet.android.keyboard.util.Util.getBitmapDrawable(MyFile.java:416) ... Here is my call to Drawable.createFromResourceStream() drawable = Drawable.createFromResourceStream(context.getResources(),

What is an Android Asset?

社会主义新天地 提交于 2019-11-30 23:35:32
问题 I'm doing my first steps in Android development, and came across the term Asset . As far as I understand it, an Asset is simply a file that is not being parsed or referensed as a resource. Is there a more accurate definition of the term? In which scenarios should I use an Asset in my application? 回答1: Assets provide a way to include arbitrary files like text, xml, fonts, music, and video in your application. If you try to include these files as "resources", Android will process them into its

Android: read a GZIP file in the ASSETS folder

ⅰ亾dé卋堺 提交于 2019-11-30 22:39:28
How can you read GZIP file in Android located in the "ASSETS" (or resources/raw) folder? I have tried the following code, but my stream size is always 1. GZIPInputStream fIn = new GZIPInputStream(mContext.getResources().openRawResource(R.raw.myfilegz)); int size = fIn.available(); for some reason the size is always 1. But if Idon't GZIP the file, it works fine. NOTE: Using Android 1.5 I met the same problem when reading a gz file from assets folder. It's caused by the file name of the gz file. Just renaming yourfile.gz to other name like yourfile.bin. It seems Android build system would

How to avoid reverse engineering of an APK assets folder resources items file?

江枫思渺然 提交于 2019-11-30 21:43:34
I am developing a android application, in this application assets folder contains some password and some imp information. I want to prevent a hacker from accessing any resources, assets or source code from the APK file , Mainly assets resources . How can I achieve this thing? I found and also think about following solutions, Please make me correct and provide your suggestions on this. 1) Put every data or files in assets folder in encrypted way. In this solution when i require to use this assets folder data then i need to do decryption every time that make my application slow. 2) To secure

Exception in Drawable.createFromResourceStream() — HTC ONLY?

扶醉桌前 提交于 2019-11-30 18:37:31
问题 I've released an IME (soft keyboard) app and I am getting crash reports from HTC phones only . Here is the stack trace: java.lang.NullPointerException at android.graphics.BitmapFactory.decodeResourceStream(BitmapFactory.java:465) at android.graphics.drawable.Drawable.createFromResourceStream(Drawable.java:697) at android.graphics.drawable.Drawable.createFromResourceStream(Drawable.java:666) at com.comet.android.keyboard.util.Util.getBitmapDrawable(MyFile.java:416) ... Here is my call to

Android: read a GZIP file in the ASSETS folder

女生的网名这么多〃 提交于 2019-11-30 17:56:46
问题 How can you read GZIP file in Android located in the "ASSETS" (or resources/raw) folder? I have tried the following code, but my stream size is always 1. GZIPInputStream fIn = new GZIPInputStream(mContext.getResources().openRawResource(R.raw.myfilegz)); int size = fIn.available(); for some reason the size is always 1. But if Idon't GZIP the file, it works fine. NOTE: Using Android 1.5 回答1: I met the same problem when reading a gz file from assets folder. It's caused by the file name of the gz

How to modify a pre-packaged apk file on client-side by user who is using my desktop application?

霸气de小男生 提交于 2019-11-30 10:39:40
Well, I know the title is not well-written, but my case is as complicated as that! I searched for this case here but other similar questions really differ from mine. Here is my problem: I have written an Android program which displays contents (text, images, etc. in raw format) that is stored in "assets" folder. Now I want to deliver this app along with a windows application (also written by me) to end users, which lets them add contents to "assets" folder of the apk file and output the modified apk with their desired name (to appear on their phone). Now what is best solution to do this and

Android external database in assets folder

China☆狼群 提交于 2019-11-30 09:37:30
I have an android application that is supposed to read and expand a database that is already created on sqlite...it works fine on emulator by putting database in "data/data/(packagename)/database" folder on the file explorer of emulator. Now problem is occuring with the real device. Obviously it doesnt have the database to open.I tried to put database in assets folder but I am not getting to open it with the openhelper. you should copy the .db file from your assets folder to an internal/external storage. You can use following codes, private static String DB_PATH = "/data/data/your package

Reading file from assets directory throws FileNotFoundException

主宰稳场 提交于 2019-11-30 06:31:30
I'm trying to read in a text file of a bunch of words that I want to use for a word game I am writing. This list is stored in the assets directory and is a txt file. But, whenever I attempt to open it, it throws an exception. List<String>wordList = new ArrayList<String>(); BufferedReader br = null; try { br = new BufferedReader(new InputStreamReader(getAssets().open("wordlist.txt"))); //throwing a FileNotFoundException? String word; while((word=br.readLine()) != null) wordList.add(word); //break txt file into different words, add to wordList } catch(IOException e) { e.printStackTrace(); }