OSMdroid throw Bitmap Exception - android

I'm using offline maps to display using OSMdroid, Sometimes Whenever at places I try to zoom or pan where maptiles are not available my app crashes.
Here is stack trace:
07-01 13:24:01.625: E/AndroidRuntime(13443): java.lang.NullPointerException
07-01 13:24:01.625: E/AndroidRuntime(13443): at android.graphics.Canvas.throwIfCannotDraw(Canvas.java:1083)
07-01 13:24:01.625: E/AndroidRuntime(13443): at android.graphics.Canvas.drawBitmap(Canvas.java:1201)
07-01 13:24:01.625: E/AndroidRuntime(13443): at org.osmdroid.tileprovider.MapTileProviderBase$ZoomInTileLooper.handleTile(MapTileProviderBase.java:343)
07-01 13:24:01.625: E/AndroidRuntime(13443): at org.osmdroid.tileprovider.MapTileProviderBase$ScaleTileLooper.handleTile(MapTileProviderBase.java:292)
07-01 13:24:01.625: E/AndroidRuntime(13443): at org.osmdroid.util.TileLooper.loop(TileLooper.java:34)
07-01 13:24:01.625: E/AndroidRuntime(13443): at org.osmdroid.tileprovider.MapTileProviderBase.rescaleCache(MapTileProviderBase.java:248)
07-01 13:24:01.625: E/AndroidRuntime(13443): at org.osmdroid.views.MapView.setZoomLevel(MapView.java:368)
07-01 13:24:01.625: E/AndroidRuntime(13443): at org.osmdroid.views.MapController.setZoom(MapController.java:182)
07-01 13:24:01.625: E/AndroidRuntime(13443): at org.osmdroid.views.MapController.onAnimationEnd(MapController.java:263)
07-01 13:24:01.625: E/AndroidRuntime(13443): at org.osmdroid.views.MapController$MyZoomAnimatorListener.onAnimationEnd(MapController.java:280)
07-01 13:24:01.625: E/AndroidRuntime(13443): at android.animation.ValueAnimator.endAnimation(ValueAnimator.java:1056)
07-01 13:24:01.625: E/AndroidRuntime(13443): at android.animation.ValueAnimator.access$400(ValueAnimator.java:50)
07-01 13:24:01.625: E/AndroidRuntime(13443): at android.animation.ValueAnimator$AnimationHandler.doAnimationFrame(ValueAnimator.java:644)
07-01 13:24:01.625: E/AndroidRuntime(13443): at android.animation.ValueAnimator$AnimationHandler.run(ValueAnimator.java:660)
07-01 13:24:01.625: E/AndroidRuntime(13443): at android.view.Choreographer$CallbackRecord.run(Choreographer.java:761)
07-01 13:24:01.625: E/AndroidRuntime(13443): at android.view.Choreographer.doCallbacks(Choreographer.java:574)
07-01 13:24:01.625: E/AndroidRuntime(13443): at android.view.Choreographer.doFrame(Choreographer.java:543)
07-01 13:24:01.625: E/AndroidRuntime(13443): at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:747)
07-01 13:24:01.625: E/AndroidRuntime(13443): at android.os.Handler.handleCallback(Handler.java:733)
07-01 13:24:01.625: E/AndroidRuntime(13443): at android.os.Handler.dispatchMessage(Handler.java:95)
07-01 13:24:01.625: E/AndroidRuntime(13443): at android.os.Looper.loop(Looper.java:136)
07-01 13:24:01.625: E/AndroidRuntime(13443): at android.app.ActivityThread.main(ActivityThread.java:5017)
07-01 13:24:01.625: E/AndroidRuntime(13443): at java.lang.reflect.Method.invokeNative(Native Method)
07-01 13:24:01.625: E/AndroidRuntime(13443): at java.lang.reflect.Method.invoke(Method.java:515)
07-01 13:24:01.625: E/AndroidRuntime(13443): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:779)
07-01 13:24:01.625: E/AndroidRuntime(13443): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:595)
07-01 13:24:01.625: E/AndroidRuntime(13443): at dalvik.system.NativeStart.main(Native Method)

