0

I am using eclipse to build my android application.The data required for my application is stored in a sql server.In my database i have name,address,phone number,latitude and longitude of a location.I created a program in android which will take an array of addresses and find out its latitude and longitude.But the array i used was hard coded(it included 3 addresses) for testing purpose.I saved latitude and longitude in SDcard.But now i want to take data from server which contains 2000 addresses.I copied the addresses in text file and saved in my personal computer.But it is not possible to use data in C drive in android application as it is linux based.Please someone help me how to use data from text file in my android application. Thanx in advance.

5
  • 3
    Put your addresses in an SQLite database. With Android you can read the necessary data you want. Commented Jul 13, 2012 at 6:31
  • yes as Martijn Van Mierloo say Using any SQLite tool create database file and use that file in your android application. Commented Jul 13, 2012 at 6:34
  • But i have already written all addresses in sql server.So it will be time consuming to again add 2000 addresses again in sqlite database Commented Jul 13, 2012 at 6:35
  • 2
    Then Make a web service which will communicate with your SQL server database from your android application. Commented Jul 13, 2012 at 6:36
  • 1
    I am not sure I understand but you can read the data stored in the SDCard from within your Android project. Commented Jul 13, 2012 at 6:39

2 Answers 2

1

why don't you copy the data (the text file with 2000 entries) to your SD card of emulator (or device) and read from there ?

Refer my answer to the following post for copying file to the SD card

emulator and uploading video

Sign up to request clarification or add additional context in comments.

2 Comments

Can u tell me after copying the file where it wil be visible in our project?
if you copy the file (say file.txt) to your SD card root, it can be accessed from Android program using this path /mnt/sdcard/file.txt
0

But it is not possible to use data in C drive in android application as it is linux based.Please someone help me how to use data from text file in my android application

For general, I guess that you want Android can read file in your computer. If you use Linux or Windows, Android OS still cannot read your files on local computer because Android stimulate as an Android Environment with internal store.

When I want to put some data into Android emulator, I often copy data to SD Card. And you can view internal store of Android OS (and this's just true for development environment) in Eclipse. You go to: Windows>>Show View>> Other and choose File Explorer.

Hope this help.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.