Select to view content in your preferred language

No map display when run HelloWorldSample in my Android machine.

399
1
08-19-2012 12:24 AM
YILINGLIU
New Contributor
Hi, All~

I'm new to GIS and android. When I make my first program using the hello world example, There is only a grey screen in my phone. I don't know what happened. I have been thinking about this for quite a few days. Very annoying!~
Would anybody help me pls?:confused:

HelloWorld Manifest:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
      package="com.esri.arcgis.android.samples"
      android:versionCode="1"
      android:versionName="1.0">
    <application android:icon="@drawable/icon" android:label="@string/app_name" android:debuggable="true">
        <activity android:name=".HelloWorld"
                  android:label="@string/app_name">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>

    </application>


<uses-permission android:name="android.permission.INTERNET"></uses-permission>
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"></uses-permission>
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"></uses-permission>
<uses-sdk android:minSdkVersion="7" />
</manifest>


Hello world .java

/* Copyright 2010 ESRI
*
* All rights reserved under the copyright laws of the United States
* and applicable international laws, treaties, and conventions.
*
* You may freely redistribute and use this sample code, with or
* without modification, provided you include the original copyright
* notice and use restrictions.
*
* See the ?Sample code usage restrictions? document for further information.
*
*/

package com.esri.arcgis.android.samples;

import android.app.Activity;
import android.os.Bundle;

import com.esri.android.map.MapView;

public class HelloWorld extends Activity {

MapView map = null;

/** Called when the activity is first created. */
public void onCreate(Bundle savedInstanceState) {
  super.onCreate(savedInstanceState);
  setContentView(R.layout.main);
  map = (MapView) findViewById(R.id.map);
 
  //Retrieve the non-configuration instance data that was previously returned.
  Object init = getLastNonConfigurationInstance();
  if (init != null) {
   map.restoreState((String) init);
  }
}

/** Called by the system, as part of destroying an activity due to a configuration change. */
public Object onRetainNonConfigurationInstance() {
  return map.retainState();
}

}
0 Kudos
1 Reply
SimonKlein
Regular Contributor
I guess the map has no layer.
You need to add a layer to the map, so it can load something.
Look here at section 6: http://resources.arcgis.com/en/help/android-sdk/concepts/index.html#/Hello_World_Map/011900000005000...
0 Kudos