I made changes as you said in callback function and I am also using kivy 2
>>> I also made changes in Imagepicscreen(Screen): and Piccollect(Image) , to make loading of images address fast .
now loasding of images address is really fast and 700 images address is loaded within no time , but i have issues with recycle view scrolling
issues:
1 ) I am getting this " W WallpaperManagerService: Wallpaper service gone: " in logs and the app is crashing and wallpaper is removed (in my android device ) and replaced by some random pink and black screen .
this is happening when i scroll fast in recycleview ,
2 ) it is still doing lazy loading and scrolling is not smooth , and above problem when scrolled fast .
def callback_1(self):
self.help_str.get_screen('imagepick').manager.current = 'imagepick'
print("vertical dots clicked")
print(Window.size , "====================================================================================")
class Imagepicscreen(Screen):
data_items = ListProperty([])
def on_enter(self , *args):
print("Entered into the screen ")
if platform == 'android' :
print("thread not started")
Thread(target=self.build_data).start()
print("thread started >>>>>>>>>> ")
def build_data(self):
x = 0
print("Entered into build data function by thread ")
for file in glob.glob("/storage/emulated/0/DCIM/Camera/*.*"):
print("Entered into the looping of images address " , str(x) , str(file))
x += 1
tmp_data = []
tmp_data.append({'source': str(file)})
self.data_items.extend(tmp_data)#adding to main thread here instead of load_data function
print("new image added")
# add this block of data to the data_items on the main thread
#Clock.schedule_once(partial(self.load_data, tmp_data)) #should i use this clock schedule ? , required ?
def load_data(self, tmp_data, dt):
self.data_items.extend(tmp_data)
<Imagepicscreen>:
name: 'imagepick'
MDBoxLayout:
orientation: "vertical"
md_bg_color: app.theme_cls.bg_light
MDToolbar:
id: toolbar
title: "Images and videos "
left_action_items: [["arrow-left" , lambda x:
app.ca()]]
#right_action_items: [["magnify"], ["dots-vertical"]]
md_bg_color: app.theme_cls.bg_light
specific_text_color: 0, 0, 0, 1
MDTabs:
#id:tabs
#on_tab_switch: app.on_tab_switch(*args)
#lock_swiping:True
Tab:
#id: tabone
text : "Images"
ImageGallery:
id: rv
viewclass: 'Piccollect'
data:root.data_items
RecycleGridLayout:
orientation: 'lr-tb'
cols: 4
spacing: '0dp'
padding: ['0dp']
default_size: None, dp(rv.width/self.cols*.8)
default_size_hint: 1, None
size_hint_y: None
height: self.minimum_height
Tab:
#id: tabone
text : "Videos"
VideosGallery:
id: rrv
viewclass: 'Vidcollect'
RecycleGridLayout:
orientation: 'lr-tb'
cols: 4
spacing: '20dp'
padding: [20]
default_size: None, dp(rrv.width/self.cols*.8)
default_size_hint: 1, None
size_hint_y: None
height: self.minimum_height
class Piccollect(Image):
source = StringProperty('')
print("created=====================================================")
05-12 15:49:38.226 2318 2334 W InputEventReceiver: Slow Input: 1184ms so far, now at dispatchInputEvent (MotionEvent: event_seq=2993097, seq=5245970, action=ACTION_DOWN)
05-12 15:49:38.227 2514 2514 W InputEventReceiver: Slow Input: 1185ms so far, now at dispatchInputEvent (MotionEvent: event_seq=551517, seq=5245968, action=ACTION_OUTSIDE)
05-12 15:49:38.282 2318 2334 W InputEventReceiver: Slow Input: 977ms so far, now at dispatchInputEvent (MotionEvent: event_seq=2993099, seq=5246022, action=ACTION_MOVE)
05-12 15:49:38.283 2318 2334 W InputEventReceiver: Slow Input: 969ms so far, now at dispatchInputEvent (MotionEvent: event_seq=2993100, seq=5246024, action=ACTION_UP)
05-12 15:49:38.283 2318 2334 W InputEventReceiver: Slow Input: 384ms so far, now at dispatchInputEvent (MotionEvent: event_seq=2993102, seq=5246027, action=ACTION_DOWN)
05-12 15:49:38.285 2318 2469 W MiuiGesturePointerEventListener: onActionDown end: mGestureStatus = 0
05-12 15:49:38.285 2318 2469 W MiuiGesturePointerEventListener: onActionDown end: mGestureStatus = 0
05-12 15:49:38.294 2318 2318 W Looper : Slow delivery took 759ms main h=android.view.GestureDetector$GestureHandler c=null m=2
05-12 15:49:38.328 26342 26342 W InputEventReceiver: Slow Input: took 857ms in dispatching, now at finishInputEvent (MotionEvent: event_seq=48, seq=5245966, action=ACTION_UP)
05-12 15:49:38.336 2514 2514 W InputEventReceiver: Slow Input: took 133ms in dispatching, now at finishInputEvent (MotionEvent: event_seq=551517, seq=5245968, action=ACTION_OUTSIDE)
05-12 15:49:38.336 2514 2514 W InputEventReceiver: Slow Input: 437ms so far, now at dispatchInputEvent (MotionEvent: event_seq=551518, seq=5246025, action=ACTION_OUTSIDE)
05-12 15:49:38.554 2318 4041 I ActivityManager: Process com.xiaomi.location.fused (pid 7616) has died: prcp TRNB
05-12 15:49:38.554 2318 2334 W Looper : Slow dispatch took 247ms android.ui h=android.view.Choreographer$FrameHandler c=null m=0
05-12 15:49:38.555 2318 2336 W libprocessgroup: kill(-7616, 9) failed: No such process
05-12 15:49:38.565 1067 1067 I Zygote : Process 7616 exited due to signal (9)
05-12 15:49:38.567 2318 2318 W Looper : Drained
05-12 15:49:38.568 2318 2336 W libprocessgroup: kill(-7616, 9) failed: No such process
05-12 15:49:38.568 2318 2336 I libprocessgroup: Successfully killed process cgroup uid 1000 pid 7616 in 14ms
05-12 15:49:38.607 26342 26342 W InputEventReceiver: Slow Input: 1577ms so far, now at dispatchInputEvent (MotionEvent: event_seq=49, seq=5245969, action=ACTION_DOWN)
05-12 15:49:38.679 26999 27009 W facebook.katan: Suspending all threads took: 990.842ms
05-12 15:49:38.681 26999 27085 W AppInitScheduler|Run: Waiting on LoadDexes for 3864ms...
05-12 15:49:38.730 26999 27099 W facebook.katan: Suspending all threads took: 49.302ms
05-12 15:49:38.736 2318 4041 W ActivityManager: Scheduling restart of crashed service com.xiaomi.location.fused/.FusedLocationService in 72637ms
05-12 15:49:38.909 26342 26342 W InputEventReceiver: Slow Input: took 314ms in dispatching, now at finishInputEvent (MotionEvent: event_seq=49, seq=5245969, action=ACTION_DOWN)
05-12 15:49:38.909 2318 2398 W InputTransport: Slow Input: 777ms so far, channel 'afc95a0 org.test.myapp/org.kivy.android.PythonActivity (server)' publisher ~ publishMotionEvent: seq=5246074, deviceId=5, source=0x1002, action=0x2, actionButton=0x00000000, flags=0x0, edgeFlags=0x0, metaState=0x0, buttonState=0x0, xOffset=0.000000, yOffset=0.000000, xPrecision=1.000000, yPrecision=1.000000, downTime=723674559419000, eventTime=723674791816000, pointerCount=1
05-12 15:49:38.912 26342 26342 W InputEventReceiver: Slow Input: 1607ms so far, now at dispatchInputEvent (MotionEvent: event_seq=50, seq=5246021, action=ACTION_MOVE)
05-12 15:49:38.945 26999 27141 D MuseumVerifier: Attempting verification for SuspendResume with flag file: /data/user/0/com.facebook.katana/app_pgoutils/suspendResumeVerifyV3_900_VV4_PGO
05-12 15:49:38.993 2514 2744 D NetworkController.MobileSignalController(2): getDataNetTypeFromServiceState slotId=0 isUsingCarrierAggregation=false
05-12 15:49:39.005 26342 26342 W InputEventReceiver: Slow Input: 1690ms so far, now at dispatchInputEvent (MotionEvent: event_seq=51, seq=5246023, action=ACTION_UP)
05-12 15:49:39.009 2514 2744 D NetworkTypeUtils: getDataNetTypeFromServiceState:srcDataNetType = 13, destDataNetType 13
05-12 15:49:39.114 2318 3930 D CompatibilityInfo: mCompatibilityFlags - 0
05-12 15:49:39.129 2318 3930 D CompatibilityInfo: applicationDensity - 440
05-12 15:49:39.133 2514 2744 D MobileSignalController: updateDataType mSelectedDataTypeIcon[0]=2131232235, mSelectedDataActivityIndex=6
05-12 15:49:39.133 2514 2744 D TelephonyIcons: getSignalStrengthIcon: slot=0, inetCondition=1, level=5, roaming=false, signalstrength=SignalStrength: 99 0 -120 -160 -120 -160 -1 29 -85 -14 76 2147483647 0 2147483647 99 255 2147483647 gsm|lte use_rsrp_and_rssnr_for_lte_level [-128, -115, -110, -105, -97] [-115, -105, -95, -85]
05-12 15:49:39.133 2514 2744 D TelephonyIcons: getDataActivity, slot=0, activity=3
05-12 15:49:39.139 2514 2744 D TelephonyIcons: null signal icon name: drawable/stat_sys_signal_null
05-12 15:49:39.139 2514 2744 D TelephonyIcons: getDataTypeIcon sub=0
05-12 15:49:39.201 2318 3930 D CompatibilityInfo: applicationScale - 1.0
05-12 15:49:39.238 2852 4948 I DPMJ : |REQ:RCVR| DPM creating socket
05-12 15:49:39.307 26342 26342 W InputEventReceiver: Slow Input: took 303ms in dispatching, now at finishInputEvent (MotionEvent: event_seq=51, seq=5246023, action=ACTION_UP)
05-12 15:49:39.319 26342 26342 W InputEventReceiver: Slow Input: 1419ms so far, now at dispatchInputEvent (MotionEvent: event_seq=52, seq=5246026, action=ACTION_DOWN)
05-12 15:49:39.365 2318 2336 W libprocessgroup: kill(-27154, 9) failed: No such process
05-12 15:49:39.368 1067 1067 I Zygote : Process 27154 exited due to signal (9)
05-12 15:49:39.371 2318 2336 W libprocessgroup: kill(-27154, 9) failed: No such process
05-12 15:49:39.371 2318 2336 I libprocessgroup: Successfully killed process cgroup uid 10029 pid 27154 in 6ms
05-12 15:49:39.481 26999 27140 V AospBugFixOpts: set AOSP bug fix jboolean EnableAospBugFixes: bugFixOpt -> enable = 0. Given 0
05-12 15:49:39.492 26999 27141 D MuseumVerifier: Parsed error [prior result: failure] for SuspendResume : Failed runtime->preinitialization_transactions_.empty()
05-12 15:49:39.492 26999 27141 D MuseumVerifier: Previously failed verification of SuspendResume, not trying again. Previous error: Failed runtime->preinitialization_transactions_.empty()
05-12 15:49:39.518 26999 27141 W SUSPEND_RESUME: Failed to verify SuspendResume with error: Previously failed verification of SuspendResume, not trying again. Previous error: Failed runtime->preinitialization_transactions_.empty()
05-12 15:49:39.560 2318 3930 I ActivityManager: Process com.android.camera (pid 27154) has died: cch CEM
05-12 15:49:39.592 27178 27178 F linker : CANNOT LINK EXECUTABLE "/system/bin/dpmd": "/system/lib64/libdpmframework.so" is 32-bit instead of 64-bit
05-12 15:49:39.605 2318 3930 D ProcessRecordInjector: Begin to report kill process events...
05-12 15:49:39.655 26999 27141 D SUSPEND_RESUME: isSuspendResumeSupported: 0
05-12 15:49:39.666 26999 27141 D PgoUtils: Art Pgo supported on platform: 0 suspend and resume supported: 0
05-12 15:49:39.666 26999 27141 D PgoUtils: PGO Utils was not successfully inited [pgoutils: 0]
05-12 15:49:39.683 26999 27085 W AppInitScheduler|Run: Waiting on LoadDexes for 4866ms...
05-12 15:49:39.969 2514 2744 D NetworkController.MobileSignalController(2): getDataNetTypeFromServiceState slotId=0 isUsingCarrierAggregation=false
05-12 15:49:39.969 2514 2744 D NetworkTypeUtils: getDataNetTypeFromServiceState:srcDataNetType = 13, destDataNetType 13
05-12 15:49:40.067 2318 2334 W Looper : Slow dispatch took 461ms android.ui h=com.android.server.am.ActivityManagerService$UiHandler c=null m=53
05-12 15:49:40.068 2318 2334 W Looper : Slow delivery took 239ms android.ui h=com.android.server.policy.BaseMiuiPhoneWindowManager$H c=com.android.server.policy.BaseMiuiPhoneWindowManager$12@88354ee m=0
05-12 15:49:40.101 2514 2744 D MobileSignalController: updateDataType mSelectedDataTypeIcon[0]=2131232235, mSelectedDataActivityIndex=6
05-12 15:49:40.112 2514 2744 D TelephonyIcons: getSignalStrengthIcon: slot=0, inetCondition=1, level=5, roaming=false, signalstrength=SignalStrength: 99 0 -120 -160 -120 -160 -1 29 -85 -14 76 2147483647 0 2147483647 99 255 2147483647 gsm|lte use_rsrp_and_rssnr_for_lte_level [-128, -115, -110, -105, -97] [-115, -105, -95, -85]
05-12 15:49:40.112 2514 2744 D TelephonyIcons: getDataActivity, slot=0, activity=0
05-12 15:49:40.121 2514 2744 D TelephonyIcons: null signal icon name: drawable/stat_sys_signal_null
05-12 15:49:40.122 2514 2744 D TelephonyIcons: getDataTypeIcon sub=0
05-12 15:49:40.213 2514 2670 I OpenGLRenderer: Davey! duration=969ms; Flags=0, IntendedVsync=723675902615226, Vsync=723676152615216, OldestInputEvent=9223372036854775807, NewestInputEvent=0, HandleInputStart=723676160890608, AnimationStart=723676224117066, PerformTraversalsStart=723676224125348, DrawStart=723676604797274, SyncQueued=723676689445608, SyncStart=723676689753681, IssueDrawCommandsStart=723676735644827, SwapBuffers=723676841362899, FrameCompleted=723676872662222, DequeueBufferDuration=10548000, QueueBufferDuration=7937000,
05-12 15:49:40.277 2318 3930 D PerfShielderService: com.android.systemui|StatusBar|502|723668052588476|477|3|2
05-12 15:49:40.329 2318 3930 D PerfShielderService: com.android.systemui|StatusBar|184|723668585064569|177|3|2
05-12 15:49:40.373 3489 20663 W MiuiPerfServiceClient: interceptAndQueuing:2514|com.android.systemui|502|477|unknown|null|StatusBar|723668052588476|Slow handle traversal|2
05-12 15:49:40.375 3489 3520 W MiuiPerfServiceClient: interceptAndQueuing:2514|com.android.systemui|184|177|unknown|null|StatusBar|723668585064569|Slow handle traversal|2
05-12 15:49:40.425 2318 2327 I system_server: Background concurrent copying GC freed 336035(19MB) AllocSpace objects, 78(3MB) LOS objects, 35% free, 43MB/67MB, paused 88.563ms total 2.834s
05-12 15:49:40.505 26877 26877 W com.truecaller: Verification of void com.google.android.chimera.ModuleContext.<clinit>() took 122.670ms
05-12 15:49:40.693 2318 2398 I InputDispatcher: Window 'Window{afc95a0 u0 org.test.myapp/org.kivy.android.PythonActivity}' spent 2471.6ms processing the last input event: MotionEvent
05-12 15:49:40.712 26999 27085 W AppInitScheduler|Run: Waiting on LoadDexes for 5895ms...
05-12 15:49:40.790 26342 26342 W InputEventReceiver: Slow Input: took 1356ms in dispatching, now at finishInputEvent (MotionEvent: event_seq=52, seq=5246026, action=ACTION_DOWN)
05-12 15:49:40.903 26877 26885 W com.truecaller: Suspending all threads took: 83.547ms
05-12 15:49:41.012 26877 26877 W com.truecaller: Verification of void com.google.android.chimera.ModuleContext.<init>(android.content.Context, com.google.android.chimera.ModuleContext, crx, java.lang.String, int, android.content.res.Resources, java.lang.ClassLoader, cpr) took 506.468ms
05-12 15:49:41.249 26877 26877 W com.truecaller: Verification of void com.google.android.chimera.ModuleContext.a(android.content.Context, com.google.android.chimera.ModuleContext, crx, java.lang.String, int, java.lang.String, android.content.res.Resources, java.lang.ClassLoader, java.util.Map) took 223.901ms
05-12 15:49:41.446 26342 26342 W InputEventReceiver: Slow Input: 3292ms so far, now at dispatchInputEvent (MotionEvent: event_seq=53, seq=5246074, action=ACTION_MOVE)
05-12 15:49:41.714 2318 2335 D Boost : hostingType=service, hostingName=com.android.settings/.dangerousoptions.DangerousOptionsWarningService, callerPackage=com.android.settings, isSystem=true, isBoostNeeded=false.
05-12 15:49:41.757 26999 27085 W AppInitScheduler|Run: Waiting on LoadDexes for 6905ms...
05-12 15:49:41.812 1067 1067 I Zygote : Process 8720 exited due to signal (9)
05-12 15:49:41.815 2318 2398 W InputDispatcher: channel 'b28c9e0 com.miui.miwallpaper.MiWallpaper (server)' ~ Consumer closed input channel or an error occurred. events=0x9
05-12 15:49:41.815 2318 2398 E InputDispatcher: channel 'b28c9e0 com.miui.miwallpaper.MiWallpaper (server)' ~ Channel is unrecoverably broken and will be disposed!
05-12 15:49:41.821 2318 2336 W libprocessgroup: kill(-8720, 9) failed: No such process
05-12 15:49:41.821 2318 2336 I libprocessgroup: Successfully killed process cgroup uid 10084 pid 8720 in 8ms
05-12 15:49:41.855 2318 2335 W BoostFramework: Slow Operation: BoostFramework perfHint took 72ms
05-12 15:49:41.861 27180 27180 E settings:remot: Not starting debugger since process cannot load the jdwp agent.
05-12 15:49:41.876 2318 10308 I WindowManager: WIN DEATH: Window{b28c9e0 u0 com.miui.miwallpaper.MiWallpaper}
05-12 15:49:41.877 2318 10308 W InputDispatcher: Attempted to unregister already unregistered input channel 'b28c9e0 com.miui.miwallpaper.MiWallpaper (server)'
05-12 15:49:41.878 2318 2318 W WallpaperManagerService: Wallpaper service gone: ComponentInfo{com.miui.miwallpaper/com.miui.miwallpaper.MiWallpaper}
05-12 15:49:41.888 2318 2398 W InputDispatcher: channel '371861c com.miui.home/com.miui.home.launcher.Launcher (server)' ~ Consumer closed input channel or an error occurred. events=0x9
05-12 15:49:41.888 2318 2398 E InputDispatcher: channel '371861c com.miui.home/com.miui.home.launcher.Launcher (server)' ~ Channel is unrecoverably broken and will be disposed!
05-12 15:49:41.890 1067 1067 I Zygote : Process 8322 exited due to signal (9)
05-12 15:49:41.909 2318 3508 I ActivityManager: Process com.miui.miwallpaper (pid 8720) has died: vis BFGS
05-12 15:49:41.913 2318 3508 W ActivityManager: Scheduling restart of crashed service com.miui.miwallpaper/.MiWallpaper in 79461ms
05-12 15:49:41.918 2318 2398 W InputDispatcher: channel 'f22612f InputMethod (server)' ~ Consumer closed input channel or an error occurred. events=0x9
05-12 15:49:41.918 2318 2398 E InputDispatcher: channel 'f22612f InputMethod (server)' ~ Channel is unrecoverably broken and will be disposed!
05-12 15:49:41.923 1067 1067 I Zygote : Process 6816 exited due to signal (9)
05-12 15:49:41.937 1067 1067 I Zygote : Process 5881 exited due to signal (9)
05-12 15:49:41.938 2318 2666 I StatusBarManagerService: binder died for pkg=com.miui.home
05-12 15:49:41.939 1067 1067 I Zygote : Process 6088 exited due to signal (9)
05-12 15:49:41.939 2318 2334 W Looper : Drained
05-12 15:49:42.032 2318 3924 I WindowManager: WIN DEATH: Window{371861c u0 com.miui.home/com.miui.home.launcher.Launcher}
05-12 15:49:42.032 2318 3924 W InputDispatcher: Attempted to unregister already unregistered input channel '371861c com.miui.home/com.miui.home.launcher.Launcher (server)'
05-12 15:49:42.040 2318 3929 I WindowManager: WIN DEATH: Window{f22612f u0 InputMethod}
05-12 15:49:42.040 2318 3929 W InputDispatcher: Attempted to unregister already unregistered input channel 'f22612f InputMethod (server)'
05-12 15:49:42.075 2514 2744 D NetworkController.MobileSignalController(2): getDataNetTypeFromServiceState slotId=0 isUsingCarrierAggregation=false
05-12 15:49:42.075 2514 2744 D NetworkTypeUtils: getDataNetTypeFromServiceState:srcDataNetType = 13, destDataNetType 13
05-12 15:49:42.085 2318 2335 I ActivityManager: Start proc 27180:com.android.settings:remote/1000 for service com.android.settings/.dangerousoptions.DangerousOptionsWarningService caller=com.android.settings
05-12 15:49:42.086 2318 3932 I ActivityManager: Process com.google.android.googlequicksearchbox:interactor (pid 8322) has died: vis BFGS
05-12 15:49:42.086 2318 2336 W libprocessgroup: kill(-8322, 9) failed: No such process
05-12 15:49:42.086 2318 2336 I libprocessgroup: Successfully killed process cgroup uid 10043 pid 8322 in 0ms
05-12 15:49:42.086 2318 3932 W ActivityManager: Scheduling restart of crashed service com.google.android.googlequicksearchbox/com.google.android.voiceinteraction.GsaVoiceInteractionService in 89288ms
05-12 15:49:42.096 2318 2336 W libprocessgroup: kill(-6816, 9) failed: No such process
05-12 15:49:42.096 2318 3931 I ActivityManager: Process com.google.android.inputmethod.latin (pid 6816) has died: vis BFGS
05-12 15:49:42.096 2318 2336 I libprocessgroup: Successfully killed process cgroup uid 10091 pid 6816 in 0ms
05-12 15:49:42.097 2318 3931 W ActivityManager: Scheduling restart of crashed service com.google.android.inputmethod.latin/com.android.inputmethod.latin.spellcheck.AndroidSpellCheckerService in 99278ms