[android-developers] I always get a crash when reading an InputStream on Android

2014-07-17 Thread Fabrizio Bartolomucci
I am trying to receive the result of an url request and transform it into a 
string to analyze if everything works fine. Yet whenever I call:

content.read(buffer));

as in this test function:

private void processStream(InputStream content) throws 
ClientProtocolException, IOException {

 // TODO Auto-generated method stub

 Toast toast=Toast.makeText(this, ricevuto stream,Toast.LENGTH_LONG);

 toast.show();

 byte[] buffer=new byte[1024];

  Log.d(LOG_TAG, risultato=+content.read(buffer));

content.close();

}

I get an unspecified crash. What might it be and what to do instead?

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
Android Developers group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to android-developers+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [android-developers] I always get a crash when reading an InputStream on Android

2014-07-17 Thread Mukesh Srivastav
Please print the stack trace so that we can check what went wrong.


On Thu, Jul 17, 2014 at 11:25 PM, Fabrizio Bartolomucci fbarto...@gmail.com
 wrote:

 I am trying to receive the result of an url request and transform it into
 a string to analyze if everything works fine. Yet whenever I call:

 content.read(buffer));

 as in this test function:

 private void processStream(InputStream content) throws
 ClientProtocolException, IOException {

  // TODO Auto-generated method stub

  Toast toast=Toast.makeText(this, ricevuto stream,Toast.LENGTH_LONG);

  toast.show();

  byte[] buffer=new byte[1024];

   Log.d(LOG_TAG, risultato=+content.read(buffer));

 content.close();

 }

 I get an unspecified crash. What might it be and what to do instead?

 --
 You received this message because you are subscribed to the Google
 Groups Android Developers group.
 To post to this group, send email to android-developers@googlegroups.com
 To unsubscribe from this group, send email to
 android-developers+unsubscr...@googlegroups.com
 For more options, visit this group at
 http://groups.google.com/group/android-developers?hl=en
 ---
 You received this message because you are subscribed to the Google Groups
 Android Developers group.
 To unsubscribe from this group and stop receiving emails from it, send an
 email to android-developers+unsubscr...@googlegroups.com.
 For more options, visit https://groups.google.com/d/optout.




-- 
Warm Regards,
*Mukesh Kumar*,
Android Consultant/Freelancer,
India,Hyderabad.

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
Android Developers group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to android-developers+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.