[android-developers] Re: BluetoothServerSocket: how to close correctly?

2010-05-05 Thread nickon
I have the exact same problem,
more precisely this is what happens:

05-05 11:34:37.330: DEBUG/ConnectionManager(2241): stop()
05-05 11:34:37.330: DEBUG/ConnectionManager(2241): CANCEL
mAcceptThread
05-05 11:34:37.340: DEBUG/BluetoothSocket(2241): BluetoothSocket
close()
05-05 11:34:37.340: DEBUG/BluetoothSppPort(2241): BluetoothSppPort
disconnect()
05-05 11:34:37.340: ERROR/BluetoothSppPort(2241): invalid port state for 
disconnection

In the API they describe that you can close the serversocket at any
time using just the BluetoothSocket close() method.
However this doesn't seem to be working !?

Anyone?

On 29 mrt, 16:56, VovaN vladimir.nedashkivs...@gmail.com wrote:
 Hello,
 I've activity, which send files usingBluetooth. When I want to stop
 server socket which is waiting for accept I callclose(). After that
 activity just hang. How should IcloseBluetoothServerSocket correctly?

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


[android-developers] Re: onRestart() method not called on restart

2010-04-16 Thread nickon
On 15 apr, 21:32, ~ TreKing treking...@gmail.com wrote:
 On Thu, Apr 15, 2010 at 11:05 AM, nickon nickvanbae...@gmail.com wrote:
  What is the reason that this method is never called? Am I understanding the
  activity lifecycle wrong?

 Not sure, but I've never used onStop or onRestart. I would use onPause and
 onResume.

 --- 
 --
 TreKing - Chicago transit tracking app for Android-powered 
 deviceshttp://sites.google.com/site/rezmobileapps/treking

Those were the methods I used before, but those did not work either, I
believe the problem was that onResume() was never called. But will try
this again.

Maybe it has something to do with the structure of my program?
Normally when I switch back to my app I would say that the onResume or
onRestart etc HAVE to be called, but maybe they don't get focus or I
don't know (else I would not be posting here xD)

My app actually contains the following (important) classes:
tetris.java (the activity where I override on...() methods and where I
set my contentview to gamescreen which is a tetrisview)
tetrisview.java (the tetrisview class which extends SurfaceView)
tetristhread.java (the thread that draws onto the canvas of the
tetrisview)

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


[android-developers] onRestart() method not called on restart

2010-04-15 Thread nickon
Hey everyone,

I'm writing a Tetris application on Android for my bachelor thesis at
the University of Hasselt.
Currently I have a working Tetris base game, but it just keeps on
ticking when the activity gets in the background.

I'm trying to fix this by overwriting the onStop() and onRestart()
methods.
Here is what I do:

@Override
public void onStop(){
super.onStop();

// Pause the game along with the activity
ATetrisGame.getInstance().setMode(GameMode.PAUSE);
}

@Override
public void onRestart(){
super.onRestart();
ATetrisGame game = ATetrisGame.getInstance();

// We are restoring a previously PAUSED game
if(game.mode() == GameMode.PAUSE){
ATetrisGame.getInstance().setMode(GameMode.ACTIVE);
}
}

So when I press my home button on my device I will go to my home
screen and onStop() is called. Because the gamemode is now PAUSE,
the game wil not tick anymore.
But now, when I longpress my home button and select my tetris activity
again, the activity pops up, but it isn't ticking!
This is because the onRestart() is never called when I return to play
my application!

What is the reason that this method is never called? Am I
understanding the activity lifecycle wrong?

Thanx in advance guys!
Greetings,
Nick

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

To unsubscribe, reply using remove me as the subject.