You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I would like to instantiate the image viewer before actually showing it but I get this exception when using the "build()" method.
myActivity.runOnUiThread(new Runnable() {
ImageViewer viewer = new ImageViewer.Builder(getContext(), originalUrls)
.setStartPosition(0)
.allowZooming(true)
.build(); // Crash occurs here
@Override
public void run() {
planImage.setOnClickListener(v -> viewer.show());
}
});
java.lang.RuntimeException: Can't create handler inside thread that has not called Looper.prepare()
at android.os.Handler.(Handler.java:200)
at android.os.Handler.(Handler.java:114)
at android.view.GestureDetector$GestureHandler.(GestureDetector.java:290)
at android.view.GestureDetector.(GestureDetector.java:395)
at android.view.ScaleGestureDetector.setQuickScaleEnabled(ScaleGestureDetector.java:477)
at android.view.ScaleGestureDetector.(ScaleGestureDetector.java:227)
at android.view.ScaleGestureDetector.(ScaleGestureDetector.java:202)
at com.stfalcon.frescoimageviewer.ImageViewerView.init(ImageViewerView.java:143)
at com.stfalcon.frescoimageviewer.ImageViewerView.(ImageViewerView.java:65)
at com.stfalcon.frescoimageviewer.ImageViewer.createDialog(ImageViewer.java:72)
at com.stfalcon.frescoimageviewer.ImageViewer.(ImageViewer.java:53)
at com.stfalcon.frescoimageviewer.ImageViewer$Builder.build(ImageViewer.java:426)
I don't have any issue if I do this instead :
myActivity.runOnUiThread(new Runnable() {
@Override
public void run() {
planImage.setOnClickListener(v -> new ImageViewer.Builder(getContext(), originalUrls)
.setStartPosition(0)
.allowZooming(true)
.show());
}
});
But I guess it is a waste of resources ?
The text was updated successfully, but these errors were encountered:
I would like to instantiate the image viewer before actually showing it but I get this exception when using the "build()" method.
java.lang.RuntimeException: Can't create handler inside thread that has not called Looper.prepare()
at android.os.Handler.(Handler.java:200)
at android.os.Handler.(Handler.java:114)
at android.view.GestureDetector$GestureHandler.(GestureDetector.java:290)
at android.view.GestureDetector.(GestureDetector.java:395)
at android.view.ScaleGestureDetector.setQuickScaleEnabled(ScaleGestureDetector.java:477)
at android.view.ScaleGestureDetector.(ScaleGestureDetector.java:227)
at android.view.ScaleGestureDetector.(ScaleGestureDetector.java:202)
at com.stfalcon.frescoimageviewer.ImageViewerView.init(ImageViewerView.java:143)
at com.stfalcon.frescoimageviewer.ImageViewerView.(ImageViewerView.java:65)
at com.stfalcon.frescoimageviewer.ImageViewer.createDialog(ImageViewer.java:72)
at com.stfalcon.frescoimageviewer.ImageViewer.(ImageViewer.java:53)
at com.stfalcon.frescoimageviewer.ImageViewer$Builder.build(ImageViewer.java:426)
I don't have any issue if I do this instead :
But I guess it is a waste of resources ?
The text was updated successfully, but these errors were encountered: