B4A Library Animated GIF decode library

Attachments

  • GifDecoder1.0.zip
    29.9 KB · Views: 4,682
Last edited by a moderator:

NeoTechni

Well-Known Member
Licensed User
Longtime User
I don't think you should consider B4A as a full replacement for Android-development but call it a playtoy seems a bit too strong.

While most important things are already covered in B4A, it is obvious that it can't cover everything that is "doable" with Eclipse

Eclipse is such a pain in the ass I wouldn't consider that a full SDK or a playtoy.
If B4A is a playtoy, it's only cause Erel did a good enough job you could consider programming fun again instead of a chore.
 

NeoTechni

Well-Known Member
Licensed User
Longtime User
"WHAM!" (brick wall):BangHead: - B4A doesn't monitor microphone levels (and if not for XverhelstX, didn't have the ability to record anything at all).

Well Erel is working on the programming side of things. He can't tap into every piece of Android, that's up to us to add. He has more important things to do.
 

moster67

Expert
Licensed User
Longtime User
?????

I didn't call B4A a playtoy.....


Eclipse is such a pain in the ass I wouldn't consider that a full SDK or a playtoy.
If B4A is a playtoy, it's only cause Erel did a good enough job you could consider programming fun again instead of a chore.
 

stevel05

Expert
Licensed User
Longtime User
"WHAM!" (brick wall):BangHead: - B4A doesn't monitor microphone levels (and if not for XverhelstX, didn't have the ability to record anything at all).

Is this still an issue for you Highwinder, I thought it was sorted out here. If not, there was no follow up in the thread to say so.

I agree with NeoTechni, and users getting involved in helping out on the forums and adding some required functionality through libraries or modules only enhances their own understanding of the Android/Java/B4A environment.

I'm sure that Erel would like to build more of the functionality into the core product, but there are only so many hours in a day. I think that Erel's responses to functionality requests are timely and measured, and if we(as users) can take a little weight off in these other areas, it'll make this great product even better in the long run.
 

NeoTechni

Well-Known Member
Licensed User
Longtime User
Not exactly. Basic4android has an excellent support for external libraries. External libraries behave exactly like the internal ones.

I agree. It's the best method. If you build everything into it, it increases both the filesize, and permissions required for every app. Having them dynamically loaded is far more efficient
 

Erel

B4X founder
Staff member
Licensed User
Longtime User
and permissions required for every app
Note that permissions are only added when you declare an object that requires the specific permission. For example if you use Phone object from the Phone library then no permissions will be added. Only when you declare PhoneId then the READ_STATE permission is added.
 

pjd

Member
Licensed User
Longtime User
Hmm..
The version of gifdecoder (version 1.2 no less) linked to
here didn't work for me - ther is no .jar file in it ... ?

The link in this thread o/p (v 1.0) works ok.

Just sayin'

Cheers.
 

salmander

Active Member
Licensed User
Longtime User
Hello there,

I got an error when I try to use my own .gif file with 36 frames
width: 301
heigth: 100

Error:
"An error has occured in sub:main_btnload_click(B4a line: 42)
Timer1.Enabled = true
java.lang.IllegalstateException: Intevral must be larger than 0.
Continue?"

How do I solve this?
running on my SE Xperia X10i

XverhelstX

EDIT: I solved the problem, It was something weird.

All gif files on my pc didn't worked, then I used some of the internet and those worked.
I went to iaza.com and uploaded my gif file there and resaved it and it worked.

XverhelstX
I am facing the same problem, the gif file I have is not working...giving the same error that you mentioned. I have also tried uploading my image to iaza.com and downloading it again but still its not working. However, i can see the animation in the internet explorer fine.
Help please.
 

salmander

Active Member
Licensed User
Longtime User
Hello there,

I got an error when I try to use my own .gif file with 36 frames
width: 301
heigth: 100

Error:
"An error has occured in sub:main_btnload_click(B4a line: 42)
Timer1.Enabled = true
java.lang.IllegalstateException: Intevral must be larger than 0.
Continue?"

How do I solve this?
running on my SE Xperia X10i

XverhelstX

EDIT: I solved the problem, It was something weird.

All gif files on my pc didn't worked, then I used some of the internet and those worked.
I went to iaza.com and uploaded my gif file there and resaved it and it worked.

XverhelstX
I just downloaded another gif from the internet but when i use it in my app, it crashes with the following message.
B4X:
java.lang.NullPointerException
   at anywheresoftware.b4a.objects.Timer$TickTack.run(Timer.java:102)
   at android.os.Handler.handleCallback(Handler.java:587)
   at android.os.Handler.dispatchMessage(Handler.java:92)
   at android.os.Looper.loop(Looper.java:130)
   at android.app.ActivityThread.main(ActivityThread.java:3683)
   at java.lang.reflect.Method.invokeNative(Native Method)
   at java.lang.reflect.Method.invoke(Method.java:507)
   at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:839)
   at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:597)
   at dalvik.system.NativeStart.main(Native Method)
  Force finishing activity com.home.soft.test/.orderfeedback
 
Last edited:

salmander

