Google Maps Activity error on Android Studio -


i created google maps activity on android studio methods , classes imported on red

enter image description here

i found same question here doesn't have solution. problem of this?

here whole class file, methods , imports red

   package com.samplemap.dens.myapplication;   import android.support.v4.app.fragmentactivity; import android.os.bundle; import com.google.android.gms.maps.googlemap; import com.google.android.gms.maps.supportmapfragment; import com.google.android.gms.maps.model.latlng; import com.google.android.gms.maps.model.markeroptions;   public class mapsactivity extends fragmentactivity {  private googlemap mmap; // might null if google play services apk not available.  @override protected void oncreate(bundle savedinstancestate) {     super.oncreate(savedinstancestate);     setcontentview(r.layout.activity_maps);     setupmapifneeded(); }  @override protected void onresume() {     super.onresume();     setupmapifneeded(); }  /**  * sets map if possible (i.e., google play services apk correctly  * installed) , map has not been instantiated.. ensure ever  * call {@link #setupmap()} once when {@link #mmap} not null.  * <p/>  * if isn't installed {@link supportmapfragment} (and  * {@link com.google.android.gms.maps.mapview mapview}) show prompt user  * install/update google play services apk on device.  * <p/>  * user can return fragmentactivity after following prompt , correctly  * installing/updating/enabling google play services. since fragmentactivity may not  * have been destroyed during process (it  * stopped or paused), {@link #oncreate(bundle)} may not called again should call  * method in {@link #onresume()} guarantee called.  */ private void setupmapifneeded() {     // null check confirm have not instantiated map.     if (mmap == null) {         // try obtain map supportmapfragment.         mmap = ((supportmapfragment) getsupportfragmentmanager().findfragmentbyid(r.id.map))                 .getmap();         // check if successful in obtaining map.         if (mmap != null) {             setupmap();         }     } }  /**  * can add markers or lines, add listeners or move camera. in case,  * add marker near africa.  * <p/>  * should called once , when sure {@link #mmap} not null.  */ private void setupmap() {     mmap.addmarker(new markeroptions().position(new latlng(0, 0)).title("marker")); } } 

add dependency in gradle , rebuild project

apply plugin: 'com.android.application' ...

dependencies {     compile 'com.google.android.gms:play-services:7.5.0' } 

Comments