Coder Social home page Coder Social logo

Comments (13)

klattimer avatar klattimer commented on August 25, 2024

If you're seeing this you're probably getting out of memory errors first, if your app is memory intensive then you may want to try adding largeHeap to the android manifest. I had this problem caused by loading up an apk extension file which required the zip decompressor in memory, thus leading to an oom error and then to this.

I think a simple null check here would help too.

from tileview.

braj008 avatar braj008 commented on August 25, 2024

I am sure it's not about OOM error. Logcat message clearly shows its a NullPointerException as below

08-23 13:08:22.172: E/AndroidRuntime(22880): FATAL EXCEPTION: AsyncTask
08-23 13:08:22.172: E/AndroidRuntime(22880): java.lang.RuntimeException: An error occured while executing doInBackground()
08-23 13:08:22.172: E/AndroidRuntime(22880): at com.qozix.os.AsyncTask$3.done(AsyncTask.java:276)
08-23 13:08:22.172: E/AndroidRuntime(22880): at java.util.concurrent.FutureTask$Sync.innerSetException(FutureTask.java:273)
08-23 13:08:22.172: E/AndroidRuntime(22880): at java.util.concurrent.FutureTask.setException(FutureTask.java:124)
08-23 13:08:22.172: E/AndroidRuntime(22880): at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:307)
08-23 13:08:22.172: E/AndroidRuntime(22880): at java.util.concurrent.FutureTask.run(FutureTask.java:137)
08-23 13:08:22.172: E/AndroidRuntime(22880): at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1076)
08-23 13:08:22.172: E/AndroidRuntime(22880): at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:569)
08-23 13:08:22.172: E/AndroidRuntime(22880): at java.lang.Thread.run(Thread.java:856)
08-23 13:08:22.172: E/AndroidRuntime(22880): Caused by: java.lang.NullPointerException: key == null || value == null
08-23 13:08:22.172: E/AndroidRuntime(22880): at android.support.v4.util.LruCache.put(LruCache.java:117)
08-23 13:08:22.172: E/AndroidRuntime(22880): at com.qozix.tileview.tiles.TileCache.addBitmapToMemoryCache(TileCache.java:117)
08-23 13:08:22.172: E/AndroidRuntime(22880): at com.qozix.tileview.tiles.TileCache.addBitmap(TileCache.java:72)
08-23 13:08:22.172: E/AndroidRuntime(22880): at com.qozix.tileview.tiles.Tile.decode(Tile.java:75)
08-23 13:08:22.172: E/AndroidRuntime(22880): at com.qozix.tileview.tiles.TileManager.decodeIndividualTile(TileManager.java:308)
08-23 13:08:22.172: E/AndroidRuntime(22880): at com.qozix.tileview.tiles.TileRenderTask.doInBackground(TileRenderTask.java:51)
08-23 13:08:22.172: E/AndroidRuntime(22880): at com.qozix.tileview.tiles.TileRenderTask.doInBackground(TileRenderTask.java:1)
08-23 13:08:22.172: E/AndroidRuntime(22880): at com.qozix.os.AsyncTask$2.call(AsyncTask.java:262)
08-23 13:08:22.172: E/AndroidRuntime(22880): at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:305)
08-23 13:08:22.172: E/AndroidRuntime(22880): ... 4 more

from tileview.

moagrius avatar moagrius commented on August 25, 2024

Thanks for the note - I'll take a look as soon as I have some time - I probably just missed something when migrating. If you find a fix before then please post.

from tileview.

yolapop avatar yolapop commented on August 25, 2024

anyone found the fix?

Thx b4

from tileview.

moagrius avatar moagrius commented on August 25, 2024

I just tried and am unable to reproduce - it works fine for me. I suspect there's probably a bad file request (perhaps the result over overly-aggressive intersection detection, which was slightly modified from the previous version).

If either of you @yolapop or @braj008 want to post a problem app somewhere, I'd be interested in taking a look / debugging - otherwise I'd suggest trying the null checks mentioned earlier:

private void addBitmapToMemoryCache( String key, Bitmap bitmap ) {        
    if ( key == null || bitmap == null ) {
        return;
    }
    if ( getBitmapFromMemoryCache( key ) == null ) {
    // crashing here
        memoryCache.put( key, bitmap );
    }

If that works, post back and I'll update the repo.

Thanks

from tileview.

yolapop avatar yolapop commented on August 25, 2024

Worked for me 👯

from tileview.

moagrius avatar moagrius commented on August 25, 2024

cool - I've committed the change as well. will leave issue open for a while in case anyone wants to post an app for debug

from tileview.

braj008 avatar braj008 commented on August 25, 2024

Above mentioned solution is enough to solve the problem. I have been using following solution.

private void addBitmapToMemoryCache( String key, Bitmap bitmap ) {

    if ( getBitmapFromMemoryCache( key ) == null && bitmap != null ) {
        memoryCache.put( key, bitmap );
    }
} 

from tileview.

Tristus1er avatar Tristus1er commented on August 25, 2024

I would better suggest this fix:

In: DetailLevel in getIntersections function:

Replace

        int startingRow = (int) Math.floor( viewport.top / offsetHeight );
        int endingRow = (int) Math.ceil( viewport.bottom / offsetHeight );
        int startingColumn = (int) Math.floor( viewport.left / offsetWidth );
        int endingColumn = (int) Math.ceil( viewport.right / offsetWidth );

By:

        int startingRow = (int) Math.floor( viewport.top / offsetHeight );
        int endingRow = (int) Math.ceil( viewport.bottom / offsetHeight ) - 1;
        int startingColumn = (int) Math.floor( viewport.left / offsetWidth );
        int endingColumn = (int) Math.ceil( viewport.right / offsetWidth ) - 1;

As tailes are from 0 to n

from tileview.

moagrius avatar moagrius commented on August 25, 2024

awesome, big thanks - i'll try this out soon and if it works consistently i'll post a new commit

from tileview.

braj008 avatar braj008 commented on August 25, 2024

@Tristus1er solution worked. Shall I close the issue?

from tileview.

moagrius avatar moagrius commented on August 25, 2024

@braj008 i'll leave it open as a reminder until i test and commit the patch. thanks

from tileview.

moagrius avatar moagrius commented on August 25, 2024

updated in the latest release

from tileview.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.