Код: Выделить всё
public class MyService extends Service{
private MyThread myThread;
//other methods
public void sendNotification(String message){
...
}
@Override
public void onStart()
{
myThread= new MyThread(this);
myThread.start();
}
}
Код: Выделить всё
public class MyThread extends Thread{
private MyService myService;
public MyThread(MyService myService){
this.myService = myService;
}
@Override
public void run()
{
myService.sendNotification("Hello there");
}
}
Подробнее здесь: https://stackoverflow.com/questions/783 ... terface-to