How to abort slow array sorting

by ls02 » Tue, 07 Sep 2010 20:01:52 GMT


Sponsored Links
 I sort very long array with Collections.sort method. This is done in a
worker thread. I need to abort the sort. I didn't find how I can do
this, Comparator.compare does not seem to allow throwing any exception
and I didn't find how I can set any flag to abort the sort.

--



How to abort slow array sorting

by Kostya Vasilyev » Tue, 07 Sep 2010 20:16:40 GMT


 07.09.2010 16:00, ls02 :
I sort very long array with Collections.sort method. This is done in a worker thread. I need to abort the sort. I didn't find how I can do this, Comparator.compare does not seem to allow throwing any exception and I didn't find how I can set any flag to abort the sort.
You can throw a subclass of RuntimeException, even if the method signature doesn't allow it. -- Kostya Vasilyev -- WiFi Manager + pretty widget -- http://kmansoft.wordpress.com --


Sponsored Links


Other Threads

1. Rotation Redux: how to MAKE it auto-rotate!

Well, heh, when I first started writing this app I couldn't get the 
G1 to NOT rotate my activities on keyboard out. Finally, I added 
android:screenOrientation="portrait" to the activities in the 
manifest and that kept everything fixed.

Now I have an activity I WANT to rotate when the keyboard comes out, 
so I removed the "screenOrientation" attribute entirely on that 
activity, figuring I'd be reverting back to the wild-and-wooly 
auto-rotate behavior. However, even though the activity is destroyed 
and re-created when the keyboard comes out, the screen is still drawn 
in portrait mode. "adb" sez on kbd out:

12-31 10:33:15.278 I/WindowManager(   56): Input configuration 
changed: { scale=1.0 imsi=0/0 locale=en_US touch=3 key=2/1 nav=3 
orien=1 }

The only way I can get a landscape view is to force it with 
"screenOrientation:landscape" on that activity (but then it is 
rotated even before the keyboard comes out).

What am I missing here?  (I only have one set of resources in the 
res/layout directory, figure I shouldn't need two unless I want to 
customize...)

Thanks all.

-- Ward

--~--~---------~--~----~------------~-------~--~----~

2. To Play .mp3 from host machine filesystem

Hi All,

Is there any procedure to play .mp3 file stored in a filesystem of
host machine (windows XP) without getting into file system of
emulator.

I know its least useful scenario but i am just curious to know
whaether MediaPlayer class supports it or not ?

Thanks
Sal
--~--~---------~--~----~------------~-------~--~----~

3. About davikvm's GC

4. How to find out which package started an intent?

5. service with a UI

6. Unable to get all phone numbers of a contact.

7. Why Google does not accepts my Visa credit card?