Im having a problem in inflating the map. At first if I click the EditText
It will launch, If I cancel / ok the AlertDialog.Builder
, and click again the EditText
it will cause:
E/MapError: android.view.InflateException: Binary XML file line #10: Error inflating class fragment
The logic is: I'm done with the Region and Province. Passing the Region and Province in the MapFragment
to set Camera Position of the selected Region & Province, this is my only problem aside from the MapError.
My code for Map
:
//START MAP FRAGMENT DIALOG
public void alertOrgMapSetMarker(){
LayoutInflater layoutInflater = getLayoutInflater();
View getView = layoutInflater.inflate(R.layout.map_inflate_org,null);
mapFragment = (MapFragment) getFragmentManager().findFragmentById(R.id.map_fragment_org);
AlertDialog.Builder alertMap = new AlertDialog.Builder(AdminCreateEventActivity.this,R.style.AlertDialogCustom);
alertMap.setTitle("Mark Location")
.setView(getView)
.setCancelable(false)
.setPositiveButton("Set", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
}
})
.setNegativeButton(R.string.cancel, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
}
});
AlertDialog mapDialog = alertMap.create();
mapDialog.show();
}
I cannot getView
from this line of code. In order to have control. I want to @Override -
setMapClickListener
mapFragment = (MapFragment) getFragmentManager().findFragmentById(R.id.map_fragment_org);
My inflated XML: map_inflate.xml
<FrameLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:map="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent">
<fragment
android:layout_width="match_parent"
android:layout_height="match_parent"
android:name="com.google.android.gms.maps.MapFragment"
android:id="@+id/map_fragment_org"
map:cameraBearing="112.5"
map:cameraTargetLat="10.3157"
map:cameraTargetLng="123.8854"
map:cameraTilt="45"
map:cameraZoom="30"
map:mapType="normal"
map:uiCompass="true"
map:uiRotateGestures="true"
map:uiScrollGestures="true"
map:uiTiltGestures="true"
map:uiZoomControls="true"
map:uiZoomGestures="true"
tools:ignore="MissingPrefix"/>
I really need your help. Thank you.