AssetManager mngr_spinner = getAssets(); try { int img_count = 0; folder_array = mngr_spinner.list(parent_folder_name); labels_array = new String[folder_array.length]; for (int i = 0; i < folder_array.length; i++) { // System.out.println("Folder " + folder_array[i]); if ((folder_array[i].endsWith(".png") || folder_array[i].endsWith(".jpg"))) { img_count++; } } } catch (IOException e1) { e1.printStackTrace(); }Note : The folder will not be read if it has no contents in it.
This blog contains answers to all your questions. if can find your answer please drop a comment. Also if you have any answer to a specific question. Please drop a comment and we will publish it under your name.
Showing posts with label text file in android. Show all posts
Showing posts with label text file in android. Show all posts
Monday, 27 May 2013
How to read a folder structure in the assets folder in Android?
Monday, 4 June 2012
How to read a text file in ANDROID?
Hi all…..
In this post I will show you how to read a text file in ANDOID.
Let your file is in the assets folder of your ANDOID project.
The file is named “myfile.txt”
This example reads the file line by line using readLine() function till the end of the file. Here your need two classes named “InputStreamReader” and “BufferedReader”. For writing into the file you need “OutputStreamReader” class. The result is displayed in a Toast. Make sure you notice it.
Read more from here...
http://www.coderzheaven.com/2012/04/22/how-to-read-a-text-file-in-android-2/
Subscribe to:
Posts (Atom)