In case an image source has been changed in several times there is java.lang.OutOfMemoryError exception.
java.lang.RuntimeException: An error occured while executing doInBackground()
at android.os.AsyncTask$3.done(AsyncTask.java:300)
at java.util.concurrent.FutureTask.finishCompletion(FutureTask.java:355)
at java.util.concurrent.FutureTask.setException(FutureTask.java:222)
at java.util.concurrent.FutureTask.run(FutureTask.java:242)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587)
at java.lang.Thread.run(Thread.java:818)
Caused by: java.lang.OutOfMemoryError: Failed to allocate a 8032012 byte allocation with 1496439 free bytes and 1461KB until OOM
at dalvik.system.VMRuntime.newNonMovableArray(Native Method)
at android.graphics.BitmapFactory.nativeDecodeByteArray(Native Method)
at android.graphics.BitmapFactory.decodeByteArray(BitmapFactory.java:634)
at org.nativescript.widgets.Async$Http$RequestResult.readResponseStream(Async.java:350)
at org.nativescript.widgets.Async$Http$HttpRequestTask.doInBackground(Async.java:428)
at org.nativescript.widgets.Async$Http$HttpRequestTask.doInBackground(Async.java:378)
at android.os.AsyncTask$2.call(AsyncTask.java:288)
at java.util.concurrent.FutureTask.run(FutureTask.java:237)
... 3 more
here is the code witch I used
import {Component} from "@angular/core";
@Component({
selector: "my-app",
template: `
<StackLayout>
<Image src="{{src}}" stretch="fill" (tap)="change()"></Image>
</StackLayout>
`
})
export class AppComponent {
src;
constructor() {
this.change();
}
change() {
this.src = 'https://placekitten.com/1000/200' + parseInt('' + Math.random() * 9);
}
}
tns --version: 2.1.0
tns-core-modules: 2.2.0
tns-android 2.1.1
Reactions are currently unavailable
In case an image source has been changed in several times there is java.lang.OutOfMemoryError exception.
java.lang.RuntimeException: An error occured while executing doInBackground()
at android.os.AsyncTask$3.done(AsyncTask.java:300)
at java.util.concurrent.FutureTask.finishCompletion(FutureTask.java:355)
at java.util.concurrent.FutureTask.setException(FutureTask.java:222)
at java.util.concurrent.FutureTask.run(FutureTask.java:242)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587)
at java.lang.Thread.run(Thread.java:818)
Caused by: java.lang.OutOfMemoryError: Failed to allocate a 8032012 byte allocation with 1496439 free bytes and 1461KB until OOM
at dalvik.system.VMRuntime.newNonMovableArray(Native Method)
at android.graphics.BitmapFactory.nativeDecodeByteArray(Native Method)
at android.graphics.BitmapFactory.decodeByteArray(BitmapFactory.java:634)
at org.nativescript.widgets.Async$Http$RequestResult.readResponseStream(Async.java:350)
at org.nativescript.widgets.Async$Http$HttpRequestTask.doInBackground(Async.java:428)
at org.nativescript.widgets.Async$Http$HttpRequestTask.doInBackground(Async.java:378)
at android.os.AsyncTask$2.call(AsyncTask.java:288)
at java.util.concurrent.FutureTask.run(FutureTask.java:237)
... 3 more
here is the code witch I used
import {Component} from "@angular/core"; @Component({ selector: "my-app", template: ` <StackLayout> <Image src="{{src}}" stretch="fill" (tap)="change()"></Image> </StackLayout> ` }) export class AppComponent { src; constructor() { this.change(); } change() { this.src = 'https://placekitten.com/1000/200' + parseInt('' + Math.random() * 9); } }tns --version: 2.1.0
tns-core-modules: 2.2.0
tns-android 2.1.1