android-assets

Get the SQLite path within the Assets Folder

不羁的心 提交于 2019-12-04 14:49:23
I'm developing an application and I've run into two problems here: How can I open an SQLite database which is stored in the assets folder? What path do I use to access the assets folder in my application? Here's what I have so far: path = "file:///asset_folder/database.dat"; SQLiteDatabase db = null; db = SQLiteDatabase.openDatabase(path, null, SQLiteDatabase.OPEN_READONLY); How can I copy a file to the internal memory ( /data/data/... ) during the installation of my application or during the first run? I want to copy a folder inside the assets folder into the internal memory during the first

What is the differnce between accessing file from assets folder or SD card

烈酒焚心 提交于 2019-12-04 14:21:47
问题 I am developing an application where I have to use three different size's file (1mb, 5mb, 15mb). I searched, then came to know that we can keep these video in assets folder and can use those video. Secondly, I came to know that we can keep these videos in assets folder and installation time we can move all videos to SD card. when tried second approach faced problem due to bigger file size. So, can anyone please tell me what is difference between both approaches and which one I should use. Any

BitmapFactory.decodeStream from Assets returns null on Android 7

谁都会走 提交于 2019-12-04 13:45:46
问题 How to decode bitmaps from Asset directory in Android 7? My App is running well on Android versions up to Marshmallow. With Android 7 it fails to load images from the Asset directory. My Code: private Bitmap getImage(String imagename) { // Log.dd(logger, "AsyncImageLoader: " + ORDNER_IMAGES + imagename); AssetManager asset = context.getAssets(); InputStream is = null; try { is = asset.open(ORDNER_IMAGES + imagename); } catch (IOException e) { // Log.de(logger, "image konnte nicht gelesen

Pdf File In asset folder not open in thirdparty app

生来就可爱ヽ(ⅴ<●) 提交于 2019-12-04 07:22:01
问题 Hi I am new in android i have some PDF file that exist in this path asset/pdf/example.pdf when i try PDF file with this code Intent intent = new Intent(Intent.ACTION_VIEW); File file = new File("file:///android_asset/pdf/example.pdf"); intent.setDataAndType( Uri.fromFile( file ), "application/pdf" ); startActivity(intent); i get this error & know it's because third party has no access to file what is solution? 回答1: know it's because third party has no access to file file:///android_asset/

Null-pointer issue displaying an image from assets folder Android 2.2 SDK

时光总嘲笑我的痴心妄想 提交于 2019-12-04 06:42:09
问题 I looked at the 2 examples on Stack, but can't get them to work. I'm simply trying to grab an image from a folder in assets and set it as in ImageView, but get a null pointer returned. What am I doing wrong? Main Activity: package com.xxx.xxx; import java.io.InputStream; import android.app.AlertDialog; import android.graphics.Bitmap; import android.os.Bundle; import android.view.View; import android.view.Window; import android.widget.ImageView; import android.widget.ViewFlipper; public class

How to build a ResourceManager in libGDX with AssetManager

孤人 提交于 2019-12-04 06:00:49
问题 I want use non static AssetManager In my android game? I have many levels. How should I use AssetManager? I should create for every level a separate AssetManager? Because if I create one AssetManager, it will load all textures, etc, in first screen. 回答1: You should create one AssetManager in your main class which load all assets at the startup of the application. Then for each level you should create a different screen or use one screen, depending on your game. Then you pass a reference of

Undefined reference to AAssetManager_fromJava

荒凉一梦 提交于 2019-12-04 02:08:32
I am trying to access assets from an android apk using AAssetManager. However, I keep getting "Undefined reference to AAssetManager_fromJava" even though I've included asset_manager.h and asset_manager_jni.h Other functions from asset_manager.h, like AAssetManager_openDir(mgr, "") etc also can't be referenced. Here's the complete code #define EXPORT_API #include <string.h> #include <jni.h> #include <android\log.h> #include <sys\types.h> #include <android\asset_manager.h> #include <android\asset_manager_jni.h> #define LOGD(...) __android_log_print(ANDROID_LOG_DEBUG, "com.devin - native", __VA

unable to copy database using SQLiteAssetHelper class

夙愿已清 提交于 2019-12-03 22:55:50
问题 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

how to get access of android root directory (/system/app) programatically?

 ̄綄美尐妖づ 提交于 2019-12-03 21:45:29
I have an apk file in asset folder. Now I need to create a program which will install that apk file as system application. Manually it is possible by copying that apk file into sdcard with following steps, $ adb push MyApk.apk /sdcard/ $ adb shell $ su $ mount -o remount,rw -t yaffs2 /dev/block/mtdblock3 /system $ cat /sdcard/MyApk.apk > /system/app/MyApk.apk $ pm install /system/app/MyApk.apk But is it possible to do through code? Refer the below code to move user app apk into system app apk in rooting device with the help of RootTools method . PackageInfo paramPackageInfo = null; try {

Android external database in assets folder

心不动则不痛 提交于 2019-12-03 19:33:00
问题 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. 回答1: you should copy the .db file from your assets folder to an internal