Jump to content

Comment appeler une fonction de la classe principale depuis un Thread ?


Chronogps

Recommended Posts

Soit le code suivant :

class BluetoothSocketListener implements Runnable
{
public BluetoothSocketListener(...)
 {
 (...)
 }	  
public void run()
 {
 (...)
 }
}


public class MyApp extends Activity implements LocationListener
{
BluetoothSocketListener bsl = new BluetoothSocketListener(...);
Thread MessageListener = new Thread(bsl);
MessageListener.start();

(...)
   public void onLocationChanged(Location loc) 
         {
         (...)
         }
}

Comment depuis la fonction run() appeler la fonction onLocationChanged() ?

En clair comment passer l'adresse de cette fonction via l'instanciation de BluetoothSocketListener ?

Merci pour vos lumières !

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...