Invoke showAlert() from service

Put your problem here if it does not fit any of the other categories.

Invoke showAlert() from service

Postby AndreySerj » Mon Jan 21, 2008 11:26 am

Hi all,
I have my running service. When I call some service's method ( start() ) which must invoke showAlert() to show some information I have an exception ....
Syntax: [ Download ] [ Hide ]
Using java Syntax Highlighting
  1.  
  2. public class MyService extends Service {
  3.  
  4.    
  5.  
  6.     @Override
  7.  
  8.     public IBinder getBinder() {
  9.  
  10.         return mBinder;
  11.  
  12.     }
  13.  
  14.  
  15.  
  16.     @Override
  17.  
  18.     public void onCreate() {
  19.  
  20.         super.onCreate();
  21.  
  22.     }
  23.  
  24.  
  25.  
  26.    private final IMyService.Stub mBinder = new IMyService.Stub() {
  27.  
  28.         public void start() {
  29.  
  30.                 notify();
  31.  
  32.         }
  33.  
  34.     };
  35.  
  36.  
  37.  
  38.     public void notify() {
  39.  
  40.         new Thread(new Notificator()).start();
  41.  
  42.     }
  43.  
  44.  
  45.  
  46.     private class Notificator implements Runnable {
  47.  
  48.            public void run() {
  49.  
  50.                 showAlert("START TEST", "Yes or No?", "No", null, "Yes", yesListener, true, null);
  51.  
  52.            }
  53.  
  54.        
  55.  
  56.     }
  57.  
  58. ....
  59.  
  60.  
Parsed in 0.036 seconds, using GeSHi 1.0.8.4


How to call correctly showAlert() method from service ?
AndreySerj
Developer
Developer
 
Posts: 31
Joined: Wed Dec 26, 2007 9:57 am
Location: Minsk

Top

Postby plusminus » Mon Jan 21, 2008 9:53 pm

Hello AndreySerj,

which Exception do you receive :?: More info makes helping easier.

Regards,
plusminus
Image
Image | Android Development Community / Tutorials
User avatar
plusminus
Site Admin
Site Admin
 
Posts: 2688
Joined: Wed Nov 14, 2007 8:37 pm
Location: Schriesheim, Germany

Top

Return to Other Coding-Problems

Who is online

Users browsing this forum: No registered users and 14 guests