Active Member
Licensed User
Longtime User
Yes I am pausing the timer1 on activity_pause. what strange thing I observed is when I create a new project and copy paste the code of gif_decoder from my project into the new one, it works fine. On the other hand in my project, the application crashes.
I have the following libraries in my project.
* ABWifi 1.20
* GifDecoder v1.0
* HTTP v1.10
* JSON v1.0
* Phone v1.75
* Reflection v1.6
* SQL v1.02
* TabHostExtras v1.5
* Turn GPS v1.10

I cannot post the entire project here, as its for my company. But if you would like to see, I can post the activity's code here.

Thanks Erel.
 

salmander

Active Member
Licensed User
Longtime User
My gifs are working fine mate ...as I can open them and see the animation. Thanks mate.
 

Woinowski

Active Member
Licensed User
Longtime User
Difficulties not from B4A?

Thanks for your reply.

This might draw some criticism, but I'm starting to get the impression that B4A is more of a playtoy than a real Android development product. Every time I come up with an app I want to write in B4A, apps that others are writing out there in the Java world, and seemingly no matter how simplistic, I hit a brick wall. :BangHead: This is getting extremely frustrating, and I'm having a real hard time taking B4A seriously at this point.

It feels like I'm being told at nearly every turn to finally just get off my butt, do it right, and learn Java. :sign0148:

I'd LOVE to be wrong here, but...
Hi, I doubt that difficulties come from B4A (or from Java, or do not exist in Java). Especially with things like live wallpapers you should remember that Android is a real time environment with big restrictions on performance, memory consumption and power consumption. Build live wallpapers wrong, and the battery of the phone is empty quickly, or performance deteriorates. Building them right needs to know how a service oriented multitasking operating system works. (Guess why first iOS could not really do multitasking...)
 

zeuspower

Member
Licensed User
Longtime User
well,I like this library ,I am trying to use it but sometimes it causes :

<!>anywheresoftware.b4a.BA 466<!> java.lang.ArrayIndexOutOfBoundsException
or <!>anywheresoftware.b4a.BA 466<!> java.lang.IndexOutOfBoundsException: Invalid index 0, size is 0

the code is here:

B4X:
Sub btn_load_gif_askisis_Click
      'Try
      Timer1.Initialize("Timer1",0)  'πρεπει να γινεται και εδω initialize γιατι αλλιως σκαει ο TIMER
      
      Dim what_picture As String
      gif.DisposeFrames
      If number_askisis=1 Then what_picture="BBBenchPress-no1.gif"
      If number_askisis=2 Then what_picture="BBInclineBenchPress-no2.gif"
      If number_askisis=3 Then what_picture="BBDeclineBenchPress-no3.gif"
      If number_askisis=4 Then what_picture="DBBenchPress-no4.gif"
      If number_askisis=5 Then what_picture="DBDeclineBenchPress-no5.gif"
      If number_askisis=6 Then what_picture="DBInclineBenchPress-no6.gif"
      If number_askisis=7 Then what_picture="DBPullover-no7.gif"
      If number_askisis=8 Then what_picture="DBFly-no8.gif"
       
      If number_askisis=9 Then what_picture="BBDeadlift-no9.gif"
      If number_askisis=10 Then what_picture="Clean-no10.gif"
      If number_askisis=11 Then what_picture="WTChinUp-no11.gif"
      If number_askisis=12 Then what_picture="WTpullUp-test-no12.gif"
      If number_askisis=13 Then what_picture="WTRearPullup-no13.gif"
      If number_askisis=14 Then what_picture="CBFrontPulldown-no14.gif"
      If number_askisis=15 Then what_picture="DBBentoverRow-no15.gif"
      If number_askisis=16 Then what_picture="BBBentOverRow-no16.gif"
gif.Load(File.DirAssets,what_picture)
   
   'ToastMessageShow(gif.FrameCount & " frames", True)
   Frame = 0
   Timer1.Interval = gif.Delay(Frame)   
   ImageView1.Bitmap = gif.Frame(Frame)
   
   Timer1.Enabled = True
   gif.SaveFrame(0, File.DirRootExternal, "frame0.png", "P", 85)   
   gif.SaveFrame(0, File.DirRootExternal, "frame0.jpg", "J", 85)
   'Catch 
   'Msgbox("PLEASE CHOOSE AN EXERCISE FIRST !","")
   'End Try
   
End Sub
Sub Timer1_Tick
   Timer1.Enabled = False
   Frame = Frame + 1
   If Frame >= gif.FrameCount Then
      Frame = 0
   End If
   Timer1.Interval=    gif.Delay(Frame)   
   ImageView1.Bitmap = gif.Frame(Frame)
   Timer1.Enabled = True
End Sub

WHAT I AM TRYING TO DO IS EVERYTIME I SELECT A bodybuiding EXERCISE (FROM AN ITEMVIEW CLICK,AND THEN FROM A SQL DATABASE) TO LOAD A DIFFERENT ANIMATED GIF FOR THAT EXERCISE NUMBER, BUT WHILE WORKS OK FOR SOMETIME,THEN STARTS TO THROW THE EXCEPTION ERROR ON the gif.LOAD

SORRY FOR MY ENGLISH...
 
Last edited:
Top