Stopping whole thread results in black view

Problems with Canvas, OpenGL, etc...

Stopping whole thread results in black view

Postby hblockx » Mon May 23, 2011 6:39 pm

Hello guys, sorry im not a born englishspeaker...
The last days i tried to get my java games on android. I cannot get over a problem:

onCreate
{
creates surfaceview
setcontentview sview
}

surfaceview created starts working thread

surfaceview onDraw paints the game

In the workingthread i have to wait for an userinput by tapping a special object, so i set it waiting with this.wait ( worked fine with swing). The problem is, the time the working thread waits one time, die gui doesnt paint anything ( black screen) without waiting for an input, everything is painted fine *but useless*

i hope you can explain me the problem, because im googling for hours and everytime i see only tutorials for sleeped threads (e.g. 500ms) but never for full slept threads, waiting for a notify by another thread...
hblockx
Freshman
Freshman
 
Posts: 3
Joined: Mon May 23, 2011 6:28 pm

Top

Re: Stopping whole thread results in black view

Postby raj_J2ME » Tue May 24, 2011 7:18 am

Hi hblockx and welcome to the Android Forums,

Well if you are waiting for getting the input or so, you have paused the main thread, since I guess your game includes the single thread, hence the GUI is not getting repainting.

The recommended solution would be, start the individual thread for taking the input and let the main thread worked for the GUI and rest of the game updations.

Correct me If I have understand your issues incorrectly,
Thanks with Regards,
Raj - The Kernel
raj_J2ME
Master Developer
Master Developer
 
Posts: 311
Joined: Tue Feb 15, 2011 7:40 am
Location: The Capital of India,

Re: Stopping whole thread results in black view

Postby hblockx » Tue May 24, 2011 8:04 am

Checked it with the debugger, only the new created thread is paused... the graphic is created in the main thread so it shouldnt be stopped...
hblockx
Freshman
Freshman
 
Posts: 3
Joined: Mon May 23, 2011 6:28 pm

Re: Stopping whole thread results in black view

Postby hblockx » Tue May 24, 2011 8:20 am

public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
sf= new SfView(this); // Surfaceview
this.setContentView(sf);
sf.setMinimumHeight(10);
sf.setMinimumWidth(10);
sf.setVisibility(sf.VISIBLE);
sf.invalidate();
runs=true;
newRound(this.getResources()); // the gamethread, getting paused

}
hblockx
Freshman
Freshman
 
Posts: 3
Joined: Mon May 23, 2011 6:28 pm

Top

Return to Android 2D/3D Graphics - OpenGL Problems

Who is online

Users browsing this forum: No registered users and 2 guests