Create App That Draws A Map Reading Data From Text File?
Oct 12, 2011
I have to create an app that draws a map reading data from a text file : for example the text file can be like
. index x y orientation
vertex 1 0 0 0
vertex 2 5 0 0.5
vertex 3 10 2 0.3
so i need to do in java something like fscanf does in c (fscanf scans the text file for known formatted data... example, in the file i written i know each line has a string float float float and i need to put them into a specific data structure that can be a list of elements "vertex"
next, when i have all the data, draw a simple image rappresenting the data..
my questions are...
there is a function like fscanf?
and then.. what's better for drawing the 2d map? i have tu use Opengl? At the end i have to draw the image pixel by pixel.. i hope there is something easier then openGL
I searched the Incredible forums and sub forums and could not find an answer to this question, though I am sure it has been asked: If I want to go from my stock 2 GB card to a new card, and I want to preserve data AND have all apps still be able to read whatever data they were reading off the card, do I just transfer the files from one card to the other? I bet the only thing I need to make sure of is that new card is formatted with the same file system as the original card, right? I know copying data from one card to the other will preserve data, but I want to make sure I have no problems with apps, either, after inserting the newer card.
I am newly working on Android technology. I have to read Xml file in which there are html tags such as <b>() so I have to remove these tags before display on screen. If you know any way to remove these before display.
I have some reference data in a text file (~5MB) that I want to use with might android application.The file is of the format: 1|a|This is line 1a 1|b|This is line 1b 2|a|This is line 2a 2|b|This is line 2b 2|c|This is line 2c
What I want to know is the most efficient way (less memory, fast, size etc.) to use this file within my application.
a.) Should I save the file as a raw resource and open and read the whole file whenever I need a certain line. b.) Should I convert the file to XML and use XPath to query the file when ever I need to look up a value <!--sample XML --> <data> <line number="1"> <entry name="a">This is line 1 a</entry> </line> </data> c.) Should I just copy & paste the whole file as a static string array in the application and use that. [EDIT] I will also need to search this file and jump to arbitrary keywords e.g. "line 1a".
I am currently working on a group project to build an Android game. I have been delegated the task of building a PC based level editor (which is all done). All I have to do now is decide on the file format for the map that is outputted. At the moment it is just a standard text file with different numbers to represent different tiles; E.G 0=path 1=wall 2=enemy.
1 1 1 1 1 1 1 1 1 0 0 0 2 0 0 1 1 1 1 1 1 1 1 1
The actual Android game then takes this file and stores the values into a 2D Array. However those who are making the actual game are having difficulty opening a text file, and others have told me it has to be done using an XML file. I have now been asked to find a away to take in this input. how I would read the text file and put the values into a int array ? Or if it is easier, use an XML file and tell me how to format that file and read the values into a int array
I want to create a file in emulator android storage path /data/ but it seems I can't create a new file by programs,I should upload an empty file to /data/ and then write the file,an anyone help here? openFile Output("file.txt", MODE_PRIVATE) seems can create a new file in /data/data/Package/files/.but it can't create in path /data/.
Actually I am new to android. I want to create a .txt file programatically, save data to it and then retrieve the data. I had write one application for that but when I run it it creates file under data/data/ <myPackage Name>/files folder , I can see only size of this file but I can't open it. but when I deploy the application on mobile then there is no any file created. If i supplied path like FileOutputStream fOut = openFileOutput ("/sdcard/ deore.txt",Context.MODE_WORLD_WRITEABLE); then it throws Exception. So, please tell me where the actual file is saved under the phone and how to open it.
I am very new to android and i have wrote an application that reads the Cell ID information , now i want to create a text file and store the information inside , i have googled this issue but i couldn't find a solution that really worked.
I am trying to create a file ,if it doesnot exist and tried to write some data to it. The same program I did in java, it was running fine.But when I try to do the same thing in Android I am getting NullPointerException at the place where I am trying to write data to file. And also, I did not find any new file in the current directory .
On my app I will be reading in from an XML file thats formatted something like this
<database> <db1> <db> <name>name here</name> <street>street here</street> <long> longitude here</long> <lat> latitude here </lat> </db> <db> <name> new name here </name> <street> new street here </street> <long> new longitude here </long> <lat> new latitude here </latitude> </db> </db1> </database>
With this information I need to create Overlay Markers on the map (using latitude and longitude) and when they're clicked on I need it to display the name with the address. Depending on the conditions of where the map is, the number of markers will be different so I need a dynamic model for reading in these markers.
If I were to use Document methods like getElementById(String name) then I couldn't call getElementById("name") because it would likely try to call just the first <name></name> or give an unintended result.
Sometimes in LogCat I'll see Wrote stack trace to '/data/anr/traces.txt'
But when using the DDMS perspective, "File Explorer" View, I can't see anything in the "data" directory, I'm assuming because permission denied. Is there a way (short of rooting my ion device) to read what's in that text file?
Is there perhaps an android app for developers that will show the contents of the file? It would seem there would have to be some way of reading the file without rooting the device, otherwise why does the o.s. write it out? How can I read this file?
I want to download my apk file into "/data/local/" directory. I am able do this in external storage but unable on "/data/local" also i was trying to create folder on same location but could not do that. Through "adb push" it is possible but i need to do this java program.
I am trying to create a file in /data but i think i don't have the required permission for it: File file = new File("data", "myFile.tmp"); and i get java.io.FileNotFoundException: /data/mopayUpdateFile.tmp is it possible to create a file in "data", or somewhere else inside an android phone, except sdcard?
How to read a specific file from sd card. I have pushed the file in sd card through DDMS and I am trying to read it though this way but this give me exception. Can anybody tell me how to point exactly on that file? My code is this.
String path = Environment.getExternalStorageDirectory().getAbsolutePath(); FileInputStream iStream = new FileInputStream(path);
all in my application I want to read data from web page. if data at web page is upto 800kb then I am able to read it succesfully, but if data is larger then I get OutofMemoryException.I think it is because I am using condition as while ((inputLine = in.readLine()) != null) and in phone there is not much memory to read such a long string. I think I must have to read some part of string then write that part into some file in phone and read another part of string and write into phone but I don't know how to do that? Please help me solve this issue.
I am facing some problem during reading data from socket If there is some null data in socket stream so the DataInputStream would not read the full data and the so at the receiving end there is exception for parsing data.What is the right way to read the data from socket so there is no loss of data at any time ?
I am getting java.lang.ExceptionInInitializerError while reading yml file.The code that i am using for reading yml file is InputStream inputdatfile=Myclass.this.getResources().openRawResource (R.raw.datafile); Map<String, List<Map>> data = (Map<String, List<Map>>)Yaml.load (inputdatfile); I am getting the error in the second line.My yml file is in res aw folder. the external jar file i am using here to read yml file is jyaml1.3.jar. i tried to add <uses-library android:name="org.ho.yml" / > in manifest file that time i am not able to install the app in