Jul 26, 2017 Replies: 15 Better implementation: https://www.b4x.com/android/forum/threads/b4x-b4xgifview-cross-platform-animated-gif-view.118550/ Simple view that shows an animated gif. Based on agraham's GifDecoder library. The animated gifs included in this example are from giphy.com. I'm not sure whether they can be used commercially or not. Tip: B4J ImageView supports animated gifs. V1.20 - Images are cached once loaded. You need to add the following variable to the Main module: Code: Copy Sub Process_Globals Public GifsCache As Map End Sub Attachments GifViewer.zip GifViewer.zip 249.9 KB · Views: 2,751 Last edited: Jun 2, 2020 Click to expand...
Better implementation: https://www.b4x.com/android/forum/threads/b4x-b4xgifview-cross-platform-animated-gif-view.118550/ Simple view that shows an animated gif. Based on agraham's GifDecoder library. The animated gifs included in this example are from giphy.com. I'm not sure whether they can be used commercially or not. Tip: B4J ImageView supports animated gifs. V1.20 - Images are cached once loaded. You need to add the following variable to the Main module: Code: Copy Sub Process_Globals Public GifsCache As Map End Sub
Erel B4X founder Staff member Licensed User Longtime User Jul 26, 2017 #2 I've uploaded a new version. You should call GifViewer1.CallFromResume from Activity_Resume. This allows the animation to continue after activity is resumed. While the examples work properly in debug mode they look better in release mode.
I've uploaded a new version. You should call GifViewer1.CallFromResume from Activity_Resume. This allows the animation to continue after activity is resumed. While the examples work properly in debug mode they look better in release mode.
Erel B4X founder Staff member Licensed User Longtime User Jul 26, 2017 #3 Example of using it in a CustomLayoutDialog (Dialogs library): Attachments GifViewerInDialog.zip GifViewerInDialog.zip 15 KB · Views: 1,486 Last edited: Jul 27, 2017
LucaMs Expert Licensed User Longtime User Jul 26, 2017 #4 Copying updated assets files (4) *** Service (starter) Create *** ** Service (starter) Start ** ** Activity (main) Create, isFirst = true ** java.lang.OutOfMemoryError at android.graphics.Bitmap.nativeCreate(Native Method) at android.graphics.Bitmap.createBitmap(Bitmap.java:882) at android.graphics.Bitmap.createBitmap(Bitmap.java:906) at anywheresoftware.b4a.agraham.gifdecoder.GifDecoder.SetPixels(GifDecoder.java:298) at anywheresoftware.b4a.agraham.gifdecoder.GifDecoder.SetPixels(GifDecoder.java:396) at anywheresoftware.b4a.agraham.gifdecoder.GifDecoder.ReadImage(GifDecoder.java:805) at anywheresoftware.b4a.agraham.gifdecoder.GifDecoder.ReadContents(GifDecoder.java:672) at anywheresoftware.b4a.agraham.gifdecoder.GifDecoder.Read(GifDecoder.java:559) at anywheresoftware.b4a.agraham.gifdecoder.GifDecoder.Load(GifDecoder.java:211) at b4a.example.gifviewer._setgif(gifviewer.java:64) at java.lang.reflect.Method.invokeNative(Native Method) at java.lang.reflect.Method.invoke(Method.java:515) at anywheresoftware.b4a.shell.Shell.runMethod(Shell.java:710) at anywheresoftware.b4a.shell.Shell.raiseEventImpl(Shell.java:339) at anywheresoftware.b4a.shell.Shell.raiseEvent(Shell.java:249) at java.lang.reflect.Method.invokeNative(Native Method) at java.lang.reflect.Method.invoke(Method.java:515) at anywheresoftware.b4a.ShellBA.raiseEvent2(ShellBA.java:139) at b4a.example.main.afterFirstLayout(main.java:102) at b4a.example.main.access$000(main.java:17) at b4a.example.main$WaitForLayout.run(main.java:80) at android.os.Handler.handleCallback(Handler.java:733) at android.os.Handler.dispatchMessage(Handler.java:95) at android.os.Looper.loop(Looper.java:149) at android.app.ActivityThread.main(ActivityThread.java:5257) at java.lang.reflect.Method.invokeNative(Native Method) at java.lang.reflect.Method.invoke(Method.java:515) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:794) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:610) at dalvik.system.NativeStart.main(Native Method) ** Activity (main) Resume ** Tablet, 7.70 Gb free (your first example).
Copying updated assets files (4) *** Service (starter) Create *** ** Service (starter) Start ** ** Activity (main) Create, isFirst = true ** java.lang.OutOfMemoryError at android.graphics.Bitmap.nativeCreate(Native Method) at android.graphics.Bitmap.createBitmap(Bitmap.java:882) at android.graphics.Bitmap.createBitmap(Bitmap.java:906) at anywheresoftware.b4a.agraham.gifdecoder.GifDecoder.SetPixels(GifDecoder.java:298) at anywheresoftware.b4a.agraham.gifdecoder.GifDecoder.SetPixels(GifDecoder.java:396) at anywheresoftware.b4a.agraham.gifdecoder.GifDecoder.ReadImage(GifDecoder.java:805) at anywheresoftware.b4a.agraham.gifdecoder.GifDecoder.ReadContents(GifDecoder.java:672) at anywheresoftware.b4a.agraham.gifdecoder.GifDecoder.Read(GifDecoder.java:559) at anywheresoftware.b4a.agraham.gifdecoder.GifDecoder.Load(GifDecoder.java:211) at b4a.example.gifviewer._setgif(gifviewer.java:64) at java.lang.reflect.Method.invokeNative(Native Method) at java.lang.reflect.Method.invoke(Method.java:515) at anywheresoftware.b4a.shell.Shell.runMethod(Shell.java:710) at anywheresoftware.b4a.shell.Shell.raiseEventImpl(Shell.java:339) at anywheresoftware.b4a.shell.Shell.raiseEvent(Shell.java:249) at java.lang.reflect.Method.invokeNative(Native Method) at java.lang.reflect.Method.invoke(Method.java:515) at anywheresoftware.b4a.ShellBA.raiseEvent2(ShellBA.java:139) at b4a.example.main.afterFirstLayout(main.java:102) at b4a.example.main.access$000(main.java:17) at b4a.example.main$WaitForLayout.run(main.java:80) at android.os.Handler.handleCallback(Handler.java:733) at android.os.Handler.dispatchMessage(Handler.java:95) at android.os.Looper.loop(Looper.java:149) at android.app.ActivityThread.main(ActivityThread.java:5257) at java.lang.reflect.Method.invokeNative(Native Method) at java.lang.reflect.Method.invoke(Method.java:515) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:794) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:610) at dalvik.system.NativeStart.main(Native Method) ** Activity (main) Resume ** Tablet, 7.70 Gb free (your first example).
LucaMs Expert Licensed User Longtime User Jul 26, 2017 #5 LucaMs said: java.lang.OutOfMemoryError Click to expand... It is Source.gif (app crashes even if If I use GifViewer3 only)
LucaMs said: java.lang.OutOfMemoryError Click to expand... It is Source.gif (app crashes even if If I use GifViewer3 only)
Erel B4X founder Staff member Licensed User Longtime User Jul 26, 2017 #6 Use a smaller gif file or set android:largeHeap to true.
LucaMs Expert Licensed User Longtime User Jul 26, 2017 #7 Erel said: android:largeHeap Click to expand... This was enough but... I flipped my tablet (then restated Activity_Create) and crash again. Somewhere something does not free memory. P.S. DisposeFrames?
Erel said: android:largeHeap Click to expand... This was enough but... I flipped my tablet (then restated Activity_Create) and crash again. Somewhere something does not free memory. P.S. DisposeFrames?
Erel B4X founder Staff member Licensed User Longtime User Jul 27, 2017 #9 V1.20 is released. The decoded frames are cached. Note that you need to add the following variable to the main module: Code: Copy Sub Process_Globals Public GifsCache As Map End Sub
V1.20 is released. The decoded frames are cached. Note that you need to add the following variable to the main module: Code: Copy Sub Process_Globals Public GifsCache As Map End Sub
omarruben Active Member Licensed User Longtime User May 8, 2018 #10 Is it possible to create ,by code, a new gifviewer object from the cache???, I have already load a few gifs, then I want to create a random gifviewer-objects without loading again from the file.
Is it possible to create ,by code, a new gifviewer object from the cache???, I have already load a few gifs, then I want to create a random gifviewer-objects without loading again from the file.
Erel B4X founder Staff member Licensed User Longtime User May 8, 2018 #11 Create a layout file with a single custom view and load it whenever you want to add the view programmatically. How to add Custom Views programmatically
Create a layout file with a single custom view and load it whenever you want to add the view programmatically. How to add Custom Views programmatically
M Mike1970 Well-Known Member Licensed User Longtime User Aug 16, 2018 #12 Hi everyone, someone knows whats the problem here? i jsut copied the class and loaded my gif Error occurred on line: 63 (Main) java.lang.RuntimeException: Class instance was not initialized (gifviewer) at anywheresoftware.b4a.debug.Debug.shouldDelegate(Debug.java:241) at b4a.example.gifviewer._setgif(gifviewer.java:59) at b4a.example.main._activity_create(main.java:450) at java.lang.reflect.Method.invoke(Native Method) at anywheresoftware.b4a.shell.Shell.runMethod(Shell.java:735) at anywheresoftware.b4a.shell.Shell.raiseEventImpl(Shell.java:360) at anywheresoftware.b4a.shell.Shell.raiseEvent(Shell.java:260) at java.lang.reflect.Method.invoke(Native Method) at anywheresoftware.b4a.ShellBA.raiseEvent2(ShellBA.java:144) at b4a.example.main.afterFirstLayout(main.java:104) at b4a.example.main.access$000(main.java:17) at b4a.example.main$WaitForLayout.run(main.java:82) at android.os.Handler.handleCallback(Handler.java:815) at android.os.Handler.dispatchMessage(Handler.java:104) at android.os.Looper.loop(Looper.java:207) at android.app.ActivityThread.main(ActivityThread.java:6020) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:936) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:797)
Hi everyone, someone knows whats the problem here? i jsut copied the class and loaded my gif Error occurred on line: 63 (Main) java.lang.RuntimeException: Class instance was not initialized (gifviewer) at anywheresoftware.b4a.debug.Debug.shouldDelegate(Debug.java:241) at b4a.example.gifviewer._setgif(gifviewer.java:59) at b4a.example.main._activity_create(main.java:450) at java.lang.reflect.Method.invoke(Native Method) at anywheresoftware.b4a.shell.Shell.runMethod(Shell.java:735) at anywheresoftware.b4a.shell.Shell.raiseEventImpl(Shell.java:360) at anywheresoftware.b4a.shell.Shell.raiseEvent(Shell.java:260) at java.lang.reflect.Method.invoke(Native Method) at anywheresoftware.b4a.ShellBA.raiseEvent2(ShellBA.java:144) at b4a.example.main.afterFirstLayout(main.java:104) at b4a.example.main.access$000(main.java:17) at b4a.example.main$WaitForLayout.run(main.java:82) at android.os.Handler.handleCallback(Handler.java:815) at android.os.Handler.dispatchMessage(Handler.java:104) at android.os.Looper.loop(Looper.java:207) at android.app.ActivityThread.main(ActivityThread.java:6020) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:936) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:797)
Erel B4X founder Staff member Licensed User Longtime User Aug 16, 2018 #13 Have you added it with the designer?
S Soham Korade New Member Apr 13, 2020 #14 App not running java.lang.ClassNotFoundException: <>$gifviewer Can anyone please help me out?
Erel B4X founder Staff member Licensed User Longtime User Apr 14, 2020 #15 Does it happen with the example from the first post?
S Soham Korade New Member Apr 14, 2020 #16 Erel said: Does it happen with the example from the first post? Click to expand... No, but somehow I managed to get through. Thanks.
Erel said: Does it happen with the example from the first post? Click to expand... No, but somehow I managed to get through. Thanks.