Hi,

I was trying to make an anonymous class to upload a file to a server.

I wanted to make that easily reusable much like some kind of
component.

Everything works fine but as a final touch i wanted to add a function
to check if internet connection is available.

Problem is, the call to the connectivity manager needs the Context :

ConnectivityManager connec = (ConnectivityManager) getSystemService
(Context.CONNECTIVITY_SERVICE);

Since i'm in an anonymous class and I've read that it's not a good
idea to pass the whole context to classes, I wondered about two
things :

1 - Is there another way to check internet connection without the
Context ?
2 - Why in Android internals make it necessary to have the context
just to check if the device is connected to internet ?

Thanks for your lights.

Regards



-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to