Basic Map Example

Put problem concerning MapActivities, MapViews, Overlays and GPS in this forum.

Basic Map Example

Postby Rani V » Mon Sep 01, 2008 6:43 am

Hi Guys,

I am writing a simple Map Application, but the emulator shows a blank screen only !! Please suggest me what to do . I tried You solution for proxy settings as well
adb shell sqlite3 /data/data/com.google.android.providers.settings/databases/settings.db ""INSERT INTO system VALUES(99,'http_proxy','[HOST]:[PORT]');""

but it complains Syntax error: "(" unexpected

ehat to do now ?

i am using android-sdk-windows-0.9_beta version and eclipse 3.3

Code :

public class MapExample extends MapActivity {
private MapView mMapView;
private String map = "My Map";

/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);

mMapView = new MapView(this, map);
// Latitude and Longitude
GeoPoint p = new GeoPoint((int) (28.38 * 1000000),
(int) (77.12 * 1000000));
MapController mc = mMapView.getController();
mc.animateTo(p);
setContentView(mMapView);
mMapView.isSatellite();
}

@Override
protected boolean isRouteDisplayed() {
// TODO Auto-generated method stub
return true;
}



Error on logcat :
09-01 10:25:32.023: ERROR/OSNetworkSystem(156): unknown socket error -1
09-01 10:25:32.062: ERROR/Database(46): Error inserting count=1 tag=HTTP_STATUS:AndroidHttpConnectionFactory/70597:IOException sum=0.008 using INSERT INTO stats(count, tag, sum) VALUES(?, ?, ?);
09-01 10:25:32.331: ERROR/OSNetworkSystem(156): unknown socket error -1
09-01 10:25:32.342: ERROR/Database(46): Error inserting count=1 tag=HTTP_STATUS:AndroidHttpConnectionFactory/70597:IOException sum=0.02 using INSERT INTO stats(count, tag, sum) VALUES(?, ?, ?);
09-01 10:25:32.761: ERROR/OSNetworkSystem(156): unknown socket error -1
09-01 10:25:32.773: ERROR/Database(46): Error inserting count=1 tag=HTTP_STATUS:AndroidHttpConnectionFactory/70597:IOException sum=0.018 using INSERT INTO stats(count, tag, sum) VALUES(?, ?, ?);
09-01 10:25:33.032: ERROR/OSNetworkSystem(156): unknown socket error -1
09-01 10:25:33.042: ERROR/Database(46): Error inserting count=1 tag=HTTP_STATUS:AndroidHttpConnectionFactory/70597:IOException sum=0.01 using INSERT INTO stats(count, tag, sum) VALUES(?, ?, ?);
09-01 10:25:33.321: ERROR/OSNetworkSystem(156): unknown socket error -1
09-01 10:25:33.331: ERROR/Database(46): Error inserting count=1 tag=HTTP_STATUS:AndroidHttpConnectionFactory/70597:IOException sum=0.009 using INSERT INTO stats(count, tag, sum) VALUES(?, ?, ?);
09-01 10:25:33.631: ERROR/OSNetworkSystem(156): unknown socket error -1
09-01 10:25:33.641: ERROR/Database(46): Error inserting count=1 tag=HTTP_STATUS:AndroidHttpConnectionFactory/70597:IOException sum=0.03 using INSERT INTO stats(count, tag, sum) VALUES(?, ?, ?);
09-01 10:25:33.912: ERROR/OSNetworkSystem(156): unknown socket error -1
09-01 10:25:33.941: ERROR/Database(46): Error inserting count=1 tag=HTTP_STATUS:AndroidHttpConnectionFactory/70597:IOException sum=0.007 using INSERT INTO stats(count, tag, sum) VALUES(?, ?, ?);
09-01 10:25:34.262: ERROR/OSNetworkSystem(156): unknown socket error -1
09-01 10:25:34.271: ERROR/Database(46): Error inserting count=1 tag=HTTP_STATUS:AndroidHttpConnectionFactory/70597:IOException sum=0.02 using INSERT INTO stats(count, tag, sum) VALUES(?, ?, ?);
09-01 10:25:34.521: ERROR/OSNetworkSystem(156): unknown socket error -1
09-01 10:25:34.541: ERROR/Database(46): Error inserting count=1 tag=HTTP_STATUS:AndroidHttpConnectionFactory/70597:IOException sum=0.008 using INSERT INTO stats(count, tag, sum) VALUES(?, ?, ?);
09-01 10:25:34.803: ERROR/OSNetworkSystem(156): unknown socket error -1
09-01 10:25:34.813: ERROR/Database(46): Error inserting count=1 tag=HTTP_STATUS:AndroidHttpConnectionFactory/70597:IOException sum=0.007 using INSERT INTO stats(count, tag, sum) VALUES(?, ?, ?);
09-01 10:25:35.092: ERROR/OSNetworkSystem(156): unknown socket error -1
09-01 10:25:35.101: ERROR/Database(46): Error inserting count=1 tag=HTTP_STATUS:AndroidHttpConnectionFactory/70597:IOException sum=0.007 using INSERT INTO stats(count, tag, sum) VALUES(?, ?, ?);
09-01 10:25:35.432: ERROR/OSNetworkSystem(156): unknown socket error -1
09-01 10:25:35.441: ERROR/Database(46): Error inserting count=1 tag=HTTP_STATUS:AndroidHttpConnectionFactory/70597:IOException sum=0.007 using INSERT INTO stats(count, tag, sum) VALUES(?, ?, ?);
09-01 10:25:35.701: ERROR/OSNetworkSystem(156): unknown socket error -1
09-01 10:25:35.712: ERROR/Database(46): Error inserting count=1 tag=HTTP_STATUS:AndroidHttpConnectionFactory/70597:IOException sum=0.007 using INSERT INTO stats(count, tag, sum) VALUES(?, ?, ?);
09-01 10:25:35.972: ERROR/OSNetworkSystem(156): unknown socket error -1
09-01 10:25:35.981: ERROR/Database(46): Error inserting count=1 tag=HTTP_STATUS:AndroidHttpConnectionFactory/70597:IOException sum=0.017 using INSERT INTO stats(count, tag, sum) VALUES(?, ?, ?);
09-01 10:25:36.241: ERROR/OSNetworkSystem(156): unknown socket error -1
09-01 10:25:36.251: ERROR/Database(46): Error inserting count=1 tag=HTTP_STATUS:AndroidHttpConnectionFactory/70597:IOException sum=0.007 using INSERT INTO stats(count, tag, sum) VALUES(?, ?, ?);
09-01 10:25:36.521: ERROR/OSNetworkSystem(156): unknown socket error -1
09-01 10:25:36.531: ERROR/Database(46): Error inserting count=1 tag=HTTP_STATUS:AndroidHttpConnectionFactory/70597:IOException sum=0.018 using INSERT INTO stats(count, tag, sum) VALUES(?, ?, ?);
09-01 10:25:36.782: ERROR/OSNetworkSystem(156): unknown socket error -1
09-01 10:25:36.792: ERROR/Database(46): Error inserting count=1 tag=HTTP_STATUS:AndroidHttpConnectionFactory/70597:IOException sum=0.008 using INSERT INTO stats(count, tag, sum) VALUES(?, ?, ?);
09-01 10:25:37.053: ERROR/OSNetworkSystem(156): unknown socket error -1
09-01 10:25:37.062: ERROR/Database(46): Error inserting count=1 tag=HTTP_STATUS:AndroidHttpConnectionFactory/70597:IOException sum=0.007 using INSERT INTO stats(count, tag, sum) VALUES(?, ?, ?);
09-01 10:25:37.572: ERROR/OSNetworkSystem(156): unknown socket error -1
09-01 10:25:37.583: ERROR/Database(46): Error inserting count=1 tag=HTTP_STATUS:AndroidHttpConnectionFactory/70597:IOException sum=0.007 using INSERT INTO stats(count, tag, sum) VALUES(?, ?, ?);
09-01 10:25:39.702: ERROR/OSNetworkSystem(156): unknown socket error -1
09-01 10:25:39.712: ERROR/Database(46): Error inserting count=1 tag=HTTP_STATUS:AndroidHttpConnectionFactory/70597:IOException sum=0.015 using INSERT INTO stats(count, tag, sum) VALUES(?, ?, ?);
09-01 10:25:42.371: ERROR/OSNetworkSystem(156): unknown socket error -1
09-01 10:25:42.383: ERROR/Database(46): Error inserting count=1 tag=HTTP_STATUS:AndroidHttpConnectionFactory/70597:IOException sum=0.008 using INSERT INTO stats(count, tag, sum) VALUES(?, ?, ?);
09-01 10:25:45.562: ERROR/OSNetworkSystem(156): unknown socket error -1
09-01 10:25:45.572: ERROR/Database(46): Error inserting count=1 tag=HTTP_STATUS:AndroidHttpConnectionFactory/70597:IOException sum=0.008 using INSERT INTO stats(count, tag, sum) VALUES(?, ?, ?);
09-01 10:25:49.562: ERROR/OSNetworkSystem(156): unknown socket error -1
09-01 10:25:49.572: ERROR/Database(46): Error inserting count=1 tag=HTTP_STATUS:AndroidHttpConnectionFactory/70597:IOException sum=0.008 using INSERT INTO stats(count, tag, sum) VALUES(?, ?, ?);
09-01 10:25:54.532: ERROR/OSNetworkSystem(156): unknown socket error -1
09-01 10:25:54.542: ERROR/Database(46): Error inserting count=1 tag=HTTP_STATUS:AndroidHttpConnectionFactory/70597:IOException sum=0.023 using INSERT INTO stats(count, tag, sum) VALUES(?, ?, ?);
09-01 10:26:00.702: ERROR/OSNetworkSystem(156): unknown socket error -1
09-01 10:26:00.712: ERROR/Database(46): Error inserting count=1 tag=HTTP_STATUS:AndroidHttpConnectionFactory/70597:IOException sum=0.009 using INSERT INTO stats(count, tag, sum) VALUES(?, ?, ?);
09-01 10:26:08.472: ERROR/OSNetworkSystem(156): unknown socket error -1
09-01 10:26:08.482: ERROR/Database(46): Error inserting count=1 tag=HTTP_STATUS:AndroidHttpConnectionFactory/70597:IOException sum=0.056 using INSERT INTO stats(count, tag, sum) VALUES(?, ?, ?);
09-01 10:26:18.191: ERROR/OSNetworkSystem(156): unknown socket error -1
09-01 10:26:18.203: ERROR/Database(46): Error inserting count=1 tag=HTTP_STATUS:AndroidHttpConnectionFactory/70597:IOException sum=0.008 using INSERT INTO stats(count, tag, sum) VALUES(?, ?, ?);
09-01 10:26:30.191: ERROR/OSNetworkSystem(156): unknown socket error -1
09-01 10:26:30.201: ERROR/Database(46): Error inserting count=1 tag=HTTP_STATUS:AndroidHttpConnectionFactory/70597:IOException sum=0.008 using INSERT INTO stats(count, tag, sum) VALUES(?, ?, ?);
09-01 10:26:45.192: ERROR/OSNetworkSystem(156): unknown socket error -1
09-01 10:26:45.202: ERROR/Database(46): Error inserting count=1 tag=HTTP_STATUS:AndroidHttpConnectionFactory/70597:IOException sum=0.008 using INSERT INTO stats(count, tag, sum) VALUES(?, ?, ?);
09-01 10:27:03.911: ERROR/OSNetworkSystem(156): unknown socket error -1
09-01 10:27:03.923: ERROR/Database(46): Error inserting count=1 tag=HTTP_STATUS:AndroidHttpConnectionFactory/70597:IOException sum=0.019 using INSERT INTO stats(count, tag, sum) VALUES(?, ?, ?);
09-01 10:27:27.352: ERROR/OSNetworkSystem(156): unknown socket error -1
09-01 10:27:27.371: ERROR/Database(46): Error inserting count=1 tag=HTTP_STATUS:AndroidHttpConnectionFactory/70597:IOException sum=0.013 using INSERT INTO stats(count, tag, sum) VALUES(?, ?, ?);
09-01 10:27:56.552: ERROR/OSNetworkSystem(156): unknown socket error -1
09-01 10:27:56.591: ERROR/Database(46): Error inserting count=1 tag=HTTP_STATUS:AndroidHttpConnectionFactory/70597:IOException sum=0.019 using INSERT INTO stats(count, tag, sum) VALUES(?, ?, ?);
09-01 10:28:41.391: ERROR/OSNetworkSystem(156): unknown socket error -1
09-01 10:28:41.481: ERROR/Database(46): Error inserting count=1 tag=HTTP_STATUS:AndroidHttpConnectionFactory/70597:IOException sum=0.105 using INSERT INTO stats(count, tag, sum) VALUES(?, ?, ?);
09-01 10:29:27.032: ERROR/OSNetworkSystem(156): unknown socket error -1
09-01 10:29:27.061: ERROR/Database(46): Error inserting count=1 tag=HTTP_STATUS:AndroidHttpConnectionFactory/70597:IOException sum=0.018 using INSERT INTO stats(count, tag, sum) VALUES(?, ?, ?);
09-01 10:30:23.961: ERROR/OSNetworkSystem(156): unknown socket error -1
09-01 10:30:23.992: ERROR/Database(46): Error inserting count=1 tag=HTTP_STATUS:AndroidHttpConnectionFactory/70597:IOException sum=0.027 using INSERT INTO stats(count, tag, sum) VALUES(?, ?, ?);
09-01 10:31:35.102: ERROR/OSNetworkSystem(156): unknown socket error -1
09-01 10:31:35.131: ERROR/Database(46): Error inserting count=1 tag=HTTP_STATUS:AndroidHttpConnectionFactory/70597:IOException sum=0.02 using INSERT INTO stats(count, tag, sum) VALUES(?, ?, ?);
09-01 10:33:03.981: ERROR/OSNetworkSystem(156): unknown socket error -1
09-01 10:33:04.002: ERROR/Database(46): Error inserting count=1 tag=HTTP_STATUS:AndroidHttpConnectionFactory/70597:IOException sum=0.022 using INSERT INTO stats(count, tag, sum) VALUES(?, ?, ?);
09-01 10:34:55.073: ERROR/OSNetworkSystem(156): unknown socket error -1
09-01 10:34:55.105: ERROR/Database(46): Error inserting count=1 tag=HTTP_STATUS:AndroidHttpConnectionFactory/70597:IOException sum=0.015 using INSERT INTO stats(count, tag, sum) VALUES(?, ?, ?);
09-01 10:35:04.791: ERROR/Database(46): Error inserting tag=WAKELOCK:ActivityManager-Launch sum=2.703 count=1 using INSERT INTO stats(tag, sum, count) VALUES(?, ?, ?);
09-01 10:35:04.801: ERROR/Database(46): Error inserting tag=WAKELOCK:sleep_notification sum=15.12 count=1 using INSERT INTO stats(tag, sum, count) VALUES(?, ?, ?);
09-01 10:35:04.832: ERROR/Database(46): Error inserting tag=WAKELOCK:kernel:android_alarm sum=0.234 count=11 using INSERT INTO stats(tag, sum, count) VALUES(?, ?, ?);
09-01 10:35:04.881: ERROR/Database(46): Error inserting tag=WAKELOCK:kernel:inotify sum=0.0 count=0 using INSERT INTO stats(tag, sum, count) VALUES(?, ?, ?);
09-01 10:35:04.922: ERROR/Database(46): Error inserting tag=WAKELOCK:RILJ sum=8684.62 count=33 using INSERT INTO stats(tag, sum, count) VALUES(?, ?, ?);
09-01 10:35:04.951: ERROR/Database(46): Error inserting tag=WAKELOCK:keyguard sum=108.428 count=2 using INSERT INTO stats(tag, sum, count) VALUES(?, ?, ?);
09-01 10:35:04.993: ERROR/Database(46): Error inserting tag=WAKELOCK:KeyInputQueue sum=800.72 count=8 using INSERT INTO stats(tag, sum, count) VALUES(?, ?, ?);
09-01 10:35:05.012: ERROR/Database(46): Error inserting tag=WAKELOCK:kernel:evdev sum=0.009 count=7 using INSERT INTO stats(tag, sum, count) VALUES(?, ?, ?);
09-01 10:35:05.051: ERROR/Database(46): Error inserting tag=WAKELOCK:kernel:radio-interface sum=3.513 count=3 using INSERT INTO stats(tag, sum, count) VALUES(?, ?, ?);
09-01 10:35:05.072: ERROR/Database(46): Error inserting tag=WAKELOCK:kernel:KeyEvents sum=0.12 count=19 using INSERT INTO stats(tag, sum, count) VALUES(?, ?, ?);
09-01 10:35:05.113: ERROR/Database(46): Error inserting tag=WAKELOCK:MediaScannerService sum=1.449 count=1 using INSERT INTO stats(tag, sum, count) VALUES(?, ?, ?);
09-01 10:35:05.132: ERROR/Database(46): Error inserting tag=WAKELOCK:AlarmManager sum=3090.094 count=11 using INSERT INTO stats(tag, sum, count) VALUES(?, ?, ?);
09-01 10:38:08.363: ERROR/OSNetworkSystem(156): unknown socket error -1
09-01 10:38:08.483: ERROR/Database(46): Error inserting count=1 tag=HTTP_STATUS:AndroidHttpConnectionFactory/70597:IOException sum=0.582 using INSERT INTO stats(count, tag, sum) VALUES(?, ?, ?);
09-01 10:41:01.961: ERROR/OSNetworkSystem(156): unknown socket error -1
09-01 10:41:01.971: ERROR/Database(46): Error inserting count=1 tag=HTTP_STATUS:AndroidHttpConnectionFactory/70597:IOException sum=0.029 using INSERT INTO stats(count, tag, sum) VALUES(?, ?, ?);
09-01 10:44:38.881: ERROR/OSNetworkSystem(156): unknown socket error -1
09-01 10:44:38.902: ERROR/Database(46): Error inserting count=1 tag=HTTP_STATUS:AndroidHttpConnectionFactory/70597:IOException sum=0.013 using INSERT INTO stats(count, tag, sum) VALUES(?, ?, ?);
09-01 10:45:05.181: ERROR/Database(46): Error inserting tag=WAKELOCK:kernel:android_alarm sum=1.233 count=10 using INSERT INTO stats(tag, sum, count) VALUES(?, ?, ?);
09-01 10:45:05.193: ERROR/Database(46): Error inserting tag=WAKELOCK:kernel:inotify sum=0.0 count=0 using INSERT INTO stats(tag, sum, count) VALUES(?, ?, ?);
09-01 10:45:05.202: ERROR/Database(46): Error inserting tag=WAKELOCK:RILJ sum=25423.111 count=28 using INSERT INTO stats(tag, sum, count) VALUES(?, ?, ?);
09-01 10:45:05.223: ERROR/Database(46): Error inserting tag=WAKELOCK:AlarmManager sum=9102.406 count=10 using INSERT INTO stats(tag, sum, count) VALUES(?, ?, ?);
09-01 10:49:10.212: ERROR/OSNetworkSystem(156): unknown socket error -1
09-01 10:49:10.251: ERROR/Database(46): Error inserting count=1 tag=HTTP_STATUS:AndroidHttpConnectionFactory/70597:IOException sum=0.023 using INSERT INTO stats(count, tag, sum) VALUES(?, ?, ?);
09-01 10:54:13.342: ERROR/OSNetworkSystem(156): unknown socket error -1
09-01 10:54:15.216: ERROR/Database(46): Error inserting count=1 tag=HTTP_STATUS:AndroidHttpConnectionFactory/70597:IOException sum=0.009 using INSERT INTO stats(count, tag, sum) VALUES(?, ?, ?);
09-01 10:55:05.662: ERROR/Database(46): Error inserting tag=WAKELOCK:kernel:android_alarm sum=0.029 count=10 using INSERT INTO stats(tag, sum, count) VALUES(?, ?, ?);
09-01 10:55:05.682: ERROR/Database(46): Error inserting tag=WAKELOCK:kernel:inotify sum=0.0 count=0 using INSERT INTO stats(tag, sum, count) VALUES(?, ?, ?);
09-01 10:55:05.711: ERROR/Database(46): Error inserting tag=WAKELOCK:RILJ sum=45039.806 count=30 using INSERT INTO stats(tag, sum, count) VALUES(?, ?, ?);
09-01 10:55:05.711: ERROR/Database(46): Error inserting tag=WAKELOCK:AlarmManager sum=15087.295 count=10 using INSERT INTO stats(tag, sum, count) VALUES(?, ?, ?);
09-01 10:59:15.422: ERROR/OSNetworkSystem(156): unknown socket error -1
09-01 10:59:15.441: ERROR/Database(46): Error inserting count=1 tag=HTTP_STATUS:AndroidHttpConnectionFactory/70597:IOException sum=0.075 using INSERT INTO stats(count, tag, sum) VALUES(?, ?, ?);
Rani V
Once Poster
Once Poster
 
