B4A Library [Lib] CoverFlow v2.0

Hi guys, as I have promised, CoverFlow is here.

Download the Coverflow.zip

The zip contains the library and an example that´s all


The CoverFlow Class = Neil Davies




B4ACoverFlow
Author:
Giuseppe Salvi
Version: 2
  • PhotoFlow
    Events:
    • ItemClick (Position As Int, Value As Object)
    • ItemLongClick (Position As Int, Value As Object)
    • ItemSelected (Position As Int, Value As Object)
    Methods:
    • AddImage (Dir As String, FileName As String)
      Add an image at the end of the PhotoFlow from sdcard or AssetsDir
      Example:
      PhotoFlow.AddImage(File.DirRootExternal,"a.jpg")
    • AddImageAt (index As Int, Dir As String, FileName As String)
      Add an image to the desired position in the PhotoFlow from sdcard or AssetsDir
      Example:
      PhotoFlow.AddImage(1,File.DirRootExternal,"a.jpg")
    • BringToFront
    • ClearCache
      Delete entire disk and memory cache created before
    • GetImageListFromAssets (path As String) As List
      Get entire list of images stored in assets folder
      Examples:
      Dim lv as ListView
      Dim l as list
      l.Initialize
      lv.Initialize("lv")
      Sub Menu_Click
      Activity.AddView(lv,0,0,100%x,100%y)
      l = Coverflow.GetImageListFromAssets("Here the Images path u've in assets")
      For n = 0 To l.Size-1
      lv.AddSingleLine(l.Get(n))
      next
      End Sub
    • GetItem (position As Int) As String
      Returns Item
      Example:
      i.Bitmap=LoadBitmap("",PhotoFlow.GetItem(Position))
    • InitializeCarousel (EventName As String)
      Initialize the Carousel
    • InitializeCoverflow (EventName As String)
      Initialize the PhotoFlow
    • IsInitialized As Boolean
    • PopulatePhotoFlow (dir As String, path As String)
      Populate PhotoFlow from sdcard not from assets
    • PopulatePhotoFlowFromAssets (path As String)
      Populate CoverFlow from assets not from sdcard
    • RemoveView
    • SendToBack
    • SetBackgroundImage (arg0 As Bitmap)
    • SetLayout (arg0 As Int, arg1 As Int, arg2 As Int, arg3 As Int)
    Permissions:
    • android.permission.WRITE_EXTERNAL_STORAGE
    Properties:
    • AnimationDuration As Int [write only]
      Sets how long the transition animation should run when a child view changes position.
    • Carousel As Boolean [write only]
      Set as Carousel
    • Color As Int [write only]
    • CreateCache As String [write only]
      Sets the name of your own cache
      Examples:
      PhotoFlow.CreateCache = "Your cache Name Here")
      It'll create a cache in "Android/data/Your cache name/cache/.thumbs" in to SdCard
    • Enabled As Boolean
    • FadingEdgeLength As Int [write only]
      Set the size of the faded edge used to indicate that more content in this view is available.
    • Height As Int
    • ItemHeight As Int
      Get or Set ItemHeight
    • ItemWidth As Int
      Get or Sets ItemWidth
    • Left As Int
    • Length As Int [read only]
      Returns lenght
    • Reverse As Boolean [write only]
      Set reverse
    • Selection As Int [write only]
      Jump directly to a specific item in the adapter data.
    • ShowText As Boolean
      Get or Sets the visibility of the text - by default is hide
    • Spacing As Int [write only]
      Sets the spacing between items in a Gallery
    • Tag As Object
    • TextColor As Int
      Get or Sets Text Color - by default is White
    • TextSize As Int
      Get or Sets Text size
    • Top As Int
    • Version As String [read only]
      Return Author and Version of this library
    • Visible As Boolean
    • Width As Int
 

Attachments

  • coverflow.jpg
    coverflow.jpg
    83.8 KB · Views: 2,463
  • coverflow2.jpg
    coverflow2.jpg
    81.1 KB · Views: 2,254
  • CoverFlow with Text.jpg
    CoverFlow with Text.jpg
    115.6 KB · Views: 1,662
  • B4ACoverFlow v.1.70.zip
    36.2 KB · Views: 550
  • B4ACoverFlow v.1.80.zip
    40.2 KB · Views: 549
  • B4ACoverFlow v2.0 fix.zip
    40.6 KB · Views: 1,163
Last edited:

susu

Well-Known Member
Licensed User
Longtime User
Hi susu, ofcours tomorrow i´ll put it in the forum.

In it you can customize with your own icons, just respecting the names and of icons otherwise you'll get a file not found error, the size of the icons must be 64 x 64 ,that´s all.

Hi,

Where's your other libraries? I'm still waiting.
 

Stulish

Active Member
Licensed User
Longtime User
Hi Stulish,it doesn't jump around is an animation. Thanks for A+

What i meant was that the panels to the side don't seem to move smoothly, they tend to jump slightly at the start of the animation then they are smooth, it looks like the maths for the slant of the top and bottom is slightly out while in the 'parked' position, and you only notice the jump on the transition to the panel moving.

