dictionary - android map fragment in dialog fragment -
this xml code dialogfragment.xml:
<linearlayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="wrap_content" android:layout_height="match_parent" android:orientation="vertical" > <textview android:layout_width="wrap_content" android:layout_height="wrap_content" android:text = "this map"/> <fragment android:layout_width="match_parent" android:layout_height="wrap_content" android:name="com.google.android.gms.maps.mapfragment"/> </linearlayout>
this java code:
public class mydialog extends dialogfragment implements onclicklistener { public view oncreateview(layoutinflater inflater, viewgroup container,bundle savedinstancestate) { getdialog().settitle("title"); view v = inflater.inflate(r.layout.dialogfragment.xml, null); return v; } public void onclick(view arg0) { } public void ondismiss(dialoginterface dialog) { super.ondismiss(dialog); } public void oncancel(dialoginterface dialog) { super.oncancel(dialog); } }
when testing code first time opening dialog works map, when clicking on button , again opening button stops working. when removing map works ok(never shows error). please me make dialog fragment work map without error, thank in advance.
this error log:
04-06 15:15:57.434: e/androidruntime(13393): fatal exception: main 04-06 15:15:57.434: e/androidruntime(13393): process: com.example.newapp, pid: 11391 04-06 15:15:57.434: e/androidruntime(13393): android.view.inflateexception: binary xml file line #86: error inflating class fragment 04-06 15:15:57.434: e/androidruntime(13393): @ android.view.layoutinflater.createviewfromtag(layoutinflater.java:713) 04-06 15:15:57.434: e/androidruntime(13393): @ android.view.layoutinflater.rinflate(layoutinflater.java:755) 04-06 15:15:57.434: e/androidruntime(13393): @ android.view.layoutinflater.inflate(layoutinflater.java:492) 04-06 15:15:57.434: e/androidruntime(13393): @ android.view.layoutinflater.inflate(layoutinflater.java:397) 04-06 15:15:57.434: e/androidruntime(13393): @ android.view.layoutinflater.inflate(layoutinflater.java:353) 04-06 15:15:57.434: e/androidruntime(13393): @ com.example.newapp.reqdialog.oncreateview(mydialog.java:16) 04-06 15:15:57.434: e/androidruntime(13393): @ android.app.fragment.performcreateview(fragment.java:1700) 04-06 15:15:57.434: e/androidruntime(13393): @ android.app.fragmentmanagerimpl.movetostate(fragmentmanager.java:890) 04-06 15:15:57.434: e/androidruntime(13393): @ android.app.fragmentmanagerimpl.movetostate(fragmentmanager.java:1062) 04-06 15:15:57.434: e/androidruntime(13393): @ android.app.backstackrecord.run(backstackrecord.java:684) 04-06 15:15:57.434: e/androidruntime(13393): @ android.app.fragmentmanagerimpl.execpendingactions(fragmentmanager.java:1447) 04-06 15:15:57.434: e/androidruntime(13393): @ android.app.fragmentmanagerimpl$1.run(fragmentmanager.java:443) 04-06 15:15:57.434: e/androidruntime(13393): @ android.os.handler.handlecallback(handler.java:733) 04-06 15:15:57.434: e/androidruntime(13393): @ android.os.handler.dispatchmessage(handler.java:95) 04-06 15:15:57.434: e/androidruntime(13393): @ android.os.looper.loop(looper.java:136) 04-06 15:15:57.434: e/androidruntime(13393): @ android.app.activitythread.main(activitythread.java:5017) 04-06 15:15:57.434: e/androidruntime(13393): @ java.lang.reflect.method.invokenative(native method) 04-06 15:15:57.434: e/androidruntime(13393): @ java.lang.reflect.method.invoke(method.java:515) 04-06 15:15:57.434: e/androidruntime(13393): @ com.android.internal.os.zygoteinit$methodandargscaller.run(zygoteinit.java:779) 04-06 15:15:57.434: e/androidruntime(13393): @ com.android.internal.os.zygoteinit.main(zygoteinit.java:595) 04-06 15:15:57.434: e/androidruntime(13393): @ dalvik.system.nativestart.main(native method) 04-06 15:15:57.434: e/androidruntime(13393): caused by: java.lang.illegalargumentexception: binary xml file line #86: duplicate id 0x7f050079, tag null, or parent id 0xffffffff fragment com.google.android.gms.maps.mapfragment 04-06 15:15:57.434: e/androidruntime(13393): @ android.app.activity.oncreateview(activity.java:4791) 04-06 15:15:57.434: e/androidruntime(13393): @ android.view.layoutinflater.createviewfromtag(layoutinflater.java:689) 04-06 15:15:57.434: e/androidruntime(13393):
[... 20 more]
try code: https://github.com/yurevich1/habrtimezone/blob/master/res/layout/agmap.xml#l6
i think wrote wrong title in file.
<?xml version="1.0" encoding="utf-8"?> <linearlayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:map="http://schemas.android.com/apk/res-auto"
i hope useful you.
Comments
Post a Comment