This is a NullPointerException. You are missing the tile corresponding to this location at this level of zoom, but this case is not handled in your code.
The renderer expects the tile's Bitmap to exist and therefore crashes when attempting to display it.

Related

Android ClassNotFoundException after signing

I have a LibGDX game and something strange is happening. When I hit Run in Eclipse, it works fine on my phone. However, when I export a signed APK and install it, the app crashes and shows the following:
07-01 22:22:56.658: E/AndroidRuntime(12432): FATAL EXCEPTION: main
07-01 22:22:56.658: E/AndroidRuntime(12432): java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{com.radioactivewasp.starshiprunner/com.radioactivewasp.starshiprunner.GameActivity}: java.lang.ClassNotFoundException: Didn't find class "com.radioactivewasp.starshiprunner.GameActivity" on path: /data/app/com.radioactivewasp.starshiprunner-1.apk
07-01 22:22:56.658: E/AndroidRuntime(12432): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2219)
07-01 22:22:56.658: E/AndroidRuntime(12432): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2349)
07-01 22:22:56.658: E/AndroidRuntime(12432): at android.app.ActivityThread.access$700(ActivityThread.java:159)
07-01 22:22:56.658: E/AndroidRuntime(12432): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1316)
07-01 22:22:56.658: E/AndroidRuntime(12432): at android.os.Handler.dispatchMessage(Handler.java:99)
07-01 22:22:56.658: E/AndroidRuntime(12432): at android.os.Looper.loop(Looper.java:176)
07-01 22:22:56.658: E/AndroidRuntime(12432): at android.app.ActivityThread.main(ActivityThread.java:5419)
07-01 22:22:56.658: E/AndroidRuntime(12432): at java.lang.reflect.Method.invokeNative(Native Method)
07-01 22:22:56.658: E/AndroidRuntime(12432): at java.lang.reflect.Method.invoke(Method.java:525)
07-01 22:22:56.658: E/AndroidRuntime(12432): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1046)
07-01 22:22:56.658: E/AndroidRuntime(12432): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:862)
07-01 22:22:56.658: E/AndroidRuntime(12432): at dalvik.system.NativeStart.main(Native Method)
07-01 22:22:56.658: E/AndroidRuntime(12432): Caused by: java.lang.ClassNotFoundException: Didn't find class "com.radioactivewasp.starshiprunner.GameActivity" on path: /data/app/com.radioactivewasp.starshiprunner-1.apk
07-01 22:22:56.658: E/AndroidRuntime(12432): at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:64)
07-01 22:22:56.658: E/AndroidRuntime(12432): at java.lang.ClassLoader.loadClass(ClassLoader.java:501)
07-01 22:22:56.658: E/AndroidRuntime(12432): at java.lang.ClassLoader.loadClass(ClassLoader.java:461)
07-01 22:22:56.658: E/AndroidRuntime(12432): at android.app.Instrumentation.newActivity(Instrumentation.java:1078)
07-01 22:22:56.658: E/AndroidRuntime(12432): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2210)
07-01 22:22:56.658: E/AndroidRuntime(12432): ... 11 more

IBM Worklight 6.2 - error on StoragePlugin