not sure if i am making sense

Regards

Stu
 

lonleystar

Well-Known Member
Licensed User
Longtime User
What i meant was that the panels to the side don't seem to move smoothly, they tend to jump slightly at the start of the animation then they are smooth, it looks like the maths for the slant of the top and bottom is slightly out while in the 'parked' position, and you only notice the jump on the transition to the panel moving.

not sure if i am making sense

Regards

Stu
Hi Stulish, i understood what u mean but the CoverFlow Class is fro Neil Davies

i just adapted it for my code. But anyway i´ll check it.
 

MaxApps

Active Member
Licensed User
Longtime User
Hi

It looks really good.
But I was wondering, if it would be possible, to choose the filename extension, when populating?
I have some apps, that contains a lot of pictures, that I have renamed, so they do not show up in the native gallery (pic1.aaa instead of pic1.jpg)

Kind regards
Jakob
MaxApps
 

lonleystar

Well-Known Member
Licensed User
Longtime User
Hi

It looks really good.
But I was wondering, if it would be possible, to choose the filename extension, when populating?
I have some apps, that contains a lot of pictures, that I have renamed, so they do not show up in the native gallery (pic1.aaa instead of pic1.jpg)

Kind regards
Jakob
MaxApps
Hi Jakob, in coverflow are included, these extensions :

JPG, JPEG, PNG, GIF, TIFF, BMP.

Tell me which extensions you would like to include.
 

MaxApps

Active Member
Licensed User
Longtime User
I was hoping, that it would be possible to set it manually. My pictures are actually jpg, but I have renamed them to mpf and ppf, to keep them hidden from the gallery apps.

Kind regards
Jakob
 

clarionero

Active Member
Licensed User
Longtime User
Hi. Very impresive library. Very easy to use and implement.

Is posible control the memory usage for the images load? I have a gallery with 10 images. It load ok, and i can see the images in my S3, but if i move across the images the app crash. I read the unfiltered logs and the issue is when app log an insuficient memory.

I tried to reduce the images size (from 100 to 30 kb) and resolution (from 1900 to 1500 pixels), but the error hasn't gone.
 

lonleystar

Well-Known Member
Licensed User
Longtime User
Hi. Very impresive library. Very easy to use and implement.

Is posible control the memory usage for the images load? I have a gallery with 10 images. It load ok, and i can see the images in my S3, but if i move across the images the app crash. I read the unfiltered logs and the issue is when app log an insuficient memory.

I tried to reduce the images size (from 100 to 30 kb) and resolution (from 1900 to 1500 pixels), but the error hasn't gone.
Hi Clarionero, do u mean when u sclroll the gallery or when u wont display the image?

for the scroll i dont get error.

for displaing the image:

Use this

Sub Coverflow_ItemClick(Position As Int, Value As Object)
Coverflow.SetBackgroundImage(LoadBitmapSample("", Value,640,480))
End Sub

Instead of this.

Sub Coverflow_ItemClick(Position As Int, Value As Object)
Coverflow.SetBackgroundImage(LoadBitmap("", Value))
End Sub

let me know about it.
 

clarionero

Active Member
Licensed User
Longtime User
Hi. I have my background empty. Only white color.

The issue is when the images are loaded and i slide the gallery images. After i slide some images then the app crash with out of memory in log. I will try to capture a log for you.

Thank you, its a great library :)
 

clarionero

Active Member
Licensed User
Longtime User
Hi. This is the log i could take :)

B4X:
Touch event's action is 0x1 (deviceType=0) [pCnt=1, s=]
Delivering touch to current input target: action: 0x1
Delivering touch to current input target: action: 0x1
Delivering touch to current input target: action: 0x1
GC_FOR_ALLOC freed <1K, 12% free 57408K/64519K, paused 17ms, total 17ms
Forcing collection of SoftReferences for 2160016-byte allocation
GC_BEFORE_OOM freed <1K, 12% free 57408K/64519K, paused 23ms, total 23ms


