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. SimpleCursorAdapter setAdapter not rendering any items

Anyone know why the following code would produce no list items even if
there are 9 rows in the cursor?

        private boolean fillAndBind(int id,Cursor c,String[] columns,int[]
to)
        {
        startManagingCursor(c);

        ListView lv = (ListView)this.findViewById(id);

        // Now create a simple cursor adapter and set it to display
        lv.setAdapter(new SimpleCursorAdapter(this,
R.layout.person_row, c, columns, to));
        lv.startLayoutAnimation();


        return true;
        }


Here is the view in the layout to render each row

<TextView android:id="@+id/person_row_display" xmlns:android="http://
schemas.android.com/apk/res/android"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"/>


Any help would be appreciate. Right now I'm going to iterate through
the cursor and bind a string array to get around this...

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

2. Mobile Dev Camp on November 29 and 30 in Amsterdam

Hello all,

If any of you will be in or near Amsterdam at the end of the month, I
encourage you drop by the Mobile Dev Camp I'm organizing. If our first
event at the end of August (iPhone Dev Camp, see www.iphonedevcamp.nl)
is any guide, we'll have around 100 people trading tips and developing
apps. And this time, we're also covering Android and Symbian in
addition to the iPhone platform. We're short of Android people right
now, so if you're an experienced developer, we'd love to have you give
a workshop. You can check out www.mobiledevcamp.nl for more
information.

Thanks and please pass on the information!

Peter Robinett

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

3. is it possible to change the color of the stars of a RatingBar?

4. AudioFlinger routing configurations..

5. Android Has a Bright Future.. But What Does This Mean for the G1?

6. Is there a way to put horizontal and scroll bar both together?

7. Porting Dalvik to mips