tags:

views:

27

answers:

0

Hi, I try to open dialog from worker thread. In class wich extends form Thread class I put this line:

handler.sendEmptyMessage(2);

In class that extends from Activity class I have this code:

private final Handler handler = new Handler() {
    @Override
    public void handleMessage(Message msg) {
        if(msg.what == 1) openWinnerDialog(1, 1);
        else if(msg.what == 2) openLoserDialog();
    } 
};

public void openLoserDialog() {
new AnimalsLoserDialog(AnimalsActivity.this).show();}

When I run application the dialog is opening and then the application craches. It appears the folowing error:

not enough memory for layer bitmap size=1536000 (w=800, h=480, stride=800, format=1)
createNormalSurfaceLocked() failed (Out of memory)
OutOfResourceException creating surface
No leaked surfaces: killing applications 

This is an android application.

Any help? Thank you, Zorica