Select to view content in your preferred language

Action button doesn't show

1275
0
06-18-2014 10:32 AM
JonathanGagnon1
New Contributor
Hi! I'm a total newbie in development. Trying to put a action map icon in my action bar but it doesn't show.

Here's my code

REGEULActivity.java

package com.JOGAG291.REGEUL;

import android.app.Activity;
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuInflater;
import com.esri.android.map.MapOptions;
import com.esri.android.map.MapView;
import com.esri.core.geometry.Polygon;


public class REGEULActivity extends Activity {

MapView mMapView = null;
// create MapOptions for each basemap
MapOptions topo;
MapOptions streets;
MapOptions natGeo;
MapOptions ocean;
// used to maintain extent when switching basemaps
Polygon extent;

    /** Called when the activity is first created. */
    /* (non-Javadoc)
     * @see android.app.Activity#onCreate(android.os.Bundle)
     */
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);

     // Retrieve the map and initial extent from XML layout
       mMapView = (MapView) findViewById(R.id.map);

       // attribute ESRI logo to map
       mMapView.setEsriLogoVisible(true);
       // enable map to wrap around date line
       mMapView.enableWrapAround(true);
    }
   
    @Override
    public boolean onCreateOptionsMenu(Menu menu) {
        MenuInflater inflater = getMenuInflater();
        inflater.inflate(R.menu.items, menu);
        return super.onCreateOptionsMenu(menu);
    }
   
  
@Override
protected void onDestroy() {
  super.onDestroy();
}
@Override
protected void onPause() {
  super.onPause();
  mMapView.pause();
}
@Override
protected void onResume() {
  super.onResume();
  mMapView.unpause();
}

}

Res/main.xml


<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android: orientation="vertical" >

    <!-- MapView layout and initial extent -->

    <com.esri.android.map.MapView
        android:id="@+id/map"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        mapoptions.MapType="topo"
        mapoptions.ZoomLevel="16"
        mapoptions.center="46.781980, -71.274814" >
    </com.esri.android.map.MapView>
   

</LinearLayout>


Res/items.xml

<?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto" >
  
    <item android:id="@+id/action_map"
    android:icon="@drawable/ic_action_map"
    android:title="@string/action_map"
    android:showAsAction="ifRoom" />
</menu>


Thanks to take a look at it!

Jonathan
0 Kudos
0 Replies