import csv file contain arabic data to sqllite - android

I have an excel file with data in arabic. How can I import this in an sqlite database for use in an Android application? I tried to export as CVS, but excel doesn’t export the cvs as unicode, so the data is unreadable

Even though the question has been asked for a while now but I actually encountered the same issue and solved it by following the below steps:
Open your excel sheet (.xls or .xlsx)
Save it in Unicode Text (.txt) format
Open the text file and change the encoding to UTF-8
Replace the delimiter (which could be Tab delimited) by a comma
Make sure the file is readable and as you expect it to be (you might need a minor manual modification in some cases)
Rename the file back to (.csv)

Related

CSV Wrong Encoding UTF-8

I am building an app, and I have a need for names of cities.
I have found a CSV and an XML file on this site:
https://data.gov.il/dataset/citiesandsettelments
The app is in Hebrew, and I need the database on this site.
So I downloaded the CSV file which is in UTF-8.
When I copied it into Android Studio's res/raw folder, this is the result:
You can see clearly that the English names for the cities are fine, but all others which are written in Hebrew are messed up.
What should I do to prevent this error?
Ok i found the problem
i changed the encoding into windows 1255 and it works fine.
sorry for this.

Most efficient way to store text and media in android development

I have an application that I want to develop. The android application is more or less like a book that will allow the users to select a chapter and it will display the whole text in that chapter and a media file for the chapter. Where do you think I can store the text and the media. Should I use json format or sqlite database or I should store both text and media in a folder and access it there. Am really confused because I still want to be able to perform some query on the text search for the text in my application.
You can use binary files, where you load the data sequencial.
Or you use zip-files, in which format many programs store data. Eg .svgz is a zipped version of .svg used by Inkscape, .odf is an open source format used by eg. OpenOffice or LibreOffice (the specification says it could be either a XML- or ZIP-structure.) You can store the text in a file, where in the text it references to other files like images in the zip, like a html-file references to other files on the server in the directory. This can be a json-file or an xml-document or a binary-serialization of an object-structure. There are many zip-libraries out there,. It is a big security risk, if you do not check in the file for references to other files outside the zip, like '../../Documents/myPasswords.txt' (when you are on Windows for example and you use the %temp% directory, this may reference to 'C:/Users/BOB/Documents/myPasswords.txt' when the directory where you unpack to is '%temp%/randomName/'), when unpacking the data to a temporary directory and load a file (however different operating systems treat this differently, Android is more secure than Windows, but the app can crash if you do not check...).
But if you do not care about filesize and if you store the data directly within the app (and not download them from the internet), you just include it in your data-folders.

How to export data from layout to file

I am working on an android app project for work, in Android Studio, which contain texts and switch buttons. I would like to save all this data in file (PDF,excel, etc.), and then upload it to cloud.
How can I store all the data into file?
Do I have to use any Database?
I tried to use itext, and created a PDF containing only text.
If you want to export data to a pdf file, using iText (as your tag indicates) there are various options.
You can use the core API, which allows you to insert tables, lists and text. For more information you can consult
http://developers.itextpdf.com/content/itext-7-jump-start-tutorial/examples
You can export to HTML, and then use pdfHTML (newest iText add-on) to convert the given HTML to pdf. For more information (+examples) consult
http://itextpdf.com/itext7/pdfhtml

Read, write and print xlsx file in raw resource folder android

I want to make an app which can print bill invoices. I had made a basic layout in xlsx(excel) format leaving the places(cells) for inputting data according to different bills. For that I had put that xlsx file in raw folder and with help of apache poi library, I can easily read the file data. But now i want to update specific cell data in same file(in raw folder) and then print that with help of my app i.e. So that there will be no need to open excel file at all, just fill the information in edittext and press button to print bill. Is there a way to do so? I have browsed through lot of existing stackoverflow threads but none of them are helpful.

4 MB .txt file in android application

I have a really big .txt file ( 4.2MB) that I have to access in my android application. It consists of words and their definitions in this format:
word - definition
word2 - definition2
Should I put this file in /assets folder or in res/raw? Or something third? Maybe I should put it on SD card because of its size?
And how should I get file contents in the code?
I have tried both assets and res/raw, but the file size always seems to be the problem or I am doing something wrong.
A SQLLite database could be used for this.
An example of this can be found in the latest android SDK. http://developer.android.com/resources/samples/SearchableDictionary/index.html
Putting it in raw folder would be a better idea according to me.
since putting in the SDCard would make it available to user also, and the user might screw up your database.

Categories

Resources