0
我已经在我的项目,在XML(主)有两个片段的活性:在运行时Android权限与片段
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingBottom="@dimen/activity_vertical_margin"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
tools:context="com.example.fragments.MainActivity">
<fragment
android:id="@+id/map"
android:layout_width="match_parent"
android:layout_height="match_parent"
class="com.google.android.gms.maps.MapFragment" />
<fragment
android:id="@+id/list"
android:layout_width="match_parent"
android:layout_height="match_parent"
class="com.example.list" />
</RelativeLayout>
所以就像你所看到的,其中之一就是地图片段。 问题是当setContentView()
正在运行时,应用程序崩溃在API 23之上。 我试图在setContentView()
之前进行(位置)权限检查,使用documantation,应用程序仍然崩溃。 有什么想法?
你并不需要显示在地图的任何许可。如果您访问用户的位置,则只需要获得许可。发布您的活动代码。 –
感谢Jyotman Singh,你的回答让我明白我失去了什么。 – Daniel