Hi.

there are 2 ways to let user press "home" and return back with their
status correct :

1.

public gameView(Context context, AttributeSet attrs) {
    super(context, attrs);
    SurfaceHolder holder = getHolder();
    holder.addCallback(this);
    thread = new gameThread(holder);
}
public void surfaceCreated(SurfaceHolder holder)
{
    if (!thread.isAlive())
    {
        thread = new gameThread(holder);
    }
    thread.start();
    thread.runThread = true;
}
public void surfaceDestroyed(SurfaceHolder holder)
{
    thread.runThread = false;
    boolean fuck = true;
    while (fuck)
    {
        try
        {
            thread.join();
            fuck = false;
        }
        catch (InterruptedException e)
        {
        }
    }
}
this is the lunarlander based + a bit improved version.

2.

public gameView(Context context, AttributeSet attrs)
{
    super(context, attrs);
    SurfaceHolder holder = getHolder();
    holder.addCallback(this);
}
public void surfaceCreated(SurfaceHolder holder)
{
    thread = new gameThread(holder);
    thread.start();
    thread.runThread = true;
}
public void surfaceDestroyed(SurfaceHolder holder)
{
    thread.runThread = false;
    boolean fuck = true;
    while (fuck)
    {
        try
        {
            thread.join();
            fuck = false;
        }
        catch (InterruptedException e)
        {
        }
    }
}
EITHER WAY can't let me insert this code in my "thread constructor":

Bitmap land = Bitmap.createBitmap(2000, 2000,
Bitmap.Config.ARGB_8888);
I know it is way too big. But even If I turn it smaller like

mapland = Bitmap.createBitmap(1000, 1000, Bitmap.Config.ARGB_8888);
The activity still crush after 3 times of "home and return".

I have added this line to the modified lunarlander and the famous
"RockScissorsPaper" tutorial to test, they all crashed.

I don't understand this : Didn't I release memory since thread.join()
was called??

I really need this bitmap for my application and I want to access it
in my thread, does anyone have any idea ??

Thanks if there are any clues or suggestions, I would be very glad and
thankful.

Steven

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to