Out of memory on a 2160016-byte allocation.
"main" prio=5 tid=1 RUNNABLE
  | group="main" sCount=0 dsCount=0 obj=0x40e85508 self=0x40e73a78
  | sysTid=25492 nice=0 sched=0/0 cgrp=apps handle=1074839344
  | schedstat=( 44903018108 19156852442 128953 ) utm=3763 stm=726 core=0
  at android.graphics.Bitmap.nativeCreate(Native Method)
  at android.graphics.Bitmap.createBitmap(Bitmap.java:640)
  at android.graphics.Bitmap.createBitmap(Bitmap.java:620)
  at it.giuseppe.salvi.utility.ICOSCoverflowDownloader.reflectionBitmap(ICOSCoverflowDownloader.java:338)
  at it.giuseppe.salvi.utility.ICOSCoverflowDownloader.download(ICOSCoverflowDownloader.java:84)
  at it.giuseppe.salvi.adapter.ICOSCoverflowAdapter.getView(ICOSCoverflowAdapter.java:78)
  at android.widget.Gallery.makeAndAddView(Gallery.java:849)
  at android.widget.Gallery.fillToGalleryRightLtr(Gallery.java:803)
  at android.widget.Gallery.fillToGalleryRight(Gallery.java:747)
  at android.widget.Gallery.trackMotionScroll(Gallery.java:387)
  at android.widget.Gallery.onScroll(Gallery.java:1027)
  at android.view.GestureDetector.onTouchEvent(GestureDetector.java:1327)
  at android.widget.Gallery.onTouchEvent(Gallery.java:942)
  at android.view.View.dispatchTouchEvent(View.java:7337)
  at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2410)
  at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2145)
  at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2416)
  at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2159)
  at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2416)
  at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2159)
  at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2416)
  at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2159)
  at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2416)
  at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2159)
  at com.android.internal.policy.impl.PhoneWindow$DecorView.superDispatchTouchEvent(PhoneWindow.java:2115)
  at com.android.internal.policy.impl.PhoneWindow.superDispatchTouchEvent(PhoneWindow.java:1468)
  at android.app.Activity.dispatchTouchEvent(Activity.java:2487)
  at com.android.internal.policy.impl.PhoneWindow$DecorView.dispatchTouchEvent(PhoneWindow.java:2063)
  at android.view.View.dispatchPointerEvent(View.java:7520)
  at android.view.ViewRootImpl.deliverPointerEvent(ViewRootImpl.java:3376)
  at android.view.ViewRootImpl.deliverInputEvent(ViewRootImpl.java:3308)
  at android.view.ViewRootImpl.doProcessInputEvents(ViewRootImpl.java:4402)
  at android.view.ViewRootImpl.enqueueInputEvent(ViewRootImpl.java:4380)
  at android.view.ViewRootImpl$WindowInputEventReceiver.onInputEvent(ViewRootImpl.java:4484)
  at android.view.InputEventReceiver.dispatchInputEvent(InputEventReceiver.java:171)
  at android.view.InputEventReceiver.nativeConsumeBatchedInputEvents(Native Method)
  at android.view.InputEventReceiver.consumeBatchedInputEvents(InputEventReceiver.java:163)
  at android.view.ViewRootImpl.doConsumeBatchedInput(ViewRootImpl.java:4452)
  at android.view.ViewRootImpl$ConsumeBatchedInputRunnable.run(ViewRootImpl.java:4503)
  at android.view.Choreographer$CallbackRecord.run(Choreographer.java:725)
  at android.view.Choreographer.doCallbacks(Choreographer.java:555)
  at android.view.Choreographer.doFrame(Choreographer.java:523)
  at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:711)
  at android.os.Handler.handleCallback(Handler.java:615)
  at android.os.Handler.dispatchMessage(Handler.java:92)
  at android.os.Looper.loop(Looper.java:137)
  at android.app.ActivityThread.main(ActivityThread.java:4898)
  at java.lang.reflect.Method.invokeNative(Native Method)
  at java.lang.reflect.Method.invoke(Method.java:511)
  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1006)
  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:773)
  at dalvik.system.NativeStart.main(Native Method)

Exception dispatching input event.


