I'm writing an Android application that needs to store dates and time into file and then read from this file and display it in an activity. What is the best way to go about this? any common practices about this?
thanks!
You can use SQLite database which allows you use of date functions.
http://www.sqlite.org/lang_datefunc.html
Read here aboute SQLite date and timestamp functions.
Related
I am creating a program which can manage project schedule using iCalendar. I need to be able to save all the information used in creating a VEvent in some type of data holder and then output it in a file, which after can be loaded and data might be edited or more data added. I think JTable is kind of suitable for my needs, one row will represent one VEvent and columns will have different information. But if anyone has a better suggestion, I want to hear it.
My question is, what is the best data holder for this type of information and how to save that data to a file and load it afterwards.
You can for sure use the iCalendar file format as defined in RFC5545 and only have one VEVENT in your calendar and have a file per event but you could equally store them in a database and leverage this SOical-field-list-for-database-schema-based-on-ical-standard
VEvent seems like a good idea since it´s easy to export to this format for your custumers.
I want to store data in android application date wise, i.e different data for different day. The data will be just integer values and meanwhile want to retrieve it date wise only. i want to store it in a single file. and then want to display it in a chart format in android datewise.. so is there any way i can do it. or can anyone guide me.
Thanks
You can have a look on SQLite Storage.if you want store it in table format. Which can store the values in table format and it will be easy for you to retrive. I think this is the best option.
Assuming below are file contents.
Read all contents of file in StringBuffer and then get daywise contents by spliting based on
"-------EOD----". This will return daywise text.
12/02/2014 1111222222222
-------EOD----
11/02/2014 1111222222222
-------EOD----
10/02/2014 1111222222222
-------EOD----
When I google "how to make a dictionary", it gives me a great measure of the explanation of "make", which is very helpful. But I need something else, so I put this question here.
I want to make a small project. I want to make a dictionary with java or android. But I don't know how should I organize the words. I have considered a JSON file, a XML file or I can also simply output all the words as ojbects into a file. Could anyone please give me some adivce?
Assuming that you want to be able to read (quickly) values from your dictionary, and maybe update values or create new values then I suggest that you store your dictionary in a Database. For a simple Java database I suggest that you use an embedded Derby Database.
see http://db.apache.org/derby/
I have about 16 variables in which the values need to be saved for later recall / editing. I've tried SQLite Database, since I am a novice at Android, it is just too hard for me. I will have to come back to SQL later. Are there any other ways to store these values for later recall / editing? Thank you! Maybe link me to a tutorial if possible? :-)
You might try using SharedPreferences.
SharedPreferences is another choice. Here is a very simple example
how to use it.
Storing 16 variables using SharedPreferences will make your code looks long. I advise you to try harder with SQlite database.
For simple program data that needed to be saved I just used properties files before but I was wondering how I can save more complicated application data such as: arraylists e.g..
How would I save such data into a file? And is there a way to save it in a file with my own extension ( so not .properties for example when using the properties method to save data ) and to make sure it cannot be edited by user manually ( which is simply possible with notepad for example for .properties files )?
Thanks in advance.
Best Regards,
Skyfe.
Serialize to XML, encode/encrypt the data prior to persisting, and then decode/decrypt the data when consuming from your app.
The simplest way to do this as stated is to use the built-in Serialization mechanism. Just serialize your ArrayList out to a file using an ObjectOutputStream wrapped around a FileOutputStream. As long as each item in your list is serializable, this will work fine.
It's not impossible to modify, but it's fairly obfuscated over, say, a text file (it's binary for starters).
You can use a self contained database like SQLite