Why isn't my program creating a Toast (Android programming)?

cnguyen71390

New member
Whenever the Toast is called, my program throws errors and halts. Here's the bit of code:

public class LocationService extends Service implements LocationListener {

.........

public void displayList(String dlist) {
Log.d("Test", dlist);
Toast.makeText( getApplicationContext() , "Theaters in distance:\n" + dlist, Toast.LENGTH_LONG).show();
}
}

As you can see, I'm trying to create the toast from the service class, instead of the Activity class. I know the toast is the problem because the Log.d comments are posted with the right output.

Here's some of the errors that pop up in the DDMS:
05-04 23:23:24.200: ERROR/ActivityThread(563): Failed to find provider info for android.server.checkin
05-04 23:24:40.361: ERROR/AndroidRuntime(1413): Uncaught handler: thread main exiting due to uncaught exception
05-04 23:24:40.400: ERROR/AndroidRuntime(1413): java.lang.NullPointerException
 
Back
Top