Create an output document from Android App - android

I have an android app where I will be capturing various information in different forms and storing into the SQL lite database for tracking/viewing purposes. I want to give the option of exporting the information into a RTF/PDF/Doc and give the option of sending it thru email.
I looked at various similar questions posted here earlier but didnt get a definitive answer. I saw the Android PDF Writer library http://sourceforge.net/projects/apwlibrary/ but this seems very basic. I considered iText but I think there would be issues with licensing if in future I want to sell this app..
Basically I want to define a template document with a structure that will be copied and content added to it based on what the user wants to export...
Any help is greatly appreciated...

I wanted some elegant solution where I can store a template in the assets folder and replace whatever I want to create the output document. Finally I went with html. I created a html template and put it into the assets folder. After that it was as simple as read assets, read db, do string.replaceall and write the output html and email it out.....

OpenOffice.org's Universal Network Objects (UNO) interface to programmatically generate MS-Word compatible documents (*.doc), as well as corresponding PDF documents.
its basically java so it should work on android too.

Related

What is the preferred way of importing/exporting data into Android app

I am making a vocabulary app to learn hungarian. The app has a database with words in two languages. The words should be entered as I meet them in the daily life and then I use the app to exercise the words.
Now I want to be able to enter the words on the computer, and import it to my app. Or share my words with a friend and thus export it from the app somehow.
As a windows programmer I am used to think in terms of files. I would make a simple file format or just use csv or xml files. But I see now when making Android apps that the file approach is not the thing. I don't get any file dialogs included with the api and when I search for how to import files it is hard to find an answer.
So my question is: What is the android/touch way of importing/exporting this kind of data?
EDIT: To clarify my question: Many windows programs have a way of importing data when you press File->Import and you get a file dialog where you can choose the file with the data you want to import. Since I don't find any file dialog or many examples on how to import files I recon there must be another more convenient way in android/touch devices. Maybe something with Content Providers. My vocabulary app is just an example.
I did not understand your question clearly but my suggestion to you is, if you have large amount of data:for example saving data of an employ,so you can use the Sqlite Database in android and connect it to your Desktop Database (for example you can create in xampp).Then You can send and recieve data.
Since you want to allow the users to enter the words in a Spreadsheet, you should give them an option to import data from Excel sheets, provided they create the sheets in a format specified by you. You can learn how to read XLS files programmatically online, here are some references:
http://www.cuelogic.com/blog/creatingreading-an-excel-file-in-android/
How to read data from XLS (Excel) file [Java, Android]
Read Excel file in android
After parsing the XLS sheet, you can insert them in an SQLite database. You can have all you want to know about SQLite in Android here:
http://developer.android.com/reference/android/database/sqlite/SQLiteOpenHelper.html
http://www.vogella.com/tutorials/AndroidSQLite/article.html

how to make existing pdf editable? Android app

I'm making an app in android.I'm able to write text and create a new PDFs and also can read existing PDFs.
But i'm not getting solution to edit the existing PDFs.
Editing the PDFs in my app is the target which i have to achieve.
I tried to convert it in String but its in encoded form.Have searched a lot But i don't want to use any paid libraries or jar.
Generally PDFs are not designed to be editable and do not contain structure information. You can use some tools like Acrobat to try to put structure back in but it is a huge task.

Using an online .txt file as a data source

I am building an Android app for a client and most of the data that i need is contained in an online .txt file attached to my clients website. I've never used an online .txt file as a data source before and don't really know where to begin?! Can anyone point me in the direction of a good tutorial on the subject.
Many Thanks in advance
P.S. I haven't asked whether it's possible because i have assumed it is due to the fact you can use an internal .txt file as a data source
I think the best approach is to download the file on the device and then read it like a normal file. If the file changes on a period of time, then configure the app to download and read the file and then update the local info in the app.
I don't think you can use an online txt as a DataSource, but you can implement this so you have an abstract source for your file, and then just call read on it.
Expose the txt/xml file over web,if you want to get it down to phone use URL loader and load it to the phone and operate if you want to use it online (like others may also be using it) it will be a bit complex in order to deal with data coming from more then one source but possible. clear you question a bit more.

How to edit or generate a PDF in Android SDK

I'm working in an app, and I need which the app can generate a PDF file with the app data saved in XML's.
I need make this in one of two ways, but I don't know how, the ways are:
Generate a PDF from a existing HTML
Edit an existing PDF and add text.
I don't know how iText or droidText can help me.
Any suggestion?
How about having a look at this StackOverflow post?
Android - how to convert html to pdf?
I'm guessing your question requires a similar, if not exactly identical approach.
(By the way, performing a Google search on "generate PDF from HTML android" yielded 305,000,000 other results, many of which seem legitimate answers on your question...)

Is XML a good way to organize App data and keep it up to date on the Market?

this should be an easy one for whoever published Android Apps before...
Here is my situation:
I'm trying to develop a "city guide" app and I was wondering if my idea of working with .XML files to structure my data (the client provided a .PDF file with pictures, address, tel. no, websites, opening hours of the different destinations) is the best way to go.
I was hoping to be able to write this app as an "interpreter" for this type of .XML and then easily include other cities or destinations in a city by updating that input XML file.
So this is not a technical question, I know how to pull this off, the question is if this is a good way to go? How do you keep an app easily up to date? Would a altered XML trigger a Market wide update notification ?
My research lead me to believe that this is a comfortable way to update a published Android Market app (prior to this inquiry I consulted:
http://developer.android.com/guide/publishing/publishing.html
All helpful hints and suggestions will be greatly appreciated.
Regards,
Veo.
Once I developed such kind of an app that had to contain the whole information in itself. I structured it in SQLite database that I was shipping along with the application. The file was not directly readable (or at least easy to read) from the assets folder, but every time when the file was altered I copied the sqlite file to the application storage and used it as ordinary application database. The cool thing is that this way I did not have to pay for the parsing of xml every time the application ran.
Several notes here:
My database grew too big and I had to split it in files of 1MB, because this is the limit for a file in the asset folder. For more info see here:
The database update mechanism with the database version still worked well.
When you create the database manually you need to take into account that Android expects one system table to exist in it (it is automatically created if the database is created in Android code). Basically see this answer here for more info on that.

Categories

Resources