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. local socket instantiation problem

Hello,

The code snippet reported at the end of this message causes an
IOException "connection refused failure"

Could anyone explain to me why this failure occurs, and how I could
instantiate a localsocket connection?

By the way, replacing

l = new LocalSocketAddress(SOCKET_NAME);

with

l = new LocalSocketAddress(SOCKET_NAME,
LocalSocketAddress.Namespace.FILESYSTEM);

causes an IOException "socket not created" failure.

Thanks.

Alex Donnini

                    LocalSocket s = null;
                    LocalSocketAddress l;

                    try {

                        Log.i(TAG, " instantiating local socket --- ");

                        s = new LocalSocket();

                        Log.i(TAG, "s --- "+s.toString());

                        //l = new LocalSocketAddress(SOCKET_NAME,
LocalSocketAddress.Namespace.FILESYSTEM);
                        l = new LocalSocketAddress(SOCKET_NAME);
                        s.connect(l);
                    } catch (IOException ex){
                        try
                        {
                            if (s != null) {

                                Log.i(TAG, " about to close socket after
IOException --- ");
                                ex.printStackTrace();
                                s.close();
                            }
                            else
                            {

                                Log.i(TAG, " socket is null ---
"+s.toString());

                            }
                        }
                        catch (IOException ex2)

                        {

                                Log.i(TAG, " failure to close after failure
to connect --- ");

                        }

                    }



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

2. how can i launch the intent to pick image from SD card?

Hi,

Can you please tell me how can i launch the intent to pick image from SD card?
Thanks.

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

3. About Android

4. what is "shared user id",what's meaning of "shared user id = android.media"

5. Web development strategies for small screens... Sorry, not Android specific

6. How to save a Bitmap instance to a *.bmp file.

7. Flv to mp4 Convertion