I upgraded from Worklight 6.1.0.1 to 6.2 and since then, my app stopped loading JSONStore successfully.
It says it can't find the class StoragePlugin, although the class is actually there in the worklight-android.jar
It is also declared in the config.xml file:
<feature name="StoragePlugin">
<param name="android-package" value="com.worklight.androidgap.plugin.storage.StoragePlugin"/>
</feature>
That's the logcat output when I run it on a android device:
07-01 20:58:48.851: D/NONE(4379): initializing JSONStore...
07-01 20:58:49.671: D/SoftKeyboardDetect(4379): Ignore this event
07-01 20:58:49.765: W/System.err(4379): java.lang.ClassNotFoundException: com.worklight.androidgap.plugin.storage.StoragePlugin
07-01 20:58:49.765: W/System.err(4379): at java.lang.Class.classForName(Native Method)
07-01 20:58:49.765: W/System.err(4379): at java.lang.Class.forName(Class.java:217)
07-01 20:58:49.765: W/System.err(4379): at java.lang.Class.forName(Class.java:172)
07-01 20:58:49.765: W/System.err(4379): at org.apache.cordova.PluginEntry.getClassByName(PluginEntry.java:117)
07-01 20:58:49.765: W/System.err(4379): at org.apache.cordova.PluginEntry.createPlugin(PluginEntry.java:93)
07-01 20:58:49.765: W/System.err(4379): at org.apache.cordova.PluginManager.getPlugin(PluginManager.java:278)
07-01 20:58:49.765: W/System.err(4379): at org.apache.cordova.PluginManager.execHelper(PluginManager.java:232)
07-01 20:58:49.765: W/System.err(4379): at org.apache.cordova.PluginManager.exec(PluginManager.java:227)
07-01 20:58:49.765: W/System.err(4379): at org.apache.cordova.ExposedJsApi.exec(ExposedJsApi.java:53)
07-01 20:58:49.765: W/System.err(4379): at org.apache.cordova.CordovaChromeClient.onJsPrompt(CordovaChromeClient.java:229)
07-01 20:58:49.765: W/System.err(4379): at android.webkit.CallbackProxy.handleMessage(CallbackProxy.java:646)
07-01 20:58:49.765: W/System.err(4379): at android.os.Handler.dispatchMessage(Handler.java:99)
07-01 20:58:49.765: W/System.err(4379): at android.os.Looper.loop(Looper.java:137)
07-01 20:58:49.765: W/System.err(4379): at android.app.ActivityThread.main(ActivityThread.java:4514)
07-01 20:58:49.765: W/System.err(4379): at java.lang.reflect.Method.invokeNative(Native Method)
07-01 20:58:49.765: W/System.err(4379): at java.lang.reflect.Method.invoke(Method.java:511)
07-01 20:58:49.765: W/System.err(4379): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:790)
07-01 20:58:49.773: W/System.err(4379): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:557)
07-01 20:58:49.773: W/System.err(4379): at dalvik.system.NativeStart.main(Native Method)
07-01 20:58:49.773: W/System.err(4379): Caused by: java.lang.NoClassDefFoundError: com/worklight/androidgap/plugin/storage/StoragePlugin
07-01 20:58:49.773: W/System.err(4379): ... 19 more
07-01 20:58:49.773: W/System.err(4379): Caused by: java.lang.ClassNotFoundException: com.worklight.androidgap.plugin.storage.StoragePlugin
07-01 20:58:49.773: W/System.err(4379): at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:61)
07-01 20:58:49.773: W/System.err(4379): at java.lang.ClassLoader.loadClass(ClassLoader.java:501)
07-01 20:58:49.773: W/System.err(4379): at java.lang.ClassLoader.loadClass(ClassLoader.java:461)
07-01 20:58:49.773: W/System.err(4379): ... 19 more
07-01 20:58:49.773: I/System.out(4379): Error adding plugin com.worklight.androidgap.plugin.storage.StoragePlugin.
07-01 20:58:49.781: D/PluginManager(4379): exec() call to unknown plugin: StoragePlugin
07-01 20:58:49.781: D/SoftKeyboardDetect(4379): Ignore this event
07-01 20:58:49.882: D/NONE(4379): JSONStore initialize FAIL
07-01 20:58:49.898: D/NONE(4379): {
07-01 20:58:49.898: D/NONE(4379): "src": "initCollection",
07-01 20:58:49.898: D/NONE(4379): "err": -11,
07-01 20:58:49.898: D/NONE(4379): "msg": "OPERATION_FAILED_ON_SPECIFIC_DOCUMENT",
07-01 20:58:49.898: D/NONE(4379): "col": "categories",
07-01 20:58:49.898: D/NONE(4379): "usr": "jsonstore",
07-01 20:58:49.898: D/NONE(4379): "doc": "Class not found",
07-01 20:58:49.898: D/NONE(4379): "res": {}
07-01 20:58:49.898: D/NONE(4379): }
07-01 20:58:49.937: D/dalvikvm(4379): GC_CONCURRENT freed 356K, 12% free 8356K/9479K, paused 2ms+4ms
07-01 21:00:49.687: D/CordovaActivity(4379): Paused the application!
07-01 21:00:49.687: D/CordovaWebView(4379): Handle the pause
Any hint about what may be causing this?
We just verified that this is an actual defect, we will be fixing it. The quick fix is to change com.worklight.androidgap.plugin.storage.StoragePlugin to com.worklight.androidgap.plugin.StoragePlugin (remove the ".storage." part) and it will work again.

