I am new to android development. My problem is simple. I have got some test_cases files in a folder. I want to read them ,perform some test operations on them and want show the names of files with test results on screen .But i don't know how to do that.Any suggestion will be helpful....
Related
im new to android and im trying to make a "simple" app.
However i would like to know if, what i have planned, is possible in android.
Basicly it's a crude database reader/navigator.
I made a folder structure in the assets folder with a few directories and *.txt files.
Now the plan is to read/scan the folder structure on startup of the program and dynamicly create buttons labeld based on the folder,- and file names.
The buttons have to link to the files and folders so the user can navigate the folder structure and open a *.txt file and read it. Also the idea is that the buttons reflect the folder structure as it is in the assets folder.
The idea is that the user can easly retrieve info from the app and i can add info to the app trough *.txt files and adjust the structure just by adding/removing directories and files in the assets folder.
i am using android studio but like i already say'd: i am a beginner with programming and would like to know if this is even possible with android.
And if it is: could someone please tell me how i should start this project or link me to some example code on how this could be done?
Thanks in advance.
If i read your idea correctly, what you are trying to achieve is very much possible. I would start looking at the AssetManager class and I believe what you are looking for is the list() command which should give you what you need.
https://developer.android.com/reference/android/content/res/AssetManager.html
You can obtain the AssetManager from everywhere within your app through the Context object which you will find to be everywhere around. ;)
From there on you can build your hierarchy and open files.
There are some useful wizard projects in Android studio, which will basically setup a general structure of an Android App. I would recommend starting with a Single Activity application and move on from there.
It sounds like ListView is something that could be beneficial for you here. ListView allows you to dynamically create buttons, or whatever you need. ListView has the added advantage that you can use an XML file to inform the ListView of how to display the buttons, images or whatever you want to display for each element of the list. There are loads of videos demonstrating how to use ListView, but here is a link to its documentation: https://developer.android.com/guide/topics/ui/layout/listview.html
Also, if you'd like a structured way of learning how to develop apps, I'd recommend the Android courses on Udacity to help you out.
Best of luck!
I am currently developing an app based on Android, however this question is more of a problem that relates to almost any type of the program developing.
My question is : Let's say your program or app saves a file, say a text file that says:
"hello hello hello world!!!"
and you save it. And one day your app loads that file and just add a simple character "a" within the original text file. Thus the text file has to save
"hello hello a hello world!!!"
then, if you want to save this changed file, is the app or program obliged to write the whole file from start to end again to save the revised data with so little change? I heard that modern file systems split the file into pieces at saving and reassemble them when loading by finding each piece of the file with some sort of an address table.
So, wouldn't it be faster to just rewrite the revised part and leave the other parts alone, and then when you load the file you just put the piece with the revised data in right place within the other pieces?
Many times I've seen Android apps that have a list of languages displayed and I can tap on any of this language and download it for this specific app (GO Weather widget has this functionality).
I'm interested in how is this implemented and what is the best way to load languages dynamically in Android apps? Adding 100 string.xml resources in app project is not a solution and besides if I want to provide some kind of "funny holiday language" pack or add a new language I would need to upload the project to Google Play again and again...
Thanks!
While it's possible to use Expansion Files to add on to your app, they are limited in some ways. The main problem for you would be that you can only have a limited number of expansion files. If you wanted 100 languages, your only option would be to load them all in the expansion file, and download the whole thing. While that might not be a problem, since a list of translated strings probably isn't that large, you may want to go a different route.
The best option I see for downloading separate language add-ons is to forgo using strings.xml altogether. Just use a simple CSV file to hold your strings, mapping names to strings. When your program starts, read it in to a string array/map/whatever, and you have all your strings at the ready. This way, if you want to add a language, it's as easy as downloading a text file and saving it to your data directory.
Also, you can keep a file listing all the available languages on the same server, so you don't have to update the app if you want to add seasonal or limited-time-only languages, like you mentioned. Just read in the file to get the list.
Note, you'll need somewhere to host the files, but that's hardly a barrier in this day and age.
I am fairly new at developing for Android and was hoping to get some help with something.
First, just a brief idea of what I am trying to achieve.
Within the app I am developing, the user can create a project profile for each new project he starts. I have already created the code to create a new XML file for each new project which is stored on the SD Card.
Now I want to create a list of the various projects on the main screen for the user to select from, but I'm not 100% sure how to go about this. My first thought was to have an XML file called Projects List which lists all the projects that have been created. But I just can't seem to figure out a way to update an XML file every time a new project is created, and this is where I was looking for some help.
Can someone please help me to understand how to update an XML file?
Thanks in advance for any replies.
My first thought was to have an XML file called Projects List which
lists all the projects that have been created.
Instead of doing this, why not simply see how many xml files there were created(corresponding to projects created)? I assume that, now, you're saving those project in a folder created by you on the SD Card so when it's time to show that information to the user simple check your projects folder, see how many there are(get the names, get a reference to those xml files so you could open them on a user action etc) and present them to the user.
This would be a lot simpler then implementing the logic to update a xml each time the user does some changes to the projects, not to mention the case when the user might delete those xml files when your app is not running.
I would do the following.
The user create some projects - and for each project you have an xml file.
You check for all xml files - grab a bit of info from each, and build a ListView :
Android listview example
From here you can create a custom adapter which would do the hard work of working out what information you need from each XML file and then when the user clicks the 'browse projects button' they can see all projects in a listview?
I'm sure you can help such a newbie like I am.
I created a project in android and I want to use it as a model for next 10 and more apps, just changing the raw sources.
I mean I want to make some products i.e. 10 videocharts about norway, I make one project with the needed activity and resources so each app will differ only for the content value.
I will keep of course the same file name too if needed.
How can I save the project?
Cause I tried to make a new project from resource but I get an error on top of the tab saying Manifest is not present in the folder while manifest is actually there, and I cannot proceed further.
Thank you
ANgelo
This sounds like a place to use an Android library project.