is there a way where I can call an network API call on main thread in android honeycomb? -
I'm making a service and an app can call a method on the app service method calling an API and the API Based on, giving results. Since the app is targeting Android 3.0, I'm getting "NetworkOnMainThreadException".
My requirement is such a way that I can not call the method in the background thread from the app. Apart from this, the method on service should return the boolean based on API call.
Is there no way where I can call a network API call on the main thread in the Android honeycomb?
import android.os.StrictMode; StrictMode.ThreadPolicy Policy = New StrictMode.ThreadPolicy.Builder (). PermitAll () Build (); StrictMode.setThreadPolicy (policy);
Comments
Post a Comment