android - R.java doesn't have map for R.id.map -


so i'm following this guide letter (or @ least trying to).

and aside having import things not specified in guide, fine except there red squiggle can't explain.

in line:

googlemap map = ((supportmapfragment)  getsupportfragmentmanager().findfragmentbyid(r.id.map)).getmap(); 

there red mark under "map" in "r.id.map".

import com.google.android.gms.common.googleplayservicesutil; import com.google.android.gms.maps.*;  import android.os.bundle; import android.app.activity; import android.support.v4.app.fragmentactivity; import android.view.menu;  public class mainactivity extends fragmentactivity {     @override    protected void oncreate(bundle savedinstancestate) {         googleplayservicesutil.isgoogleplayservicesavailable(getapplicationcontext());         super.oncreate(savedinstancestate);         setcontentview(r.layout.activity_main);         googlemap map = ((supportmapfragment)      getsupportfragmentmanager().findfragmentbyid(r.id.map)).getmap();     }      @override     public boolean oncreateoptionsmenu(menu menu) {         // inflate menu; adds items action bar if present.         getmenuinflater().inflate(r.menu.main, menu);         return true;     } } 

i have included android-support-v4.jar buildpath , have downloaded correctly google sdk (including google play services). have api key too. apparently should working now.

seems me step 7 1 missing resource comes from:

update res/layout/activity_main.xml , replace entire contents

<fragment xmlns:android="http://schemas.android.com/apk/res/android"  android:id="@+id/map"  android:layout_width="match_parent"   android:layout_height="match_parent"   class="com.google.android.gms.maps.supportmapfragment"/> 

in eclipse need to:

  1. change file
  2. save it
  3. clean project (to regenerate resoureces, among them r.java)

Comments

Popular posts from this blog

linux - Does gcc have any options to add version info in ELF binary file? -

android - send complex objects as post php java -

charts - What graph/dashboard product is facebook using in Dashboard: PUE & WUE -