android-assets

Android icon generator for actionbar and notification not working (grey shape)

三世轮回 提交于 2019-11-29 23:07:14
I found this Asset Studio to generate icons. It works fine for the launcher icon but for action bar or notification icons it is not working. I put in my png file and want to generate the icons, but Asset Studio is only generating gray circles. Is there another tool to generate action bar and notification icons? You can use a tool for creating generic icons in Asset Studio: https://romannurik.github.io/AndroidAssetStudio/icons-generic.html . To get it look like ActionBar Icon, you should make next actions: Choose image The size of image should stay at 24dip Change padding to 4dip Move

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

本秂侑毒 提交于 2019-11-29 16:32:35
问题 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

How to access a file from asset/raw directory

早过忘川 提交于 2019-11-29 13:14:52
with this below code i'm trying to access the file which is stored in asset/raw folder, but getting null and E/ERR: file:/android_asset/raw/default_book.txt (No such file or directory) error, my code is: private void implementingDefaultBook() { String filePath = Uri.parse("file:///android_asset/raw/default_book.txt").toString(); File file = new File(filePath); try { FileInputStream stream = new FileInputStream(file); } catch (Exception e) { e.printStackTrace(); Log.e("ERR ", e.getMessage()); } catch (OutOfMemoryError e) { e.printStackTrace(); } } Place your text file in the /assets directory

how to get file name and file count from asset folder in Android?

ぐ巨炮叔叔 提交于 2019-11-29 12:59:09
I have some media file in my asset folder. I want to get all media files names and files count from my asset folder. Rat-a-tat-a-tat Ratatouille A little googling might have helped you! try this: AssetManager assetManager = getAssets(); String[] files = assetManager.list("your_folder_name_inside_assets"); List<String> it = new LinkedList<String>(Arrays.asList(files)); 来源: https://stackoverflow.com/questions/22861480/how-to-get-file-name-and-file-count-from-asset-folder-in-android

How to read a text file from “assets” directory as a string?

你说的曾经没有我的故事 提交于 2019-11-29 04:16:16
I have a file in my assets folder... how do I read it? Now I'm trying: public static String readFileAsString(String filePath) throws java.io.IOException{ StringBuffer fileData = new StringBuffer(1000); BufferedReader reader = new BufferedReader( new FileReader(filePath)); char[] buf = new char[1024]; int numRead=0; while((numRead=reader.read(buf)) != -1){ String readData = String.valueOf(buf, 0, numRead); fileData.append(readData); buf = new char[1024]; } reader.close(); return fileData.toString(); } But it cast a null pointer exception... the file is called "origin" and it is in folder assets

Android - Copy files from assets to /data/data folder

偶尔善良 提交于 2019-11-29 04:02:25
I need to use some files in my app. They are kept in asset folder. I saw discussions on SO, where the files are being copied from asset folder, to /data/data/ on the internal storage, and then being used. I get the code, but what I do not get is, what is the need to copy the assets to internal storage ? If anybody has experience with this, help ! One reason that just popped up for me is when using existing C/C++ code with NDK that requires a path to a file and you don't want to modify that code. For example, I'm using an existing C library that needs some data files and the only existing

Android: copy database from asset folder, but only get an empty file

感情迁移 提交于 2019-11-29 00:09:05
guys, I have the problem when copying database from local assets folder to /data/data/package_name/databases directory. As I use the http://www.reigndesign.com/blog/using-your-own-sqlite-database-in-android-applications/ tutorial to do it, I can only get an empty file. I quoted the part of copyDataBase() method and there is no difference. Every time the app start, it will create the directory and empty database. So is there any way to make the copyDataBase() work? Thank you very much!! I wouldn't copy any database form the assets -folder. If you need some standard entry's in your Database, you

Save a (.txt) file to the Assets Folder in Android?

♀尐吖头ヾ 提交于 2019-11-28 21:21:07
How to write to .txt file in assets folder. How to get path assets folder ? You can't. The assets folder is read-only at runtime. Pick a different location to save your data, see Data Storage for more information. The path of assets folder is file:///android_asset But this is read-only. The assets folder is like folders res, src, gen, etc. These are all useful to provide different files as input to build system to generate APK file for your app. All these are read-only while your app is running. At run-time you can only write to SD card. I hope you understand my answer. Not possible, Better

Android multiple screen design

梦想的初衷 提交于 2019-11-28 11:39:36
I understand there is plenty of documentation about designing for multiple screen support in Android. and I have read the Android guide here as well as a number of similar questions such as this However I'm still a little confused as to how I should implement it for my application. I plan to target the following device configurations Am I correct in thinking I will need to structure the project layouts as follows: Medium density Normal screens HVGA 320x480 (160dpi): res/layout-mdpi (320 x 480 ) res/layout-land-mdpi (480 x 320 ) High density Normal screens WVGA800 480x800 (x854) (240 dpi) res

How to get file read line by line

徘徊边缘 提交于 2019-11-28 09:04:10
I have a file containing text in separate line. I want to display line first, and then if I press a button, the second line should be displayed in the TextView and the first line should disappear. Then, if I press it again, the third line should be displayed and so on. Should I have to use TextSwitcher or anything else? How can I do that? You tagged it as "android-assets" so I'm going to assume your file is in the assets folder. Here: InputStream in; BufferedReader reader; String line; TextView text; public void onCreate(Bundle savedInstanceState){ super.onCreate(savedInstanceState);