小编DjP*_*DjP的帖子

如何在片段中访问getSupportFragmentManager()?

我有一个FragmentActivity,我想在其中使用一个地图片段.我在获取支持片段管理器访问它时遇到问题.

 if (googleMap == null) {
            googleMap = ((SupportMapFragment) getSupportFragmentManager()
                    .findFragmentById(R.id.map1)).getMap();

            // check if map is created successfully or not
            if (googleMap == null) {
                Toast.makeText(getApplicationContext(),
                        "Sorry! unable to create maps", Toast.LENGTH_SHORT)
                        .show();
            }
        }

            // create marker
            MarkerOptions marker = new MarkerOptions().position(
                    new LatLng(latitude, longitude)).title("Hello Maps ");

            CameraPosition cameraPosition = new CameraPosition.Builder()
                    .target(new LatLng(latitude, longitude)).zoom(15).build();

            googleMap.animateCamera(CameraUpdateFactory
                    .newCameraPosition(cameraPosition));

            // adding marker
            googleMap.addMarker(marker);
Run Code Online (Sandbox Code Playgroud)

android android-fragments android-fragmentactivity android-support-library fragmentmanager

139
推荐指数
10
解决办法
20万
查看次数

makefile 多个目标模式。停止

面对makefile中的以下错误

Makefile:54: *** multiple target patterns.  Stop.
Run Code Online (Sandbox Code Playgroud)

makefile 的完整源代码如下

MINGW_HOME ?= C:/mingw
PRODUCTNAME ?= Jitsi
COMPANYNAME ?= jitsi.org
PRODUCTBUILDVERSION ?= 1.0.0.0
PRODUCTBUILDVERSION_COMMA ?= 1,0,0,0
TARGET_BASENAME ?= run
TARGET_DIR ?= ../../../../release/windows/tmp

ifeq ($(wildcard /bin/cygpath.*),/bin/cygpath.exe)
    target.dir := $(shell cygpath --mixed "$(TARGET_DIR)")
    cygwin.target.dir := $(shell cygpath --unix "$(TARGET_DIR)")
else
    target.dir := $(TARGET_DIR)
    cygwin.target.dir := $(TARGET_DIR)
endif

CC = $(MINGW_HOME)/bin/gcc.exe
CPPFLAGS := $(CPPFLAGS) \
    -Wall -Wreturn-type \
    -DPSAPI_VERSION=1 \
    -DWINVER=0x0502 -D_WIN32_WINNT=0x0502 \
    -I$(target.dir) \
    -I"$(JAVA_HOME)/include" -I"$(JAVA_HOME)/include/win32"
LDFLAGS = -mwindows
LIBS = -ladvapi32 -lpsapi

MACHINE …
Run Code Online (Sandbox Code Playgroud)

java eclipse gnu makefile cmake

0
推荐指数
1
解决办法
4836
查看次数