android - Trying to make a map -
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(); } } }
"for odd reason area says .getmap() isnt working. can help."
try removing .getmap() part , putting getmapasync() instead.
private void setupmapifneeded() { // null check confirm have not instantiated map. if (mmap == null) { // try obtain map supportmapfragment. mmap =((supportmapfragment)getsupportfragmentmanager().findfragmentbyid(r.id.map)); mapfragment.getmapasync(this); // check if successful in obtaining map. if (mmap != null) { setupmap(); } } }
Comments
Post a Comment