IBM Worklight 5.x - Android app stops and terminates unexpectedly

I have tried to develop a test application using Worklight for the Android environment. When I run the app using an AVD it throws an error message like:
"Sorry The application Test (process com.AccorFintech) has stopped
unexpectedly. Please try again."
and the application terminates.
I am using Eclipse 4.2 and android version for AVD is Android 2.2.
Here Is My Logcat:
07-01 16:19:33.510: W/dalvikvm(403): Unable to resolve superclass of Lcom/AccordFintech/AccordFintech; (12)
07-01 16:19:33.510: W/dalvikvm(403): Link of class 'Lcom/AccordFintech/AccordFintech;' failed
07-01 16:19:33.540: D/AndroidRuntime(403): Shutting down VM
07-01 16:19:33.540: W/dalvikvm(403): threadid=1: thread exiting with uncaught exception (group=0x4001d800)
07-01 16:19:33.570: E/AndroidRuntime(403): FATAL EXCEPTION: main
07-01 16:19:33.570: E/AndroidRuntime(403): java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{com.AccordFintech/com.AccordFintech.AccordFintech}: java.lang.ClassNotFoundException: com.AccordFintech.AccordFintech in loader dalvik.system.PathClassLoader[/data/app/com.AccordFintech-2.apk]
07-01 16:19:33.570: E/AndroidRuntime(403): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2585)
07-01 16:19:33.570: E/AndroidRuntime(403): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2679)
07-01 16:19:33.570: E/AndroidRuntime(403): at android.app.ActivityThread.access$2300(ActivityThread.java:125)
07-01 16:19:33.570: E/AndroidRuntime(403): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2033)
07-01 16:19:33.570: E/AndroidRuntime(403): at android.os.Handler.dispatchMessage(Handler.java:99)
07-01 16:19:33.570: E/AndroidRuntime(403): at android.os.Looper.loop(Looper.java:123)
07-01 16:19:33.570: E/AndroidRuntime(403): at android.app.ActivityThread.main(ActivityThread.java:4627)
07-01 16:19:33.570: E/AndroidRuntime(403): at java.lang.reflect.Method.invokeNative(Native Method)
07-01 16:19:33.570: E/AndroidRuntime(403): at java.lang.reflect.Method.invoke(Method.java:521)
07-01 16:19:33.570: E/AndroidRuntime(403): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)
07-01 16:19:33.570: E/AndroidRuntime(403): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
07-01 16:19:33.570: E/AndroidRuntime(403): at dalvik.system.NativeStart.main(Native Method)
07-01 16:19:33.570: E/AndroidRuntime(403): Caused by: java.lang.ClassNotFoundException: com.AccordFintech.AccordFintech in loader dalvik.system.PathClassLoader[/data/app/com.AccordFintech-2.apk]
07-01 16:19:33.570: E/AndroidRuntime(403): at dalvik.system.PathClassLoader.findClass(PathClassLoader.java:243)
07-01 16:19:33.570: E/AndroidRuntime(403): at java.lang.ClassLoader.loadClass(ClassLoader.java:573)
07-01 16:19:33.570: E/AndroidRuntime(403): at java.lang.ClassLoader.loadClass(ClassLoader.java:532)
07-01 16:19:33.570: E/AndroidRuntime(403): at android.app.Instrumentation.newActivity(Instrumentation.java:1021)
07-01 16:19:33.570: E/AndroidRuntime(403): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2577)
07-01 16:19:33.570: E/AndroidRuntime(403): ... 11 more
Are you using ADT v22?
See if this helps you: IBM Worklight - "Unfortunately, HelloWorkLight has stopped" error message
Right-click on the native Android project in Worklight Studio
and choose 'Properties'.
Select 'Java Build Path' and go to the 'Order and Export'
tab.
Mark the check-box for 'Android Private Libraries'
Refresh/clean/rebuild the android project.
You will need to do the above per-project.
This is fixed in Worklight 6.0.

