views:

18

answers:

1

first:

10-26 17:43:07.454: WARN/dalvikvm(6371): threadid=3: unable to interrupt threadid=19
10-26 17:43:07.487: DEBUG/dalvikvm(6371): GC freed 279 objects / 259776 bytes in 208ms
10-26 17:43:07.487: WARN/WindowManager(2215): Attempted to add application window with unknown token HistoryRecord{46366130 spexco.hus.cepvizyon/.ViewCam}.  Aborting.

I cant see other errors now, But in second, I want to learn how to stop Handler.? My handler code is: I call with "handler.sendMessage(new Message());"

private Handler handler = new Handler() {
    public void handleMessage(Message msg) {

        try {

            bmp = CameraManagerScreen.ActiveCam.getCurrentImage();
            bmpl = CameraManagerScreen.ActiveCam.getCurrentLenght();
            if (bmpl != bmpltmp) {
                if (speed.getVisibility() == 4) {
                    speed.setVisibility(0);
                    counter++;
                } else {
                    speed.setVisibility(4);
                    counter++;
                }
            }
            bmpltmp = bmpl;

            if (bmp != null) {
                if (CameraManagerScreen.ActiveCam.isConnected())
                    m_ProgressDialog.dismiss();
                imageView.setImageBitmap(bmp);

            }
            if (isDemo && counter == 10) {
                counter++;
                CameraManagerScreen.ActiveCam.cancel();
                CameraManagerScreen.ActiveCam.setConnected(false);

                m2_ProgressDialog.show();

            }

        } catch (Exception e) {

        } finally {
            if (isDemo && counter == 10)
                sleep(999999999);
            sleep(50);
        }

    };

    public void sleep(long delay) {
        this.removeMessages(0);

        sendMessageDelayed(obtainMessage(0), delay);

    };
};
A: 

The "unable to interrupt" issue arises when you try to interrupt a waiting thread, but the thread is in a state where it appears to be "stuck", so the VM gives up and drops the interrupt.

As of 2.2 ("froyo") the thread interrupt mechanism was changed and this no longer happens.

Does this happen reliably?

fadden
thanks, I checked my usage, and solved it.
atasoyh