Is there an easy way to run a network request synchronously while also avoiding networkonmainthread exception, or am I forced to just use a callback of some kind?
oh gosh.. trying to throw this Java command line code into an app so Android Studio can actually build it again, and I got an exception I haven't seen in over a year... NetworkOnMainThread Exception. cc:@codeMagic
I have created a bitmap array and I am updating the elements of the array in an imageview inside listview. But it is showing network on main thread exception.
Here is the code:
public class InTheaters extends Activity {
// the Rotten Tomatoes API key of your application! get this from their...
When running the line
echoSocket = new Socket(serverHostname, 10008); My app crashes with error, NetworkOnMainThreadException error.
From what i have seen this related to trying to run Sockets on the UI thread. so how can i change my code (below) so it works?
import java.io.BufferedReader;
imp...
Ahh, NetworkOnMainThread exceptions didn't get thrown until Honeycomb+, which explains why they happen in this app that was pretty much released in '11
I just found out about NetworkOnMainThreadException at official docs
and was wondering if the emulator is throwing this. I have been testing my app quite a bit and as far as I know all networking is off the main thread (using Roboguice RoboAsyncTask) but you never know if one has not escaped.
I...