invalidation

Android ContentResolver.query always returns same data

∥☆過路亽.° 提交于 2019-12-25 02:53:14
问题 I have videoplayer app with filebrowser listing all videos on SD card Code inspired by i want get audio files in sd card Using ContentResolver, works as expected, but it does not update if the files on card change. I do not mean automatically, but after view/app restart. Not even reinstalling the application helped, still shows the same files. The deleted video file is not visible via PC nor it is possible to play it (This video cannot be played (translation)). I dumped the data and the

Invalidating an NSTimer?

泄露秘密 提交于 2019-12-24 14:57:20
问题 If I have an NSTimer that starts in viewdidload, where is the proper place to invalidate it when leaving that view? Is it also necessary to release it as well? 回答1: If you create a timer with NSTimer scheduledTimerWithTimeInterval... then you don't need to release it, as you don't own it. Now important thing is that the timer class retains the target, and in most cases we use self as the target. If the timer is not repetitive , then after the timer handler is completed, it automatically

Am I invalidating the entire screen on every call?

末鹿安然 提交于 2019-12-21 17:23:01
问题 I am new to Android Development and reading the book Hello Android . It uses a Sudoku example, and the code that I am referring to is here. In this , onTouchScreen, it calls select method, that calls invalidate twice. The question is that, on invalidating is the onDraw method called right after that? So will in this case, inside my select method, it will do invalidate call onDraw Do some stuff invalidate call onDraw Is this how it will happen, also, will the entire screen be regenerated? All

How to find if NSTimer is active or not?

感情迁移 提交于 2019-12-21 03:24:16
问题 I have a something like this: NSTimer* timer = [NSTimer scheduledTimerWithTimeInterval:1.0 target:self selector:@selector(updateCountdown) userInfo:nil repeats:YES]; I am updating a label's text using this timer. Not at a certain condition I want to check if timer is active then invalidate the timer. My question is how do I find that timer is active or not? 回答1: When a non repeating timer fires it marks itself as invalid so you can check whether it is still valid before cancelling it (and of

Android: invalidate(dirty)

不问归期 提交于 2019-12-20 20:32:03
问题 It seems like Android really doesn't like invalidate (Rect dirty) , which is used to invalidate only part of a canvas. When I invalidate part of a canvas (shown in green below) and a ToggleButton outside of the canvas needs to be redrawn at the same time, the entire region shown in red is erased! It seems as though Android is just invalidating everything within the smallest rectangle encompassing the union of the two regions that need to be redrawn, even if one of the regions is outside of

NSTimer disables dealloc in UIView

Deadly 提交于 2019-12-20 12:38:48
问题 @interface someview:UIView{ NSTimer* timer; } @end @implementation someview -(void)dealloc{ NSLog(@"dealloc someview"); [timer invalidate]; timer = nil; } -(void)runTimer{ // } -(void)someMethod{ timer = [NSTimer timerWithTimeInterval:2.0f target:self selector:@selector(runTimer) userInfo:nil repeats:YES]; } @end Releasing someview will NOT call dealloc and the timer keeps on running. If I comment out the "timer = [NSTimer schedule...." part, dealloc will be called. Which means all the other

Avoiding iterator invalidation using indices, maintaining clean interface

丶灬走出姿态 提交于 2019-12-20 10:04:18
问题 I have created a MemoryManager<T> class which is basically a wrapper around two vectors of pointers that manage lifetime of heap-allocated objects. One vector stores the "alive" objects, the other one stores the object that will be added on next MemoryManager<T>::refresh . This design was chosen to avoid iterator invalidation when looping over the MemoryManager<T> , as adding a new object directly to the MemoryManager<T>::alive vector can invalidate existing iterators (if it grows in size).

Update existing Preference-item in a PreferenceActivity upon returning from a (sub)PreferenceScreen

允我心安 提交于 2019-12-18 04:12:49
问题 I have a PreferenceActivity with a bunch of (Sub)PreferenceScreens. Each such (Sub)PreferenceScreen represents an account and has the account-username as its title. PreferenceScreen root = mgr.createPreferenceScreen(this); for (MyAccountClass account : myAccounts) { final PreferenceScreen accScreen = mgr.createPreferenceScreen(this); accScreen.setTitle(account.getUsername()); // add Preferences to the accScreen // (for instance a "change username"-preference) ... root.add(accScreen); } As the

When does one need to call revalidate() on a swing component to make it refresh, and when not?

痴心易碎 提交于 2019-12-17 12:43:00
问题 When dealing with swing components, and when changing the components during runtime, one (often) needs to call the revalidate() method on the components in order for them to refresh. What are the rules that determine whether or not one needs to revalidate a component? Does swing automatically call revalidate() when some certain properties on a component changes, and for some other properties not? 回答1: The basic rule is: never - swing internals will take care of it. The basic exception to the

Google Maps: Some KMZ layers disappear after many access

試著忘記壹切 提交于 2019-12-14 04:23:39
问题 Recently I'm developping a Map containing KML Layer compressed as KMZ file (about 45mb). As there is a file weight limitation, I first split the files into 3mb files. Then I noticed that some splitted files was not showing everytime, causing some "blanks" on the map. So I made researches on many forums, and found that the real limitation of files in order to get everything working properly is 2mb. After update, the KML Layer was indeed showing entierely. However, after doing many tests, I