Shutting down VM
threadid=1: thread exiting with uncaught exception (group=0x40e842a0)
java.lang.OutOfMemoryError
   at android.graphics.Bitmap.nativeCreate(Native Method)
   at android.graphics.Bitmap.createBitmap(Bitmap.java:640)
   at android.graphics.Bitmap.createBitmap(Bitmap.java:620)
   at it.giuseppe.salvi.utility.ICOSCoverflowDownloader.reflectionBitmap(ICOSCoverflowDownloader.java:338)
   at it.giuseppe.salvi.utility.ICOSCoverflowDownloader.download(ICOSCoverflowDownloader.java:84)
   at it.giuseppe.salvi.adapter.ICOSCoverflowAdapter.getView(ICOSCoverflowAdapter.java:78)
   at android.widget.Gallery.makeAndAddView(Gallery.java:849)
   at android.widget.Gallery.fillToGalleryRightLtr(Gallery.java:803)
   at android.widget.Gallery.fillToGalleryRight(Gallery.java:747)
   at android.widget.Gallery.trackMotionScroll(Gallery.java:387)
   at android.widget.Gallery.onScroll(Gallery.java:1027)
   at android.view.GestureDetector.onTouchEvent(GestureDetector.java:1327)
   at android.widget.Gallery.onTouchEvent(Gallery.java:942)
   at android.view.View.dispatchTouchEvent(View.java:7337)
   at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2410)
   at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2145)
   at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2416)
   at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2159)
   at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2416)
   at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2159)
   at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2416)
   at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2159)
   at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2416)
   at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2159)
   at com.android.internal.policy.impl.PhoneWindow$DecorView.superDispatchTouchEvent(PhoneWindow.java:2115)
   at com.android.internal.policy.impl.PhoneWindow.superDispatchTouchEvent(PhoneWindow.java:1468)
   at android.app.Activity.dispatchTouchEvent(Activity.java:2487)
   at com.android.internal.policy.impl.PhoneWindow$DecorView.dispatchTouchEvent(PhoneWindow.java:2063)
   at android.view.View.dispatchPointerEvent(View.java:7520)
   at android.view.ViewRootImpl.deliverPointerEvent(ViewRootImpl.java:3376)
   at android.view.ViewRootImpl.deliverInputEvent(ViewRootImpl.java:3308)
   at android.view.ViewRootImpl.doProcessInputEvents(ViewRootImpl.java:4402)
   at android.view.ViewRootImpl.enqueueInputEvent(ViewRootImpl.java:4380)
   at android.view.ViewRootImpl$WindowInputEventReceiver.onInputEvent(ViewRootImpl.java:4484)
   at android.view.InputEventReceiver.dispatchInputEvent(InputEventReceiver.java:171)
   at android.view.InputEventReceiver.nativeConsumeBatchedInputEvents(Native Method)
   at android.view.InputEventReceiver.consumeBatchedInputEvents(InputEventReceiver.java:163)
   at android.view.ViewRootImpl.doConsumeBatchedInput(ViewRootImpl.java:4452)
   at android.view.ViewRootImpl$ConsumeBatchedInputRunnable.run(ViewRootImpl.java:4503)
   at android.view.Choreographer$CallbackRecord.run(Choreographer.java:725)
   at android.view.Choreographer.doCallbacks(Choreographer.java:555)
   at android.view.Choreographer.doFrame(Choreographer.java:523)
   at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:711)
   at android.os.Handler.handleCallback(Handler.java:615)
   at android.os.Handler.dispatchMessage(Handler.java:92)
   at android.os.Looper.loop(Looper.java:137)
   at android.app.ActivityThread.main(ActivityThread.java:4898)
   at java.lang.reflect.Method.invokeNative(Native Method)
   at java.lang.reflect.Method.invoke(Method.java:511)
   at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1006)
   at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:773)
   at dalvik.system.NativeStart.main(Native Method)
FATAL EXCEPTION: main
java.lang.OutOfMemoryError
   at android.graphics.Bitmap.nativeCreate(Native Method)
   at android.graphics.Bitmap.createBitmap(Bitmap.java:640)
   at android.graphics.Bitmap.createBitmap(Bitmap.java:620)
   at it.giuseppe.salvi.utility.ICOSCoverflowDownloader.reflectionBitmap(ICOSCoverflowDownloader.java:338)
   at it.giuseppe.salvi.utility.ICOSCoverflowDownloader.download(ICOSCoverflowDownloader.java:84)
   at it.giuseppe.salvi.adapter.ICOSCoverflowAdapter.getView(ICOSCoverflowAdapter.java:78)
   at android.widget.Gallery.makeAndAddView(Gallery.java:849)
   at android.widget.Gallery.fillToGalleryRightLtr(Gallery.java:803)
   at android.widget.Gallery.fillToGalleryRight(Gallery.java:747)
   at android.widget.Gallery.trackMotionScroll(Gallery.java:387)
   at android.widget.Gallery.onScroll(Gallery.java:1027)
   at android.view.GestureDetector.onTouchEvent(GestureDetector.java:1327)
   at android.widget.Gallery.onTouchEvent(Gallery.java:942)
   at android.view.View.dispatchTouchEvent(View.java:7337)


   at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2410)
   at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2145)
   at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2416)
   at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2159)
   at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2416)
   at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2159)
   at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2416)
   at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2159)
   at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2416)
   at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2159)
   at com.android.internal.policy.impl.PhoneWindow$DecorView.superDispatchTouchEvent(PhoneWindow.java:2115)
   at com.android.internal.policy.impl.PhoneWindow.superDispatchTouchEvent(PhoneWindow.java:1468)
   at android.app.Activity.dispatchTouchEvent(Activity.java:2487)
   at com.android.internal.policy.impl.PhoneWindow$DecorView.dispatchTouchEvent(PhoneWindow.java:2063)
   at android.view.View.dispatchPointerEvent(View.java:7520)
   at android.view.ViewRootImpl.deliverPointerEvent(ViewRootImpl.java:3376)
   at android.view.ViewRootImpl.deliverInputEvent(ViewRootImpl.java:3308)
   at android.view.ViewRootImpl.doProcessInputEvents(ViewRootImpl.java:4402)
   at android.view.ViewRootImpl.enqueueInputEvent(ViewRootImpl.java:4380)
   at android.view.ViewRootImpl$WindowInputEventReceiver.onInputEvent(ViewRootImpl.java:4484)
   at android.view.InputEventReceiver.dispatchInputEvent(InputEventReceiver.java:171)
   at android.view.InputEventReceiver.nativeConsumeBatchedInputEvents(Native Method)
   at android.view.InputEventReceiver.consumeBatchedInputEvents(InputEventReceiver.java:163)
   at android.view.ViewRootImpl.doConsumeBatchedInput(ViewRootImpl.java:4452)
   at android.view.ViewRootImpl$ConsumeBatchedInputRunnable.run(ViewRootImpl.java:4503)
   at android.view.Choreographer$CallbackRecord.run(Choreographer.java:725)
   at android.view.Choreographer.doCallbacks(Choreographer.java:555)
   at android.view.Choreographer.doFrame(Choreographer.java:523)
   at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:711)
   at android.os.Handler.handleCallback(Handler.java:615)
   at android.os.Handler.dispatchMessage(Handler.java:92)
   at android.os.Looper.loop(Looper.java:137)
   at android.app.ActivityThread.main(ActivityThread.java:4898)
   at java.lang.reflect.Method.invokeNative(Native Method)
   at java.lang.reflect.Method.invoke(Method.java:511)
   at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1006)
   at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:773)
   at dalvik.system.NativeStart.main(Native Method)