Can not find the error PHP MYSQL JSON ANDROID

Can anyone help me dissect this error log? The class throwing this is almost identical to another class that works fine in the same program. The only difference is that I have added a List and am passing parameters to the url for the json request
protected String doInBackground(String... args) {
// Building Parameters
List<NameValuePair> params = new ArrayList<NameValuePair>();
// getting JSON string from URL
//params.add(new BasicNameValuePair("category","cat"));
Line 74: JSONObject json = jParser.makeHttpRequest(url_get_channels, "GET", params);
// Check your log cat for JSON reponse
Log.d("All Products: ", json.toString());
07-01 00:17:21.573: D/dalvikvm(1009): GC_FOR_MALLOC freed 2585 objects / 167744 bytes in 78ms
07-01 00:17:28.133: W/dalvikvm(1009): threadid=9: thread exiting with uncaught exception (group=0x4001d800)
07-01 00:17:28.253: E/AndroidRuntime(1009): FATAL EXCEPTION: AsyncTask #2
07-01 00:17:28.253: E/AndroidRuntime(1009): java.lang.RuntimeException: An error occured while executing doInBackground()
07-01 00:17:28.253: E/AndroidRuntime(1009): at android.os.AsyncTask$3.done(AsyncTask.java:200)
07-01 00:17:28.253: E/AndroidRuntime(1009): at java.util.concurrent.FutureTask$Sync.innerSetException(FutureTask.java:273)
07-01 00:17:28.253: E/AndroidRuntime(1009): at java.util.concurrent.FutureTask.setException(FutureTask.java:124)
07-01 00:17:28.253: E/AndroidRuntime(1009): at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:307)
07-01 00:17:28.253: E/AndroidRuntime(1009): at java.util.concurrent.FutureTask.run(FutureTask.java:137)
07-01 00:17:28.253: E/AndroidRuntime(1009): at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1068)
07-01 00:17:28.253: E/AndroidRuntime(1009): at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:561)
07-01 00:17:28.253: E/AndroidRuntime(1009): at java.lang.Thread.run(Thread.java:1096)
07-01 00:17:28.253: E/AndroidRuntime(1009): Caused by: java.lang.NullPointerException
07-01 00:17:28.253: E/AndroidRuntime(1009): at com.example.video.unlimited.ListChannels$LoadAllChannels.doInBackground(ListChannels.java:74)
07-01 00:17:28.253: E/AndroidRuntime(1009): at com.example.video.unlimited.ListChannels$LoadAllChannels.doInBackground(ListChannels.java:1)
07-01 00:17:28.253: E/AndroidRuntime(1009): at android.os.AsyncTask$2.call(AsyncTask.java:185)
07-01 00:17:28.253: E/AndroidRuntime(1009): at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:305)
07-01 00:17:28.253: E/AndroidRuntime(1009): ... 4 more
07-01 00:17:29.762: E/WindowManager(1009): Activity com.example.video.unlimited.ListChannels has leaked window com.android.internal.policy.impl.PhoneWindow$DecorView#44ef2968 that was originally added here
07-01 00:17:29.762: E/WindowManager(1009): android.view.WindowLeaked: Activity com.example.video.unlimited.ListChannels has leaked window com.android.internal.policy.impl.PhoneWindow$DecorView#44ef2968 that was originally added here
07-01 00:17:29.762: E/WindowManager(1009): at android.view.ViewRoot.<init>(ViewRoot.java:247)
07-01 00:17:29.762: E/WindowManager(1009): at android.view.WindowManagerImpl.addView(WindowManagerImpl.java:148)
07-01 00:17:29.762: E/WindowManager(1009): at android.view.WindowManagerImpl.addView(WindowManagerImpl.java:91)
07-01 00:17:29.762: E/WindowManager(1009): at android.view.Window$LocalWindowManager.addView(Window.java:424)
07-01 00:17:29.762: E/WindowManager(1009): at android.app.Dialog.show(Dialog.java:241)
07-01 00:17:29.762: E/WindowManager(1009): at com.example.video.unlimited.ListChannels$LoadAllChannels.onPreExecute(ListChannels.java:63)
07-01 00:17:29.762: E/WindowManager(1009): at android.os.AsyncTask.execute(AsyncTask.java:391)
07-01 00:17:29.762: E/WindowManager(1009): at com.example.video.unlimited.ListChannels.onCreate(ListChannels.java:45)
07-01 00:17:29.762: E/WindowManager(1009): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
07-01 00:17:29.762: E/WindowManager(1009): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2627)
07-01 00:17:29.762: E/WindowManager(1009): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2679)
07-01 00:17:29.762: E/WindowManager(1009): at android.app.ActivityThread.access$2300(ActivityThread.java:125)
07-01 00:17:29.762: E/WindowManager(1009): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2033)
07-01 00:17:29.762: E/WindowManager(1009): at android.os.Handler.dispatchMessage(Handler.java:99)
07-01 00:17:29.762: E/WindowManager(1009): at android.os.Looper.loop(Looper.java:123)
07-01 00:17:29.762: E/WindowManager(1009): at android.app.ActivityThread.main(ActivityThread.java:4627)
07-01 00:17:29.762: E/WindowManager(1009): at java.lang.reflect.Method.invokeNative(Native Method)
07-01 00:17:29.762: E/WindowManager(1009): at java.lang.reflect.Method.invoke(Method.java:521)
07-01 00:17:29.762: E/WindowManager(1009): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)
07-01 00:17:29.762: E/WindowManager(1009): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
07-01 00:17:29.762: E/WindowManager(1009): at dalvik.system.NativeStart.main(Native Method)
What about the "android.view.WindowLeaked" exception?
This means that you are trying to show a Dialog from a "closed" activity.
Hope this helps
/Yaron