Posts: 1
Joined: Mon Sep 01, 2008 6:26 am

Top

Postby ducateg » Wed Sep 03, 2008 5:28 pm

Network error probably means you need to set a permission in the manifest file (child of manifest, you can stick it as the last line before the closing manifest tag):

Syntax: [ Download ] [ Hide ]
Using xml Syntax Highlighting
  1. </uses-permission><uses-permission xmlns:android="http://schemas.android.com/apk/res/android" android:name="android.permission.INTERNET"></uses-permission>
Parsed in 0.001 seconds, using GeSHi 1.0.8.4


It seems you will also have to stick:


Syntax: [ Download ] [ Hide ]
Using xml Syntax Highlighting
  1. <uses-library android:name="com.google.android.maps" />
  2.  
  3.  
  4.  
  5.  
Parsed in 0.000 seconds, using GeSHi 1.0.8.4


As an Application tag child (i think it is new).

I have done this but I am struggling to get the map to move using animate and zoom. There probably exists some more parameters I do not know of... Anyone can add to this?
User avatar
ducateg
Junior Developer
Junior Developer
 
Posts: 19
Joined: Mon Jul 07, 2008 10:32 am
Location: Ipswich UK

Postby ducateg » Wed Sep 03, 2008 5:30 pm

Sorry, do not forget these permissions too:

Syntax: [ Download ] [ Hide ]
Using xml Syntax Highlighting
  1. <uses-permission android:name="android.permission.ACCESS_LOCATION">
  2.  
  3. </uses-permission><uses-permission android:name="android.permission.ACCESS_GPS">
Parsed in 0.001 seconds, using GeSHi 1.0.8.4
User avatar
ducateg
Junior Developer
Junior Developer
 
Posts: 19
Joined: Mon Jul 07, 2008 10:32 am
Location: Ipswich UK

Postby Marcel » Wed Sep 03, 2008 7:23 pm

I have done this but I am struggling to get the map to move using animate and zoom. There probably exists some more parameters I do not know of... Anyone can add to this?


I built a map demo with zoom controls and some other basic functions. Check out: http://www.marcelp.info/2008/08/28/android-map-demo/
Marcel
Freshman
Freshman
 
Posts: 9
Joined: Sun Jan 20, 2008 7:49 pm
Location: Germany

Top

Return to Map Problems

Who is online

Users browsing this forum: No registered users and 7 guests