PhoneWindowManager: focusChangedLw
 

lonleystar

Well-Known Member
Licensed User
Longtime User
Hi. This is the log i could take :)

B4X:
Touch event's action is 0x1 (deviceType=0) [pCnt=1, s=]
Delivering touch to current input target: action: 0x1
Delivering touch to current input target: action: 0x1
Delivering touch to current input target: action: 0x1
GC_FOR_ALLOC freed <1K, 12% free 57408K/64519K, paused 17ms, total 17ms
Forcing collection of SoftReferences for 2160016-byte allocation
GC_BEFORE_OOM freed <1K, 12% free 57408K/64519K, paused 23ms, total 23ms


Out of memory on a 2160016-byte allocation.
"main" prio=5 tid=1 RUNNABLE
  | group="main" sCount=0 dsCount=0 obj=0x40e85508 self=0x40e73a78
  | sysTid=25492 nice=0 sched=0/0 cgrp=apps handle=1074839344
  | schedstat=( 44903018108 19156852442 128953 ) utm=3763 stm=726 core=0
  at android.graphics.Bitmap.nativeCreate(Native Method)
  at android.graphics.Bitmap.createBitmap(Bitmap.java:640)
  at android.graphics.Bitmap.createBitmap(Bitmap.java:620)
  at it.giuseppe.salvi.utility.ICOSCoverflowDownloader.reflectionBitmap(ICOSCoverflowDownloader.java:338)
  at it.giuseppe.salvi.utility.ICOSCoverflowDownloader.download(ICOSCoverflowDownloader.java:84)
  at it.giuseppe.salvi.adapter.ICOSCoverflowAdapter.getView(ICOSCoverflowAdapter.java:78)
  at android.widget.Gallery.makeAndAddView(Gallery.java:849)
  at android.widget.Gallery.fillToGalleryRightLtr(Gallery.java:803)
  at android.widget.Gallery.fillToGalleryRight(Gallery.java:747)
  at android.widget.Gallery.trackMotionScroll(Gallery.java:387)
  at android.widget.Gallery.onScroll(Gallery.java:1027)
  at android.view.GestureDetector.onTouchEvent(GestureDetector.java:1327)
  at android.widget.Gallery.onTouchEvent(Gallery.java:942)
  at android.view.View.dispatchTouchEvent(View.java:7337)
  at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2410)
  at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2145)
  at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2416)
  at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2159)
  at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2416)
  at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2159)
  at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2416)
  at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2159)
  at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2416)
  at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2159)
  at com.android.internal.policy.impl.PhoneWindow$DecorView.superDispatchTouchEvent(PhoneWindow.java:2115)
  at com.android.internal.policy.impl.PhoneWindow.superDispatchTouchEvent(PhoneWindow.java:1468)
  at android.app.Activity.dispatchTouchEvent(Activity.java:2487)
  at com.android.internal.policy.impl.PhoneWindow$DecorView.dispatchTouchEvent(PhoneWindow.java:2063)
  at android.view.View.dispatchPointerEvent(View.java:7520)
  at android.view.ViewRootImpl.deliverPointerEvent(ViewRootImpl.java:3376)
  at android.view.ViewRootImpl.deliverInputEvent(ViewRootImpl.java:3308)
  at android.view.ViewRootImpl.doProcessInputEvents(ViewRootImpl.java:4402)
  at android.view.ViewRootImpl.enqueueInputEvent(ViewRootImpl.java:4380)
  at android.view.ViewRootImpl$WindowInputEventReceiver.onInputEvent(ViewRootImpl.java:4484)
  at android.view.InputEventReceiver.dispatchInputEvent(InputEventReceiver.java:171)
  at android.view.InputEventReceiver.nativeConsumeBatchedInputEvents(Native Method)
  at android.view.InputEventReceiver.consumeBatchedInputEvents(InputEventReceiver.java:163)
  at android.view.ViewRootImpl.doConsumeBatchedInput(ViewRootImpl.java:4452)
  at android.view.ViewRootImpl$ConsumeBatchedInputRunnable.run(ViewRootImpl.java:4503)
  at android.view.Choreographer$CallbackRecord.run(Choreographer.java:725)
  at android.view.Choreographer.doCallbacks(Choreographer.java:555)
  at android.view.Choreographer.doFrame(Choreographer.java:523)
  at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:711)
  at android.os.Handler.handleCallback(Handler.java:615)
  at android.os.Handler.dispatchMessage(Handler.java:92)
  at android.os.Looper.loop(Looper.java:137)
  at android.app.ActivityThread.main(ActivityThread.java:4898)
  at java.lang.reflect.Method.invokeNative(Native Method)
  at java.lang.reflect.Method.invoke(Method.java:511)
  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1006)
  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:773)
  at dalvik.system.NativeStart.main(Native Method)

