Write/Read then Save text file Basic4Android - android

I'm creating an application on Basic4android that collects GPS coordinates and equipment deficiencies in a dropdown list (Spinner). The GPS coordinates consists of latitude and longitude shows up on a label field when GPS is ON and the deficiencies shows up under a Spinner field (e.g. dropdown of "Broken cross arm", "Broken Insulator","Rusty Structure"). I was able to get all that done and create a "Submit" button that should copy the three fields (Longitude, Latitude and deficiencies) into a text file. Any idea how to store these fields everytime I press submit? I will be using this application for inspection when I walk by a transmission tower, I will record the coordinates and the obvious deficiency into a file on android.
Thank you,
Eli

There are some solutions. one of them is writhing a list file .add a character as delimiter between Longitude, Latitude and deficiencies.
declare list in global section
Dim list1 as list
initialize list on create activity event
List1.Initialize
On submit button click
newstring=longt &"|" &lat &"|"& defi
If File.Exists (File.DirInternal & "/","Log.txt") Then
List1 = File.ReadList (File.DirInternal & "/","Log.txt")
end if
List1.add(newstring)
File.Writelist(File.DirInternal & "/","Log.txt",List1)
You can split every line int to seperated Longitude, Latitude and deficiencies later when you need.

There are several ways to do it. The simplest is to add the values to a Map and use File.WriteMap / ReadMap.
See this tutorial: http://www.basic4ppc.com/android/forum/threads/6690/#content

Related

load map only single city on google map android

I want to show map only one city or country in my android app. How can I do it ?
I do not need to load map of all world
image 1
image 2
if you want to see only country or city you can use its latlng bound its focus on the particular city or country when user come first time here all country latlng bound https://gist.github.com/graydon/11198540
First, you have to be familiar with Google Map API (create an API key, import it to your project, etc.)
Then, get the LatLng of the city you want, and on the moveCamera method, pass to it a good zooming (it's a float). For exemple, when your widget is beeing launched, call something like : mMap.moveCamera(CameraUpdateFactory.newLatLngZoom(yourCoords, 10f))
If you don't want / need to allow any user interaction with your map, just set the parameter "liteMode" to true inside your XML (or programatically), it will generate a bitmap of your desired location.
Bye.

Can we Get list of Voices(Voice Guidance texts) for the Route TBT info ,So that I can voice these values On my own

From Play Text Delegated function I am getting text to speak when where plat text triggered from Here maps, But I want to call Play-text on my own so I need to text speak.Can we get this list before navigation?
Please find image for better understanding.
Route With Directions
There is no such API in mSDK. But all needed information exists (in the class Maneuver - type of maneuver, direction, street name). You can obtain the list of maneuvers and generate needed text.

3 Android GPS Questions

1) For some reason, the longitude and latitude are slightly different after storing them. For example, when i first find them, they are:
25.171057657111998 and 35.013447496224636 but after I store them , they are
25.1710586547852 and 35.0134468078613. Why is this happening? I store them as floats in an sqlite database, retrieve them with Cursor.getFloat, and print them with String.format of 13 digit accuracy.Can this difference affect the end results in a significant way? I am working with distances <100m (328 feet)
2)I am trying to find the center of a location cluster. Here
http://www.geomidpoint.com/calculation.html
method C says I can just take a simple average if I work with <400km. Has anyone tried it? Is it working? Or should I go for the first, more accurate method?
3) After finding the center, do I need anything else to create a new location object for distance purposes?
To solve this problem you may store longitude and latitude in your sqlite database by this way:
longitude*10^10 , latitude*10^10
when you get them you will divide them by 10^10.
because with 5 decimal is accurate

Android Listview using Google maps

Iam building sample android app . Initially am displaying list with some cities.by clicking on any one of the city it will display map regarding to that city.
now am suffering with how to connect selected city from list with googlemap.any idea please let me know.
You simply make the list of city objects. Each object will contain the name of the city and the location (latitude, longitude). When you click an item, go to a map activity passing the location in the Intent object. In the map activity you'll parse the location and tell the map to go to that point.
Firstly, U have, for example database(or local data structure in your list activity) with cities and corresponding coordinates. Then, in onListItemClick() you create new intent and insert to it's extras necessary data (title, coordinates or primary key of the row in db table). Start new activity extended MapActivity with this intent, take mMapController = mMapView.getController(); and animate to mMapController.animateTo(new GeoPoint((int)yourLatitudeE6,(int)yourLongitudeE6)), where yourLatitudeE6 and yourLongitudeE6 - extras from intent
I think you should have lat and long of city .So you can send that lat and long to mapview through bundle and populate map of that city. In this link you can get complete tutorial for mapview . http://www.vogella.com/articles/AndroidGoogleMaps/article.html

How to get the nearest city from google place api (android) based on a given latitude and longitude

I am getting a latitude and longitude from GPS and want to search the nearest city from my current location.
Currently I'm sending a request to Google Places with types like "neighborhood|locality", but this does not return any nearest city. Even if I only specify "neighborhood" or "locality" by themselves, I still get no results. However if I use a type like "bar" then it returns a list of bars.
I'm using the types listed here:
https://developers.google.com/places/documentation/supported_types
Can anybody tell me what Place Type I should use to get the nearest city or places, or how I can otherwise get the nearest city?
Are you getting back a results array with nothing in it, or simply getting nothing back? The docs say you'll get a results array "even if the service returns no results". Is it possible that the city you're searching contains bars but does not contain anything classified as a "neighborhood" or a "locality"?
This question says
you can restrict the results that will come back in the Autocomplete
to addresses by setting types to 'geocode' ... you can restrict the
results that come back in the Autocomplete to cities by setting types
to 'cities'
If you're just trying to get the city name, rather than searching for something inside the city, perhaps you want to use one of those options?

Categories

Resources