android.view.inflateexception binary xml file line #7 error inflating class fragment -
android.view.inflateexception binary xml file line #7 error inflating class fragment -
i new android.i need load image url marker. on doing getting error" android.view.inflateexception binary xml file line #7 error inflating class fragment"
code mainactivity
package com.ngshah.goglemapv2withlazyloading; import java.util.hashtable; import android.app.activitymanager; import android.content.context; import android.graphics.bitmap; import android.os.build; import android.os.bundle; import android.support.v4.app.fragmentactivity; import android.view.view; import android.widget.imageview; import android.widget.textview; import com.google.android.gms.maps.cameraupdatefactory; import com.google.android.gms.maps.googlemap; import com.google.android.gms.maps.googlemap.infowindowadapter; import com.google.android.gms.maps.supportmapfragment; import com.google.android.gms.maps.model.bitmapdescriptorfactory; import com.google.android.gms.maps.model.latlng; import com.google.android.gms.maps.model.marker; import com.google.android.gms.maps.model.markeroptions; import com.ngshah.goglemapv2withlazyloading.r; import com.nostra13.universalimageloader.cache.disc.naming.md5filenamegenerator; import com.nostra13.universalimageloader.cache.memory.impl.fifolimitedmemorycache; import com.nostra13.universalimageloader.core.displayimageoptions; import com.nostra13.universalimageloader.core.imageloader; import com.nostra13.universalimageloader.core.imageloaderconfiguration; import com.nostra13.universalimageloader.core.assist.queueprocessingtype; import com.nostra13.universalimageloader.core.assist.simpleimageloadinglistener; public class mainactivity extends fragmentactivity { private googlemap googlemap; private final latlng hamburg = new latlng(53.558, 9.927); private final latlng kiel = new latlng(53.551, 9.993); private marker marker; private hashtable<string, string> markers; private imageloader imageloader; private displayimageoptions options; @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_main); googlemap = ((supportmapfragment) getsupportfragmentmanager().findfragmentbyid(r.id.map)) .getmap(); initimageloader(); markers = new hashtable<string, string>(); imageloader = imageloader.getinstance(); options = new displayimageoptions.builder() .showstubimage(r.drawable.ic_launcher) // display stub image .showimageforemptyuri(r.drawable.ic_launcher) // if empty image found .cacheinmemory() .cacheondisc().bitmapconfig(bitmap.config.rgb_565).build(); if ( googlemap != null ) { googlemap.setinfowindowadapter(new custominfowindowadapter()); final marker hamburg = googlemap.addmarker(new markeroptions().position(hamburg) .title("hamburg")); markers.put(hamburg.getid(), "http://img.india-forums.com/images/100x100/37525-a-still-image-of-akshay-kumar.jpg"); final marker kiel = googlemap.addmarker(new markeroptions() .position(kiel) .title("kiel") .snippet("kiel cool") .icon(bitmapdescriptorfactory .fromresource(r.drawable.ic_launcher))); markers.put(kiel.getid(), "http://www.yodot.com/images/jpeg-images-sm.png"); googlemap.movecamera(cameraupdatefactory.newlatlngzoom(hamburg, 15)); googlemap.animatecamera(cameraupdatefactory.zoomto(10), 2000, null); } } private class custominfowindowadapter implements infowindowadapter { private view view; public custominfowindowadapter() { view = getlayoutinflater().inflate(r.layout.custom_info_window, null); } @override public view getinfocontents(marker marker) { if (mainactivity.this.marker != null && mainactivity.this.marker.isinfowindowshown()) { mainactivity.this.marker.hideinfowindow(); mainactivity.this.marker.showinfowindow(); } homecoming null; } @override public view getinfowindow(final marker marker) { mainactivity.this.marker = marker; string url = null; if (marker.getid() != null && markers != null && markers.size() > 0) { if ( markers.get(marker.getid()) != null && markers.get(marker.getid()) != null) { url = markers.get(marker.getid()); } } final imageview image = ((imageview) view.findviewbyid(r.id.badge)); if (url != null && !url.equalsignorecase("null") && !url.equalsignorecase("")) { imageloader.displayimage(url, image, options, new simpleimageloadinglistener() { @override public void onloadingcomplete(string imageuri, view view, bitmap loadedimage) { super.onloadingcomplete(imageuri, view, loadedimage); getinfocontents(marker); } }); } else { image.setimageresource(r.drawable.ic_launcher); } final string title = marker.gettitle(); final textview titleui = ((textview) view.findviewbyid(r.id.title)); if (title != null) { titleui.settext(title); } else { titleui.settext(""); } final string snippet = marker.getsnippet(); final textview snippetui = ((textview) view .findviewbyid(r.id.snippet)); if (snippet != null) { snippetui.settext(snippet); } else { snippetui.settext(""); } homecoming view; } } private void initimageloader() { int memorycachesize; if (build.version.sdk_int >= build.version_codes.eclair) { int memclass = ((activitymanager) getsystemservice(context.activity_service)) .getmemoryclass(); memorycachesize = (memclass / 8) * 1024 * 1024; } else { memorycachesize = 2 * 1024 * 1024; } final imageloaderconfiguration config = new imageloaderconfiguration.builder( this).threadpoolsize(5) .threadpriority(thread.norm_priority - 2) .memorycachesize(memorycachesize) .memorycache(new fifolimitedmemorycache(memorycachesize-1000000)) .denycacheimagemultiplesizesinmemory() .disccachefilenamegenerator(new md5filenamegenerator()) .tasksprocessingorder(queueprocessingtype.lifo).enablelogging() .build(); imageloader.getinstance().init(config); } }
activity_main.xml
<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" tools:context=".mainactivity" > <fragment android:id="@+id/map" android:layout_width="match_parent" android:layout_height="match_parent" class="com.google.android.gms.maps.supportmapfragment" /> </relativelayout>
custom_info_window.xml
<?xml version="1.0" encoding="utf-8"?> <linearlayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="wrap_content" android:layout_height="wrap_content" android:background="@drawable/custom_info_bubble" android:orientation="horizontal" > <imageview android:id="@+id/badge" android:layout_width="50dp" android:layout_height="50dp" android:layout_marginright="5dp" android:adjustviewbounds="true" > </imageview> <linearlayout android:layout_width="wrap_content" android:layout_height="wrap_content" android:orientation="vertical" > <textview android:id="@+id/title" android:layout_width="wrap_content" android:layout_height="wrap_content" android:ellipsize="end" android:singleline="true" android:textcolor="#ff000000" android:textsize="14dp" android:textstyle="bold" /> <textview android:id="@+id/snippet" android:layout_width="wrap_content" android:layout_height="wrap_content" android:textcolor="#ff7f7f7f" android:textsize="14dp" /> </linearlayout> </linearlayout>
androidmanifest.xml
<?xml version="1.0" encoding="utf-8"?> <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.ngshah.goglemapv2withlazyloading" android:versioncode="1" android:versionname="1.0" > <uses-sdk android:minsdkversion="8" android:targetsdkversion="17" /> <permission android:name="com.ngshah.googlemapv2.permission.maps_receive" android:protectionlevel="signature" /> <uses-permission android:name="com.ngshah.googlemapv2.permission.maps_receive" /> <uses-permission android:name="android.permission.internet" /> <uses-permission android:name="android.permission.write_external_storage" /> <uses-permission android:name="com.google.android.providers.gsf.permission.read_gservices" /> <uses-permission android:name="android.permission.access_coarse_location" /> <uses-permission android:name="android.permission.access_fine_location" /> <uses-feature android:glesversion="0x00020000" android:required="true" /> <application android:allowbackup="true" android:icon="@drawable/ic_launcher" android:label="@string/app_name" android:theme="@style/apptheme" > <meta-data android:name="com.google.android.maps.v2.api_key" android:value="my key" /> <activity android:name="com.ngshah.goglemapv2withlazyloading.mainactivity" android:label="@string/app_name" > <intent-filter> <action android:name="android.intent.action.main" /> <category android:name="android.intent.category.launcher" /> </intent-filter> </activity> <meta-data android:name="com.google.android.gms.version" android:value="@integer/google_play_services_version" /> </application> </manifest>
log file
06-23 08:56:33.749: i/google maps android api(15924): google play services client version: 4323000 06-23 08:56:33.759: i/google maps android api(15924): google play services bundle version: 4452034 06-23 08:56:33.819: d/androidruntime(15924): shutting downwards vm 06-23 08:56:33.819: w/dalvikvm(15924): threadid=1: thread exiting uncaught exception (group=0x420ae930) 06-23 08:56:33.899: e/androidruntime(15924): fatal exception: main 06-23 08:56:33.899: e/androidruntime(15924): java.lang.runtimeexception: unable start activity componentinfo{com.ngshah.goglemapv2withlazyloading/com.ngshah.goglemapv2withlazyloading.mainactivity}: android.view.inflateexception: binary xml file line #7: error inflating class fragment 06-23 08:56:33.899: e/androidruntime(15924): @ android.app.activitythread.performlaunchactivity(activitythread.java:2255) 06-23 08:56:33.899: e/androidruntime(15924): @ android.app.activitythread.handlelaunchactivity(activitythread.java:2309) 06-23 08:56:33.899: e/androidruntime(15924): @ android.app.activitythread.access$700(activitythread.java:157) 06-23 08:56:33.899: e/androidruntime(15924): @ android.app.activitythread$h.handlemessage(activitythread.java:1289) 06-23 08:56:33.899: e/androidruntime(15924): @ android.os.handler.dispatchmessage(handler.java:99) 06-23 08:56:33.899: e/androidruntime(15924): @ android.os.looper.loop(looper.java:176) 06-23 08:56:33.899: e/androidruntime(15924): @ android.app.activitythread.main(activitythread.java:5317) 06-23 08:56:33.899: e/androidruntime(15924): @ java.lang.reflect.method.invokenative(native method) 06-23 08:56:33.899: e/androidruntime(15924): @ java.lang.reflect.method.invoke(method.java:511) 06-23 08:56:33.899: e/androidruntime(15924): @ com.android.internal.os.zygoteinit$methodandargscaller.run(zygoteinit.java:1102) 06-23 08:56:33.899: e/androidruntime(15924): @ com.android.internal.os.zygoteinit.main(zygoteinit.java:869) 06-23 08:56:33.899: e/androidruntime(15924): @ dalvik.system.nativestart.main(native method) 06-23 08:56:33.899: e/androidruntime(15924): caused by: android.view.inflateexception: binary xml file line #7: error inflating class fragment 06-23 08:56:33.899: e/androidruntime(15924): @ android.view.layoutinflater.createviewfromtag(layoutinflater.java:710) 06-23 08:56:33.899: e/androidruntime(15924): @ android.view.layoutinflater.rinflate(layoutinflater.java:752) 06-23 08:56:33.899: e/androidruntime(15924): @ android.view.layoutinflater.inflate(layoutinflater.java:495) 06-23 08:56:33.899: e/androidruntime(15924): @ android.view.layoutinflater.inflate(layoutinflater.java:397) 06-23 08:56:33.899: e/androidruntime(15924): @ android.view.layoutinflater.inflate(layoutinflater.java:353) 06-23 08:56:33.899: e/androidruntime(15924): @ com.android.internal.policy.impl.phonewindow.setcontentview(phonewindow.java:360) 06-23 08:56:33.899: e/androidruntime(15924): @ android.app.activity.setcontentview(activity.java:1932) 06-23 08:56:33.899: e/androidruntime(15924): @ com.ngshah.goglemapv2withlazyloading.mainactivity.oncreate(mainactivity.java:45) 06-23 08:56:33.899: e/androidruntime(15924): @ android.app.activity.performcreate(activity.java:5326) 06-23 08:56:33.899: e/androidruntime(15924): @ android.app.instrumentation.callactivityoncreate(instrumentation.java:1097) 06-23 08:56:33.899: e/androidruntime(15924): @ android.app.activitythread.performlaunchactivity(activitythread.java:2218) 06-23 08:56:33.899: e/androidruntime(15924): ... 11 more 06-23 08:56:33.899: e/androidruntime(15924): caused by: java.lang.securityexception: maps api requires additional next permissions set in androidmanifest.xml ensure right behavior: 06-23 08:56:33.899: e/androidruntime(15924): <uses-permission android:name="android.permission.access_network_state"/> 06-23 08:56:33.899: e/androidruntime(15924): @ lzv.a(unknown source) 06-23 08:56:33.899: e/androidruntime(15924): @ mcg.a(unknown source) 06-23 08:56:33.899: e/androidruntime(15924): @ mcg.a(unknown source) 06-23 08:56:33.899: e/androidruntime(15924): @ mbi.a(unknown source) 06-23 08:56:33.899: e/androidruntime(15924): @ lxn.a(unknown source) 06-23 08:56:33.899: e/androidruntime(15924): @ lxm.a(unknown source) 06-23 08:56:33.899: e/androidruntime(15924): @ fnb.ontransact(sourcefile:107) 06-23 08:56:33.899: e/androidruntime(15924): @ android.os.binder.transact(binder.java:310) 06-23 08:56:33.899: e/androidruntime(15924): @ com.google.android.gms.maps.internal.imapfragmentdelegate$a$a.oncreateview(unknown source) 06-23 08:56:33.899: e/androidruntime(15924): @ com.google.android.gms.maps.supportmapfragment$a.oncreateview(unknown source) 06-23 08:56:33.899: e/androidruntime(15924): @ com.google.android.gms.dynamic.a$4.b(unknown source) 06-23 08:56:33.899: e/androidruntime(15924): @ com.google.android.gms.dynamic.a.a(unknown source) 06-23 08:56:33.899: e/androidruntime(15924): @ com.google.android.gms.dynamic.a.oncreateview(unknown source) 06-23 08:56:33.899: e/androidruntime(15924): @ com.google.android.gms.maps.supportmapfragment.oncreateview(unknown source) 06-23 08:56:33.899: e/androidruntime(15924): @ android.support.v4.app.fragment.performcreateview(fragment.java:1478) 06-23 08:56:33.899: e/androidruntime(15924): @ android.support.v4.app.fragmentmanagerimpl.movetostate(fragmentmanager.java:900) 06-23 08:56:33.899: e/androidruntime(15924): @ android.support.v4.app.fragmentmanagerimpl.movetostate(fragmentmanager.java:1082) 06-23 08:56:33.899: e/androidruntime(15924): @ android.support.v4.app.fragmentmanagerimpl.addfragment(fragmentmanager.java:1184) 06-23 08:56:33.899: e/androidruntime(15924): @ android.support.v4.app.fragmentactivity.oncreateview(fragmentactivity.java:285) 06-23 08:56:33.899: e/androidruntime(15924): @ android.view.layoutinflater.createviewfromtag(layoutinflater.java:682) 06-23 08:56:33.899: e/androidruntime(15924): ... 21 more 06-23 08:56:36.151: i/process(15924): sending signal. pid: 15924 sig: 9
the issue in androidmanifest.xml stated line in logcat exception:
caused by: java.lang.securityexception: maps api requires additional next permissions set in androidmanifest.xml ensure right behavior: <uses-permission android:name="android.permission.access_network_state"/>
if add together permission androidmanifest should work correctly
android xml google-maps android-fragments
Comments
Post a Comment