Exception dispatching input event.


Shutting down VM
threadid=1: thread exiting with uncaught exception (group=0x40e842a0)
java.lang.OutOfMemoryError
   at android.graphics.Bitmap.nativeCreate(Native Method)
   at android.graphics.Bitmap.createBitmap(Bitmap.java:640)
   at android.graphics.Bitmap.createBitmap(Bitmap.java:620)
   at it.giuseppe.salvi.utility.ICOSCoverflowDownloader.reflectionBitmap(ICOSCoverflowDownloader.java:338)
   at it.giuseppe.salvi.utility.ICOSCoverflowDownloader.download(ICOSCoverflowDownloader.java:84)
   at it.giuseppe.salvi.adapter.ICOSCoverflowAdapter.getView(ICOSCoverflowAdapter.java:78)
   at android.widget.Gallery.makeAndAddView(Gallery.java:849)
   at android.widget.Gallery.fillToGalleryRightLtr(Gallery.java:803)
   at android.widget.Gallery.fillToGalleryRight(Gallery.java:747)
   at android.widget.Gallery.trackMotionScroll(Gallery.java:387)
   at android.widget.Gallery.onScroll(Gallery.java:1027)
   at android.view.GestureDetector.onTouchEvent(GestureDetector.java:1327)
   at android.widget.Gallery.onTouchEvent(Gallery.java:942)
   at android.view.View.dispatchTouchEvent(View.java:7337)
   at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2410)
   at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2145)
   at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2416)
   at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2159)
   at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2416)
   at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2159)
   at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2416)
   at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2159)
   at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2416)
   at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2159)
   at com.android.internal.policy.impl.PhoneWindow$DecorView.superDispatchTouchEvent(PhoneWindow.java:2115)
   at com.android.internal.policy.impl.PhoneWindow.superDispatchTouchEvent(PhoneWindow.java:1468)
   at android.app.Activity.dispatchTouchEvent(Activity.java:2487)
   at com.android.internal.policy.impl.PhoneWindow$DecorView.dispatchTouchEvent(PhoneWindow.java:2063)
   at android.view.View.dispatchPointerEvent(View.java:7520)
   at android.view.ViewRootImpl.deliverPointerEvent(ViewRootImpl.java:3376)
   at android.view.ViewRootImpl.deliverInputEvent(ViewRootImpl.java:3308)
   at android.view.ViewRootImpl.doProcessInputEvents(ViewRootImpl.java:4402)
   at android.view.ViewRootImpl.enqueueInputEvent(ViewRootImpl.java:4380)
   at android.view.ViewRootImpl$WindowInputEventReceiver.onInputEvent(ViewRootImpl.java:4484)
   at android.view.InputEventReceiver.dispatchInputEvent(InputEventReceiver.java:171)
   at android.view.InputEventReceiver.nativeConsumeBatchedInputEvents(Native Method)
   at android.view.InputEventReceiver.consumeBatchedInputEvents(InputEventReceiver.java:163)
   at android.view.ViewRootImpl.doConsumeBatchedInput(ViewRootImpl.java:4452)
   at android.view.ViewRootImpl$ConsumeBatchedInputRunnable.run(ViewRootImpl.java:4503)
   at android.view.Choreographer$CallbackRecord.run(Choreographer.java:725)
   at android.view.Choreographer.doCallbacks(Choreographer.java:555)
   at android.view.Choreographer.doFrame(Choreographer.java:523)
   at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:711)
   at android.os.Handler.handleCallback(Handler.java:615)
   at android.os.Handler.dispatchMessage(Handler.java:92)
   at android.os.Looper.loop(Looper.java:137)
   at android.app.ActivityThread.main(ActivityThread.java:4898)
   at java.lang.reflect.Method.invokeNative(Native Method)
   at java.lang.reflect.Method.invoke(Method.java:511)
   at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1006)
   at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:773)
   at dalvik.system.NativeStart.main(Native Method)
