Select to view content in your preferred language

Can not add my own map to the android application

832
5
07-26-2013 12:24 AM
EstherKunda
New Contributor
Hello,

I am new to Arcgis android and i wanted to add my own map: http://www.arcgis.com/home/webmap/viewer.html?webmap=f8ab9f0b818b4ece966c4b2cf91fa0c1 with the data layer visible but only the basemap is displaying.
0 Kudos
5 Replies
AndyGup
Esri Regular Contributor
Esther, make sure you are using the coding pattern for a "web map", which is a map created on ArcGIS.com.

package com.esri.arcgis.android.samples.webmap;

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

import com.esri.android.map.MapView;

public class WebMap extends Activity {
 MapView mMapView = null;

 @Override
 public void onCreate(Bundle savedInstanceState) {
  super.onCreate(savedInstanceState);
  
  mMapView = new MapView(
    getApplicationContext(), 
    "http://www.arcgis.com/home/item.html?id=f8ab9f0b818b4ece966c4b2cf91fa0c1",
    null, null);
  setContentView(mMapView);
  
 }
 
 @Override
 protected void onPause() {
  super.onPause();
  mMapView.pause();
 }

 @Override
 protected void onResume() {
  super.onResume(); 
  mMapView.unpause();
 } 
 
}
0 Kudos
ReenaMedavarapu
New Contributor

I happen to have the same problem as Esther, but when I attempted to use this code, AndroidStudio wouldn't let me import the MapView class like you did at the top. How do I fix this?

0 Kudos
EricBader
Honored Contributor

Reena, can you confirm that you've followed the steps in this tutorial? Develop your first map app with Java—ArcGIS Runtime SDK for Android | ArcGIS for Developers 

0 Kudos
EstherKunda
New Contributor
Hello Andygup,

Thank you for the response it worked perfectly but wonder why it was not included in the tutorial for first timers like me.

Anyway I kept trying to have the popup with the info in each district but it does not appear and i tried to enable the popups but failed also tried to use the application as a feature layer but still can't figure out how to bring display the popups that are in the original web map to display in the android app.


thanks again for the great help and sorry for the late reply.
0 Kudos
ShellyGill1
Esri Contributor

Hi Esther - you might find some of the Dev Labs useful - we have a Dev Lab which covers displaying a web map in a simple Android app - Display a web map | ArcGIS for Developers  (this builds on a basic app where you create a map directly in code - just like the initial tutorial you followed). You can find all of the Android-specific Dev Labs here - Browse ArcGIS DevLabs | ArcGIS for Developers  - there's also Dev Labs for users new to ArcGIS, covering importing and preparing data, and designing and configuring maps, so possibly you'll find these useful as well? (Not sure if you're also new to ArcGIS generally, or just the ArcGIS Runtime SDK for Android) - Get Started with ArcGIS DevLabs | ArcGIS for Developers .

Cheers,

Shelly

0 Kudos