Forum Xamarin.Android

Fun with AndroidHttpClient (Java.Lang.Runtime exception)

Chris.3704Chris.3704 USUniversity ✭✭


I'm trying to implement a simple Http Get Request with AndroidHttpClient (yes, I have to use AndroidHttpClient). Apparently, things aren't that easy.
I'm failing on this line (see below):
while ((line = reader.ReadLine()) != null)
with a Java.Lang.Runtime exception.

Does anyone have an idea what I might be doing wrong?


                using (var client = AndroidHttpClient.NewInstance("AppConnectClient"))

                    try {
                        // Create Request
                        HttpGet get = new HttpGet(url);
                        var responseTask = client.ExecuteAsync(get);
                        var response = await responseTask;
                        var entity = response.Entity;
                        var resultBuilder = new StringBuilder();

                    using (var reader = new BufferedReader(new InputStreamReader(entity.Content)))
                        string line;
                        while ((line = reader.ReadLine()) != null)
                catch(Exception ex) {
                    // Print exception          


Sign In or Register to comment.