FATAL EXCEPTION: main
java.lang.OutOfMemoryError
   at android.graphics.Bitmap.nativeCreate(Native Method)
   at android.graphics.Bitmap.createBitmap(Bitmap.java:640)
   at android.graphics.Bitmap.createBitmap(Bitmap.java:620)
   at it.giuseppe.salvi.utility.ICOSCoverflowDownloader.reflectionBitmap(ICOSCoverflowDownloader.java:338)
   at it.giuseppe.salvi.utility.ICOSCoverflowDownloader.download(ICOSCoverflowDownloader.java:84)
   at it.giuseppe.salvi.adapter.ICOSCoverflowAdapter.getView(ICOSCoverflowAdapter.java:78)
   at android.widget.Gallery.makeAndAddView(Gallery.java:849)
   at android.widget.Gallery.fillToGalleryRightLtr(Gallery.java:803)
   at android.widget.Gallery.fillToGalleryRight(Gallery.java:747)
   at android.widget.Gallery.trackMotionScroll(Gallery.java:387)
   at android.widget.Gallery.onScroll(Gallery.java:1027)
   at android.view.GestureDetector.onTouchEvent(GestureDetector.java:1327)
   at android.widget.Gallery.onTouchEvent(Gallery.java:942)
   at android.view.View.dispatchTouchEvent(View.java:7337)


   at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2410)
   at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2145)
   at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2416)
   at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2159)
   at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2416)
   at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2159)
   at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2416)
   at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2159)
   at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2416)
   at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2159)
   at com.android.internal.policy.impl.PhoneWindow$DecorView.superDispatchTouchEvent(PhoneWindow.java:2115)
   at com.android.internal.policy.impl.PhoneWindow.superDispatchTouchEvent(PhoneWindow.java:1468)
   at android.app.Activity.dispatchTouchEvent(Activity.java:2487)
   at com.android.internal.policy.impl.PhoneWindow$DecorView.dispatchTouchEvent(PhoneWindow.java:2063)
   at android.view.View.dispatchPointerEvent(View.java:7520)
   at android.view.ViewRootImpl.deliverPointerEvent(ViewRootImpl.java:3376)
   at android.view.ViewRootImpl.deliverInputEvent(ViewRootImpl.java:3308)
   at android.view.ViewRootImpl.doProcessInputEvents(ViewRootImpl.java:4402)
   at android.view.ViewRootImpl.enqueueInputEvent(ViewRootImpl.java:4380)
   at android.view.ViewRootImpl$WindowInputEventReceiver.onInputEvent(ViewRootImpl.java:4484)
   at android.view.InputEventReceiver.dispatchInputEvent(InputEventReceiver.java:171)
   at android.view.InputEventReceiver.nativeConsumeBatchedInputEvents(Native Method)
   at android.view.InputEventReceiver.consumeBatchedInputEvents(InputEventReceiver.java:163)
   at android.view.ViewRootImpl.doConsumeBatchedInput(ViewRootImpl.java:4452)
   at android.view.ViewRootImpl$ConsumeBatchedInputRunnable.run(ViewRootImpl.java:4503)
   at android.view.Choreographer$CallbackRecord.run(Choreographer.java:725)
   at android.view.Choreographer.doCallbacks(Choreographer.java:555)
   at android.view.Choreographer.doFrame(Choreographer.java:523)
   at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:711)
   at android.os.Handler.handleCallback(Handler.java:615)
   at android.os.Handler.dispatchMessage(Handler.java:92)
   at android.os.Looper.loop(Looper.java:137)
   at android.app.ActivityThread.main(ActivityThread.java:4898)
   at java.lang.reflect.Method.invokeNative(Native Method)
   at java.lang.reflect.Method.invoke(Method.java:511)
   at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1006)
   at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:773)
   at dalvik.system.NativeStart.main(Native Method)
PhoneWindowManager: focusChangedLw
Hi Clarion,

I just try now it agan with over 2000 images get no error

please send the code so i try it on my Samsung Tab 7 , Samsung Tab 7 2 - Samsung Tab Note 2 10.1 and - Samsung s3
 
Last edited:

lonleystar

Well-Known Member
Licensed User
Longtime User
testing code for coverflow

Hi Clarion,

this is the code i use to test it.

B4X:
Sub Globals
    Dim Coverflow As B4ACoverFlow
End Sub

Sub Activity_Create(FirstTime As Boolean)
   Coverflow.Initialize("Coverflow")
   Activity.AddView(Coverflow, 0dip, 0dip, 100%x, 100%y)
   Coverflow.Spacing=-15
   Coverflow.ItemWidth = 300dip
   Coverflow.ItemHeight = 400dip   
   Coverflow.AnimationDuration=1000
   Coverflow.PopulateCoverflow(File.DirRootExternal, "Images1")   
   Activity.Title = "G.Salvi -- Items in Coverflow = " & Coverflow.Length 
   Coverflow.Selection=1
End Sub

Sub Activity_Resume
End Sub
Sub Activity_Pause(UserClosed As Boolean)
End Sub

Sub Coverflow_ItemClick(Position As Int, Value As Object)
    Coverflow.SetBackgroundImage(LoadBitmapSample("",Value,600,1024))
End Sub

Sub Coverflow_ItemLongClick (Position As Int, Value As Object)
   ExitApplication
End Sub