How to manage orientation in landscape and portrait using fragment

I create one example in Android 3.0 and I use the fragment in it. when I change the mode landscape to portrait or viseversa it give me the error as following but when I comment the fragment calling part it works smoothly as per my changes. for this I create layout-land folder and put may xml file with changes.
does any one have a hint or solution or example for match with this?
this is my fragment:
<fragment
class="com.Organisemee.fragment.TaskListFragment"
android:id="#+id/tasklistfrag"
android:layout_width="match_parent"
android:layout_height="match_parent" />
And this is error:
07-01 12:38:33.363: ERROR/AndroidRuntime(641): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.Organisemee/com.Organisemee.OrganisemeeList}: android.view.InflateException: Binary XML file line #167: Error inflating class fragment
07-01 12:38:33.363: ERROR/AndroidRuntime(641): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1736)
07-01 12:38:33.363: ERROR/AndroidRuntime(641): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1752)
07-01 12:38:33.363: ERROR/AndroidRuntime(641): at android.app.ActivityThread.handleRelaunchActivity(ActivityThread.java:3096)
07-01 12:38:33.363: ERROR/AndroidRuntime(641): at android.app.ActivityThread.access$1600(ActivityThread.java:123)
07-01 12:38:33.363: ERROR/AndroidRuntime(641): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:997)
07-01 12:38:33.363: ERROR/AndroidRuntime(641): at android.os.Handler.dispatchMessage(Handler.java:99)
07-01 12:38:33.363: ERROR/AndroidRuntime(641): at android.os.Looper.loop(Looper.java:126)
07-01 12:38:33.363: ERROR/AndroidRuntime(641): at android.app.ActivityThread.main(ActivityThread.java:3997)
07-01 12:38:33.363: ERROR/AndroidRuntime(641): at java.lang.reflect.Method.invokeNative(Native Method)
07-01 12:38:33.363: ERROR/AndroidRuntime(641): at java.lang.reflect.Method.invoke(Method.java:491)
07-01 12:38:33.363: ERROR/AndroidRuntime(641): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:841)
07-01 12:38:33.363: ERROR/AndroidRuntime(641): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:599)
07-01 12:38:33.363: ERROR/AndroidRuntime(641): at dalvik.system.NativeStart.main(Native Method)
07-01 12:38:33.363: ERROR/AndroidRuntime(641): Caused by: android.view.InflateException: Binary XML file line #167: Error inflating class fragment
07-01 12:38:33.363: ERROR/AndroidRuntime(641): at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:688)
07-01 12:38:33.363: ERROR/AndroidRuntime(641): at android.view.LayoutInflater.rInflate(LayoutInflater.java:724)
07-01 12:38:33.363: ERROR/AndroidRuntime(641): at android.view.LayoutInflater.rInflate(LayoutInflater.java:727)
07-01 12:38:33.363: ERROR/AndroidRuntime(641): at android.view.LayoutInflater.inflate(LayoutInflater.java:479)
07-01 12:38:33.363: ERROR/AndroidRuntime(641): at android.view.LayoutInflater.inflate(LayoutInflater.java:391)
07-01 12:38:33.363: ERROR/AndroidRuntime(641): at android.view.LayoutInflater.inflate(LayoutInflater.java:347)
07-01 12:38:33.363: ERROR/AndroidRuntime(641): at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:224)
07-01 12:38:33.363: ERROR/AndroidRuntime(641): at android.app.Activity.setContentView(Activity.java:1777)
07-01 12:38:33.363: ERROR/AndroidRuntime(641): at com.Organisemee.OrganisemeeList.onCreate(OrganisemeeList.java:73)
07-01 12:38:33.363: ERROR/AndroidRuntime(641): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1048)
07-01 12:38:33.363: ERROR/AndroidRuntime(641): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1700)
07-01 12:38:33.363: ERROR/AndroidRuntime(641): ... 12 more
07-01 12:38:33.363: ERROR/AndroidRuntime(641): Caused by: java.lang.IllegalStateException: Fragment com.Organisemee.fragment.TaskListFragment did not create a view.
07-01 12:38:33.363: ERROR/AndroidRuntime(641): at android.app.Activity.onCreateView(Activity.java:4114)
07-01 12:38:33.363: ERROR/AndroidRuntime(641): at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:664)
07-01 12:38:33.363: ERROR/AndroidRuntime(641): ... 22 more
Need to define a Fragment in XML Like This.
<RelativeLayout
android:id="#+id/main_tasklist_layout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_toRightOf="#+id/main_viewmenu_layout"
android:layout_below="#+id/main_tasklist_outer">
<fragment
class="com.Organisemee.fragment.TaskListFragment"
android:id="#+id/tasklistfrag"
android:layout_width="match_parent"
android:layout_height="match_parent"/>
</RelativeLayout>
To Call the Fragment put this code in java file
Fragment f = listFragment();
FragmentTransaction ListFragft = getFragmentManager().beginTransaction();
ListFragft.replace(R.id.main_tasklist_layout, f);
ListFragft.setTransition(FragmentTransaction.TRANSIT_FRAGMENT_FADE);
ListFragft.addToBackStack(null);
ListFragft.commit();
This Works fine in change both orientation, landscape to portrait and vice versa.

Categories

Resources