I'm having a crash when refreshing a view inside a SlidingTray (custom SlidingDrawer coming from the top).
I'm not sure what causing it.. but my first guess is that it's due to the number of nested layouts...
What is the maximum number of nested layouts?
Is it device specific, how can I be sure if that's the cause?
If it's not, any of these things is causing it.. what is?
The stacktrace:
E/AndroidRuntime( 2199): FATAL EXCEPTION: main
E/AndroidRuntime( 2199): java.lang.StackOverflowError
E/AndroidRuntime( 2199): at android.graphics.Paint.measureText(Paint.java:1057)
E/AndroidRuntime( 2199): at android.text.Styled.drawDirectionalRun(Styled.java:267)
E/AndroidRuntime( 2199): at android.text.Styled.measureText(Styled.java:430)
E/AndroidRuntime( 2199): at android.text.Layout.measureText(Layout.java:1655)
E/AndroidRuntime( 2199): at android.text.Layout.getLineMax(Layout.java:689)
E/AndroidRuntime( 2199): at android.text.Layout.draw(Layout.java:340)
E/AndroidRuntime( 2199): at android.text.BoringLayout.draw(BoringLayout.java:365)
E/AndroidRuntime( 2199): at android.widget.TextView.onDraw(TextView.java:4168)
E/AndroidRuntime( 2199): at android.view.View.draw(View.java:6880)
E/AndroidRuntime( 2199): at android.view.ViewGroup.drawChild(ViewGroup.java:1646)
E/AndroidRuntime( 2199): at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1373)
E/AndroidRuntime( 2199): at android.view.ViewGroup.drawChild(ViewGroup.java:1644)
E/AndroidRuntime( 2199): at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1373)
E/AndroidRuntime( 2199): at android.view.ViewGroup.drawChild(ViewGroup.java:1644)
E/AndroidRuntime( 2199): at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1373)
E/AndroidRuntime( 2199): at android.view.View.draw(View.java:6883)
E/AndroidRuntime( 2199): at android.widget.FrameLayout.draw(FrameLayout.java:357)
E/AndroidRuntime( 2199): at android.widget.ScrollView.draw(ScrollView.java:1409)
E/AndroidRuntime( 2199): at android.view.ViewGroup.drawChild(ViewGroup.java:1646)
E/AndroidRuntime( 2199): at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1373)
E/AndroidRuntime( 2199): at android.view.ViewGroup.drawChild(ViewGroup.java:1644)
E/AndroidRuntime( 2199): at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1373)
E/AndroidRuntime( 2199): at android.view.View.draw(View.java:6883)
E/AndroidRuntime( 2199): at android.view.ViewGroup.drawChild(ViewGroup.java:1646)
E/AndroidRuntime( 2199): at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1373)
E/AndroidRuntime( 2199): at android.view.View.buildDrawingCache(View.java:6640)
E/AndroidRuntime( 2199): at android.view.View.getDrawingCache(View.java:6428)
E/AndroidRuntime( 2199): at android.view.ViewGroup.drawChild(ViewGroup.java:1571)
E/AndroidRuntime( 2199): at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1373)
E/AndroidRuntime( 2199): at android.view.ViewGroup.drawChild(ViewGroup.java:1644)
E/AndroidRuntime( 2199): at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1392)
E/AndroidRuntime( 2199): at android.view.ViewGroup.drawChild(ViewGroup.java:1644)
E/AndroidRuntime( 2199): at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1373)
E/AndroidRuntime( 2199): at android.view.ViewGroup.drawChild(ViewGroup.java:1644)
E/AndroidRuntime( 2199): at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1373)
E/AndroidRuntime( 2199): at android.view.ViewGroup.drawChild(ViewGroup.java:1644)
E/AndroidRuntime( 2199): at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1373)
E/AndroidRuntime( 2199): at android.view.View.draw(View.java:6883)
E/AndroidRuntime( 2199): at android.widget.FrameLayout.draw(FrameLayout.java:357)
E/AndroidRuntime( 2199): at android.widget.ScrollView.draw(ScrollView.java:1409)
E/AndroidRuntime( 2199): at android.view.ViewGroup.drawChild(ViewGroup.java:1646)
E/AndroidRuntime( 2199): at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1373)
E/AndroidRuntime( 2199): at android.view.ViewGroup.drawChild(ViewGroup.java:1644)
E/AndroidRuntime( 2199): at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1373)
E/AndroidRuntime( 2199): at android.view.ViewGroup.drawChild(ViewGroup.java:1644)
E/AndroidRuntime( 2199): at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1373)
E/AndroidRuntime( 2199): at android.view.View.draw(View.java:6986)
E/AndroidRuntime( 2199): at android.widget.FrameLayout.draw(FrameLayout.java:357)
E/AndroidRuntime( 2199): at android.widget.HorizontalScrollView.draw(HorizontalScrollView.java:1409)
E/AndroidRuntime( 2199): at android.view.ViewGroup.drawChild(ViewGroup.java:1646)
E/AndroidRuntime( 2199): at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1373)
E/AndroidRuntime( 2199): at android.view.View.draw(View.java:6883)
E/AndroidRuntime( 2199): at android.view.ViewGroup.drawChild(ViewGroup.java:1646)
E/AndroidRuntime( 2199): at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1373)
E/AndroidRuntime( 2199): at android.view.View.draw(View.java:6883)
E/AndroidRuntime( 2199): at android.view.ViewGroup.drawChild(ViewGroup.java:1646)
E/AndroidRuntime( 2199): at com.vodafone.onm.components.SlidingTray.dispatchDraw(SlidingTray.java:426)
E/AndroidRuntime( 2199): at android.view.ViewGroup.drawChild(ViewGroup.java:1644)
E/AndroidRuntime( 2199): at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1373)
E/AndroidRuntime( 2199): at android.view.ViewGroup.drawChild(ViewGroup.java:1644)
E/AndroidRuntime( 2199): at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1373)
E/AndroidRuntime( 2199): at android.view.ViewGroup.drawChild(ViewGroup.java:1644)
E/AndroidRuntime( 2199): at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1373)
E/AndroidRuntime( 2199): at android.view.View.draw(View.java:6883)
E/AndroidRuntime( 2199): at android.widget.FrameLayout.draw(FrameLayout.java:357)
E/AndroidRuntime( 2199): at android.view.ViewGroup.drawChild(ViewGroup.java:1646)
E/AndroidRuntime( 2199): at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1373)
E/AndroidRuntime( 2199): at android.view.View.draw(View.java:6883)
E/AndroidRuntime( 2199): at android.widget.FrameLayout.draw(FrameLayout.java:357)
E/AndroidRuntime( 2199): at com.android.internal.policy.impl.PhoneWindow$DecorView.draw(PhoneWindow.java)
UPDATE:
Hierarchy Viewer Snapshot
http://d.pr/kXnp
.
Some thinks I think are related:
http://www.mail-archive.com/android-developers#googlegroups.com/msg48036.html
What is the maximum number of nested layouts?
There is no specific value. You run out of stack space when you run out of stack space, and that will be contingent upon what you are doing. The main application thread has an 8KB stack, last I heard.
That being said, if Hierarchy View is showing a depth of 10 or more (root to deepest leaf), I start to get nervous, and by 15 you are likely to start running into exceptions. Your image, which is nearly illegible, appears to have a depth substantially higher than that.
You seem to have a number of wasted layers. If you have a layer in Hierarchy View, on the critical path, that has one parent and one child, that is a prime candidate to be removed, as it may not be adding any value. You have at least 5 of these candidates. Even cleaning all of that up may not be sufficient, but it is a starting point.
Related
I have wrote an Android application that uses HttpComponents from Apache to make a connection to server.
The version I used is 4.3 (newest), everything is ok, except when running.
I got exception
E/AndroidRuntime( 1699): java.lang.ExceptionInInitializerError
E/AndroidRuntime( 1699): at org.apache.http.impl.conn.PoolingHttpClientConnectionManager$InternalConnectionFactory.<in
it>(PoolingHttpClientConnectionManager.java:487)
E/AndroidRuntime( 1699): at org.apache.http.impl.conn.PoolingHttpClientConnectionManager.<init>(PoolingHttpClientConne
ctionManager.java:147)
E/AndroidRuntime( 1699): at org.apache.http.impl.conn.PoolingHttpClientConnectionManager.<init>(PoolingHttpClientConne
ctionManager.java:136)
E/AndroidRuntime( 1699): at org.apache.http.impl.conn.PoolingHttpClientConnectionManager.<init>(PoolingHttpClientConne
ctionManager.java:112)
E/AndroidRuntime( 1699): at net.xnano.weatherlife.util.ApacheHTTP.<init>(ApacheHTTP.java:97)
E/AndroidRuntime( 1699): at net.xnano.weatherlife.view.WeatherLifeActivity$3.<init>(WeatherLifeActivity.java:105)
E/AndroidRuntime( 1699): at net.xnano.weatherlife.view.WeatherLifeActivity.onOptionsItemSelected(WeatherLifeActivity.j
ava:105)
E/AndroidRuntime( 1699): at android.app.Activity.onMenuItemSelected(Activity.java:2548)
E/AndroidRuntime( 1699): at com.android.internal.policy.impl.PhoneWindow.onMenuItemSelected(PhoneWindow.java:980)
E/AndroidRuntime( 1699): at com.android.internal.view.menu.MenuBuilder.dispatchMenuItemSelected(MenuBuilder.java:735)
E/AndroidRuntime( 1699): at com.android.internal.view.menu.MenuItemImpl.invoke(MenuItemImpl.java:149)
E/AndroidRuntime( 1699): at com.android.internal.view.menu.MenuBuilder.performItemAction(MenuBuilder.java:874)
E/AndroidRuntime( 1699): at com.android.internal.view.menu.ActionMenuView.invokeItem(ActionMenuView.java:547)
E/AndroidRuntime( 1699): at com.android.internal.view.menu.ActionMenuItemView.onClick(ActionMenuItemView.java:115)
E/AndroidRuntime( 1699): at android.view.View.performClick(View.java:4204)
E/AndroidRuntime( 1699): at android.view.View$PerformClick.run(View.java:17355)
E/AndroidRuntime( 1699): at android.os.Handler.handleCallback(Handler.java:725)
E/AndroidRuntime( 1699): at android.os.Handler.dispatchMessage(Handler.java:92)
E/AndroidRuntime( 1699): at android.os.Looper.loop(Looper.java:137)
E/AndroidRuntime( 1699): at android.app.ActivityThread.main(ActivityThread.java:5041)
E/AndroidRuntime( 1699): at java.lang.reflect.Method.invokeNative(Native Method)
E/AndroidRuntime( 1699): at java.lang.reflect.Method.invoke(Method.java:511)
E/AndroidRuntime( 1699): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:793)
E/AndroidRuntime( 1699): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:560)
E/AndroidRuntime( 1699): at dalvik.system.NativeStart.main(Native Method)
E/AndroidRuntime( 1699): Caused by: java.lang.ExceptionInInitializerError
E/AndroidRuntime( 1699): at org.apache.http.impl.conn.ManagedHttpClientConnectionFactory.<init>(ManagedHttpClientConne
ctionFactory.java:72)
E/AndroidRuntime( 1699): at org.apache.http.impl.conn.ManagedHttpClientConnectionFactory.<init>(ManagedHttpClientConne
ctionFactory.java:84)
E/AndroidRuntime( 1699): at org.apache.http.impl.conn.ManagedHttpClientConnectionFactory.<clinit>(ManagedHttpClientCon
nectionFactory.java:59)
E/AndroidRuntime( 1699): ... 25 more
E/AndroidRuntime( 1699): Caused by: java.lang.NoSuchFieldError: org.apache.http.message.BasicLineFormatter.INSTANCE
E/AndroidRuntime( 1699): at org.apache.http.impl.io.DefaultHttpRequestWriterFactory.<init>(DefaultHttpRequestWriterFac
tory.java:52)
E/AndroidRuntime( 1699): at org.apache.http.impl.io.DefaultHttpRequestWriterFactory.<init>(DefaultHttpRequestWriterFac
tory.java:56)
E/AndroidRuntime( 1699): at org.apache.http.impl.io.DefaultHttpRequestWriterFactory.<clinit>(DefaultHttpRequestWriterF
actory.java:46)
E/AndroidRuntime( 1699): ... 28 more
The library (in jar archive) which I added to libs folder has been exported, it seems the application uses internal org.apache.http package instead of my own library.
The IDE is Intellij Idea.
Did anyone solve this issue before please help me?
This issue is presented a few times in SO. The solution I took was to use a repackaged version of the library called httpclientandroidlib. This was presented as a solution in a newer version of this question at How to Override Android Api Class with a class available in added jar?
You can use your own library in next way
com.yourlibrary.MyClass myClass= new com.yourlibrary.MyClass();
Why am I not getting error codes for SQLite failures? I am trying to create a database and getting the following stacktrace (well, the top of the trace):
E/SqliteDatabaseCpp(11974): sqlite3_open_v2
("/mnt/sdcard/myapp/mydatabase.db", &handle, 6, NULL) failed
E/SQLiteDatabase(11974): Failed to open the database. closing it.
E/SQLiteDatabase(11974): android.database.sqlite.SQLiteCantOpenDatabaseException: unable to open database file
E/SQLiteDatabase(11974): at android.database.sqlite.SQLiteDatabase.dbopen(Native Method)
My code works in the emulator, works on a Nexus 7, but fails on another device
public SQLiteDatabase openOrCreateDatabase (String name, int mode,
SQLiteDatabase.CursorFactory factory,
DatabaseErrorHandler errorHandler)
{
File f = getDatabasePath (name);
System.out.println ("opening db: " + f.getPath());
return super.openOrCreateDatabase (f.getPath(), mode, factory, errorHandler);
}
Here's a full log from a second try. It's a little different than the first, but still no error code.
W/dalvikvm( 3314): threadid=1: thread exiting with uncaught exception (group=0x40a801f8)
E/AndroidRuntime( 3314): FATAL EXCEPTION: main
E/AndroidRuntime( 3314): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.myapp.myapp/com.myapp.myapp.main.MainActivity}: android.database.sqlite.SQLiteCantOpenDatabaseException: unable to open database file
E/AndroidRuntime( 3314): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1956)
E/AndroidRuntime( 3314): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1981)
E/AndroidRuntime( 3314): at android.app.ActivityThread.access$600(ActivityThread.java:123)
E/AndroidRuntime( 3314): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1147)
E/AndroidRuntime( 3314): at android.os.Handler.dispatchMessage(Handler.java:99)
E/AndroidRuntime( 3314): at android.os.Looper.loop(Looper.java:137)
E/AndroidRuntime( 3314): at android.app.ActivityThread.main(ActivityThread.java:4424)
E/AndroidRuntime( 3314): at java.lang.reflect.Method.invokeNative(Native Method)
E/AndroidRuntime( 3314): at java.lang.reflect.Method.invoke(Method.java:511)
E/AndroidRuntime( 3314): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:812)
E/AndroidRuntime( 3314): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:579)
E/AndroidRuntime( 3314): at dalvik.system.NativeStart.main(Native Method)
E/AndroidRuntime( 3314): Caused by: android.database.sqlite.SQLiteCantOpenDatabaseException: unable to open database file
E/AndroidRuntime( 3314): at android.database.sqlite.SQLiteDatabase.dbopen(Native Method)
E/AndroidRuntime( 3314): at android.database.sqlite.SQLiteDatabase.openDatabase(SQLiteDatabase.java:1013)
E/AndroidRuntime( 3314): at android.database.sqlite.SQLiteDatabase.openDatabase(SQLiteDatabase.java:986)
E/AndroidRuntime( 3314): at android.database.sqlite.SQLiteDatabase.openOrCreateDatabase(SQLiteDatabase.java:1051)
E/AndroidRuntime( 3314): at android.app.ContextImpl.openOrCreateDatabase(ContextImpl.java:782)
E/AndroidRuntime( 3314): at android.content.ContextWrapper.openOrCreateDatabase(ContextWrapper.java:221)
E/AndroidRuntime( 3314): at android.content.ContextWrapper.openOrCreateDatabase(ContextWrapper.java:221)
E/AndroidRuntime( 3314): at com.myapp.myapp.dbaccess.DatabaseContext.openOrCreateDatabase(DbHelper.java:63)
E/AndroidRuntime( 3314): at android.database.sqlite.SQLiteOpenHelper.getWritableDatabase(SQLiteOpenHelper.java:157)
E/AndroidRuntime( 3314): at com.myapp.myapp.dbaccess.DbHelper.getDb(DbHelper.java:184)
E/AndroidRuntime( 3314): at com.myapp.myapp.dbaccess.DbHelper.getZRoot(DbHelper.java:650)
E/AndroidRuntime( 3314): at com.myapp.myapp.dbaccess.ZNodeCache.getRequiredNodes(ZNodeCache.java:37)
E/AndroidRuntime( 3314): at com.myapp.myapp.dbaccess.ZNodeCache.<init>(ZNodeCache.java:22)
E/AndroidRuntime( 3314): at com.myapp.myapp.main.MainActivity.onCreate(MainActivity.java:81)
E/AndroidRuntime( 3314): at android.app.Activity.performCreate(Activity.java:4465)
E/AndroidRuntime( 3314): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1049)
E/AndroidRuntime( 3314): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1920)
E/AndroidRuntime( 3314): ... 11 more
Well, this was stupid. If you have your device connected and you select a "USB storage" connection, the sdcard becomes inaccessable. Moral of story: don't enable "USB storage" if your app accesses the sdcard.
Still, Android should emit an error code - I'll file a bug.
I assume that you can open images from your resources folder with Intent.ACTION_VIEW?
If not then let me know, and don't bother reading on! haha
If you can then I have this code:
Intent mainIntent = new Intent(Intent.ACTION_VIEW);
Uri uri = Uri.parse("android.resource://com.tclayson.myapp/"+extrasImgs.mImagesIds[position]);
mainIntent.setDataAndType(uri, "image/jpg");
startActivity(mainIntent);
And yet it is giving me this error:
E/AndroidRuntime( 309): FATAL EXCEPTION: main
E/AndroidRuntime( 309): android.content.ActivityNotFoundException: No Activity found to handle Intent { act=android.intent.action.VIEW dat=android.resource://com.tclayson.myapp/2130837611 }
E/AndroidRuntime( 309): at android.app.Instrumentation.checkStartActivityResult(Instrumentation.java:1512)
E/AndroidRuntime( 309): at android.app.Instrumentation.execStartActivity(Instrumentation.java:1384)
E/AndroidRuntime( 309): at android.app.Activity.startActivityForResult(Activity.java:3190)
E/AndroidRuntime( 309): at android.app.Activity.startActivity(Activity.java:3297)
E/AndroidRuntime( 309): at com.tclayson.myapp.FBRadioPlayer$SlidingContentPagerAdapter$5.onItemClick(TheActivity.java:226)
E/AndroidRuntime( 309): at android.widget.AdapterView.performItemClick(AdapterView.java:292)
E/AndroidRuntime( 309): at android.widget.AbsListView.performItemClick(AbsListView.java:1058)
E/AndroidRuntime( 309): at android.widget.AbsListView$PerformClick.run(AbsListView.java:2514)
E/AndroidRuntime( 309): at android.widget.AbsListView$1.run(AbsListView.java:3168)
E/AndroidRuntime( 309): at android.os.Handler.handleCallback(Handler.java:605)
E/AndroidRuntime( 309): at android.os.Handler.dispatchMessage(Handler.java:92)
E/AndroidRuntime( 309): at android.os.Looper.loop(Looper.java:137)
E/AndroidRuntime( 309): at android.app.ActivityThread.main(ActivityThread.java:4424)
E/AndroidRuntime( 309): at java.lang.reflect.Method.invokeNative(Native Method)
E/AndroidRuntime( 309): at java.lang.reflect.Method.invoke(Method.java:511)
E/AndroidRuntime( 309): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:784)
E/AndroidRuntime( 309): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:551)
E/AndroidRuntime( 309): at dalvik.system.NativeStart.main(Native Method)
W/ActivityManager( 152): Force finishing activity com.tclayson.myapp/.MyActivity
I have no idea what could be wrong with this! Any help would be brilliant.
Thanks
What means the scheme 'android.resource' ? I have never seen before. Your error message means no Application is found that can handle your URI scheme.
I couldn't find the answer to this. So I created my own image viewer in the app.
You should add http:// at the beginning of the URL. ie. use
Uri uri = Uri.parse("http://android.resource://com.tclayson.myapp/"+extrasImgs.mImagesIds[position]);
instead of
Uri uri = Uri.parse("android.resource://com.tclayson.myapp/"+extrasImgs.mImagesIds[position]);
While running the Navit code for car navigation, I am getting the following exception, i thought that navit library is not available. please any one help me.
E/AndroidRuntime( 365): Uncaught handler: thread main exiting due to uncaught exception
E/AndroidRuntime( 365): java.lang.ExceptionInInitializerError
E/AndroidRuntime( 365): at java.lang.Class.newInstanceImpl(Native Method)
E/AndroidRuntime( 365): at java.lang.Class.newInstance(Class.java:1472)
E/AndroidRuntime( 365): at android.app.Instrumentation.newActivity(Instrumentation.java:1097)
E/AndroidRuntime( 365): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2316)
E/AndroidRuntime( 365): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2417)
E/AndroidRuntime( 365): at android.app.ActivityThread.access$2100(ActivityThread.java:116)
E/AndroidRuntime( 365): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1794)
E/AndroidRuntime( 365): at android.os.Handler.dispatchMessage(Handler.java:99)
E/AndroidRuntime( 365): at android.os.Looper.loop(Looper.java:123)
E/AndroidRuntime( 365): at android.app.ActivityThread.main(ActivityThread.java:4203)
E/AndroidRuntime( 365): at java.lang.reflect.Method.invokeNative(Native Method)
E/AndroidRuntime( 365): at java.lang.reflect.Method.invoke(Method.java:521)
E/AndroidRuntime( 365): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:791)
E/AndroidRuntime( 365): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:549)
E/AndroidRuntime( 365): at dalvik.system.NativeStart.main(Native Method)
E/AndroidRuntime( 365): Caused by: java.lang.UnsatisfiedLinkError: Library navit not found
E/AndroidRuntime( 365): at java.lang.Runtime.loadLibrary(Runtime.java:489)
E/AndroidRuntime( 365): at java.lang.System.loadLibrary(System.java:557)
i downloaded the Navit code from , navit svn.ttps://navit.svn.sourceforge.net/svnroot/navit/trunk/navit But unable to run the code.
i want to run this code in Eclipse for Android Project.
You need to download Android NDK
Create standalong tools for your ARCH
Cross compile to ARM
Run make apkg
This error is due to missing libnavit.so.
Put libnavit.so it in /data/local
Change System.LoadLibrary to System.Load("/data/local/libnavit.so");
make apkg
Install
This exception should go away.
I have a little issues with an GLSurfaceView, when I start my Activity I make the GLSurfaceView invisible with this line of code:
glSurface.setVisibility(View.INVISIBLE);
During this time I start an AsyncTask which downloads an Image from network, at this time, if I press the back button I meet this Exception:
java.lang.NullPointerException
E/AndroidRuntime( 1847): at android.opengl.GLSurfaceView.onDetachedFromWindow(GLSurfaceView.java:530)
E/AndroidRuntime( 1847): at android.view.View.dispatchDetachedFromWindow(View.java:6033)
E/AndroidRuntime( 1847): at android.view.ViewGroup.dispatchDetachedFromWindow(ViewGroup.java:1156)
E/AndroidRuntime( 1847): at android.view.ViewGroup.dispatchDetachedFromWindow(ViewGroup.java:1156)
E/AndroidRuntime( 1847): at android.view.ViewGroup.dispatchDetachedFromWindow(ViewGroup.java:1156)
E/AndroidRuntime( 1847): at android.view.ViewGroup.dispatchDetachedFromWindow(ViewGroup.java:1156)
E/AndroidRuntime( 1847): at android.view.ViewRoot.dispatchDetachedFromWindow(ViewRoot.java:1630)
E/AndroidRuntime( 1847): at android.view.ViewRoot.doDie(ViewRoot.java:2671)
E/AndroidRuntime( 1847): at android.view.ViewRoot.die(ViewRoot.java:2641)
E/AndroidRuntime( 1847): at android.view.WindowManagerImpl.removeViewImmediate(WindowManagerImpl.java:218)
E/AndroidRuntime( 1847): at android.view.Window$LocalWindowManager.removeViewImmediate(Window.java:436)
E/AndroidRuntime( 1847): at android.app.ActivityThread.handleDestroyActivity(ActivityThread.java:3684)
E/AndroidRuntime( 1847): at android.app.ActivityThread.access$2900(ActivityThread.java:125)
E/AndroidRuntime( 1847): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2066)
E/AndroidRuntime( 1847): at android.os.Handler.dispatchMessage(Handler.java:99)
E/AndroidRuntime( 1847): at android.os.Looper.loop(Looper.java:123)
E/AndroidRuntime( 1847): at android.app.ActivityThread.main(ActivityThread.java:4627)
E/AndroidRuntime( 1847): at java.lang.reflect.Method.invokeNative(Native Method)
E/AndroidRuntime( 1847): at java.lang.reflect.Method.invoke(Method.java:521)
E/AndroidRuntime( 1847): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)
E/AndroidRuntime( 1847): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
E/AndroidR
What's wrong?
It could be that you haven't set the renderer.
From the android reference:
onDetachedFromWindow ()... Must not be called before a renderer has been set.
So, if you set the renderer (even if you aren't rendering anything yet), this might avoid the issue.