Sub Coverflow_ItemSelected(Position As Int, Value As Object)
   Activity.Title = "G.Salvi -- Items in Coverflow = " & Coverflow.Length & " | Position = " & Position & _
   " |  Width = " & Coverflow.ItemWidth&" | Height = "&Coverflow.ItemHeight
End Sub
 

clarionero

Active Member
Licensed User
Longtime User
Hi. My code is a copy&paste from your sample:

B4X:
Sub Process_Globals

End Sub

Sub Globals
    Dim Coverflow As B4ACoverFlow
End Sub

Sub Activity_Create(FirstTime As Boolean)

   Activity.Color = Colors.White

   Coverflow.Initialize("Coverflow")
   Activity.AddView(Coverflow, 0dip, 0dip, 100%x, 100%y)
   Coverflow.Spacing=-15
   Coverflow.ItemWidth = 300dip
   Coverflow.ItemHeight = 300dip   
   Coverflow.AnimationDuration=1000
   'Msgbox(File.DirRootExternal,"")
   Coverflow.PopulateCoverflow(File.DirRootExternal, "EcoEmocion/Olivia/videos/previos")   
   'Activity.Title = "G.Salvi -- Items in Coverflow = " & Coverflow.Length 
   Coverflow.Selection=2
End Sub
Sub Activity_Resume
End Sub
Sub Activity_Pause(UserClosed As Boolean)
End Sub

Sub Coverflow_ItemClick(Position As Int, Value As Object)
    'Coverflow.SetBackgroundImage(LoadBitmapSample("",Value,150,240))
   Dim FicheroImagen As String
   FicheroImagen = Value
   
   ' se reconvierte el nombre del fichero
   FicheroImagen = FicheroImagen.Replace("/previos/","/")
   FicheroImagen = FicheroImagen.Replace(".jpg",".mp4")
   'Msgbox(FicheroImagen,"")
   CallSubDelayed2(ZoomMostrarVideo,"Mostrar",FicheroImagen)
End Sub

Sub Coverflow_ItemLongClick (Position As Int, Value As Object)
   ExitApplication
End Sub

Sub Coverflow_ItemSelected(Position As Int, Value As Object)
   'Activity.Title = "G.Salvi -- Items in Coverflow = " & Coverflow.Length & " | Position = " & Position & _
   '" |  Width = " & Coverflow.ItemWidth&" | Height = "&Coverflow.ItemHeight
   
   
   
End Sub

Thank you for your help.
 

lonleystar

Well-Known Member
Licensed User
Longtime User
Hi. My code is a copy&paste from your sample:

B4X:
Sub Process_Globals

End Sub

Sub Globals
    Dim Coverflow As B4ACoverFlow
End Sub

Sub Activity_Create(FirstTime As Boolean)

   Activity.Color = Colors.White

   Coverflow.Initialize("Coverflow")
   Activity.AddView(Coverflow, 0dip, 0dip, 100%x, 100%y)
   Coverflow.Spacing=-15
   Coverflow.ItemWidth = 300dip
   Coverflow.ItemHeight = 300dip   
   Coverflow.AnimationDuration=1000
   'Msgbox(File.DirRootExternal,"")
   Coverflow.PopulateCoverflow(File.DirRootExternal, "EcoEmocion/Olivia/videos/previos")   
   'Activity.Title = "G.Salvi -- Items in Coverflow = " & Coverflow.Length 
   Coverflow.Selection=2
End Sub
Sub Activity_Resume
End Sub
Sub Activity_Pause(UserClosed As Boolean)
End Sub

Sub Coverflow_ItemClick(Position As Int, Value As Object)
    'Coverflow.SetBackgroundImage(LoadBitmapSample("",Value,150,240))
   Dim FicheroImagen As String
   FicheroImagen = Value
   
   ' se reconvierte el nombre del fichero
   FicheroImagen = FicheroImagen.Replace("/previos/","/")
   FicheroImagen = FicheroImagen.Replace(".jpg",".mp4")
   'Msgbox(FicheroImagen,"")
   CallSubDelayed2(ZoomMostrarVideo,"Mostrar",FicheroImagen)
End Sub

Sub Coverflow_ItemLongClick (Position As Int, Value As Object)
   ExitApplication
End Sub

Sub Coverflow_ItemSelected(Position As Int, Value As Object)
   'Activity.Title = "G.Salvi -- Items in Coverflow = " & Coverflow.Length & " | Position = " & Position & _
   '" |  Width = " & Coverflow.ItemWidth&" | Height = "&Coverflow.ItemHeight
   
   
   
End Sub

Thank you for your help.
Hi Clarionero,

U still get error?
 

clarionero

Active Member
Licensed User
Longtime User
Hi. Yes. My code is copy&paste of your sample.

I have reduced the images size form 100 kb to 30 kb. No diference.

I will try to reduce now the images resolution.

My device is a S3 with JellyBean 4.1.2.

I have selected GingerBread like device target.

All works nice, but after a few time playing the app crash.
 
Top