无法将android.app.Fragment强制转换为mapping.SupportMapFragment

时间:2018-12-26 17:05:39

标签: java android here-api

我从此处的地图文档中添加了该行标记,并且未编译

mapFragment = (SupportMapFragment) getFragmentManager().findFragmentById(R.id.supportmapfragmentj);

我正在

  

无法将android.app.Fragment转换为com.here.android.mpa.mapping.SupportMapFragment

知道我的片段xml如下

<?xml version="1.0" encoding="utf-8"?>
<android.support.constraint.ConstraintLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    tools:context=".MapGuiTestActivityJ">

<fragment
        class="com.here.android.mpa.mapping.SupportMapFragment"
        android:id="@+id/supportmapfragmentj"
        android:layout_width="match_parent"
        android:layout_height="match_parent"/>

</android.support.constraint.ConstraintLayout>

2 个答案:

答案 0 :(得分:1)

也许使用“ Support Fragment Manager”可以解决此问题

尝试更换

mapFragment = (SupportMapFragment) getFragmentManager().findFragmentById(R.id.supportmapfragmentj);

使用

mapFragment = (SupportMapFragment) getSupportFragmentManager().findFragmentById(R.id.supportmapfragmentj);

答案 1 :(得分:0)

尝试一下:

f2 <- function(p){
  # c("a", "b") -->> "('a'), ('b'), (NULL)"
  s <- paste(<summary>_paste("('", p, "'),", sep=""), " (NULL)", sep = "")
  # ms sql
  qry <- paste("select x + '+' as p from values(", s, ")t(x) where x is not NULL", sep = "")
  odbcConnect(..)
  return(sqlQuery(h, qry))
}

其中mapFragment = (SupportMapFragment) rootView.findViewById(R.id.supportmapfragmentj); 是视图容器,您在rootView中返回