0

Possible Duplicate:
Alert Dialog in non activity class

I've error interceptor for web service.And I want to show to user error message.Interceptor isn't Activity,Service class. It is created by framework resttemplate and have no Context.Why is difficult send message to user current Activity? It is very ridicule to compare Aplle(iOS) where it is very simple task.

Community
  • 1
  • 1
Alexander
  • 85
  • 1
  • 10
  • 1
    If your question is: "Why is difficult send message to user current Activity?" I would answer: "It's not". What have you tried? – Sam Nov 09 '12 at 18:11
  • 1
    You should define an interface then use a callback from your class to the activity as a listener. It's easy. http://stackoverflow.com/questions/3398363/how-to-define-callbacks-in-android – Simon Nov 09 '12 at 18:12
  • my class is public class MyResponseErrorHandler implements ResponseErrorHandler{public boolean hasError(ClientHttpResponse clienthttpresponse) throws IOException {}.It is place to show alert.There are not any Context, have no call the constructor expicity. – Alexander Nov 09 '12 at 19:28
  • Simon,thaks,- if it is easy,it is not correct.I want not to coding each Activity by alertDialog.the method hasError - it is unique place to show alert.Most easy is to send current Activity by parameter to class singleton.But it isn't best solution. – Alexander Nov 09 '12 at 19:37

0 Answers0