Hi, all in my application I want to read data from web page. if data
at web page is upto 800kb then I am able to read it succesfully, but
if data is larger then I get OutofMemoryException. Here is my code
which reads data from web page


public void restoreImage()
    {
        System.out.println ("inside restoreImage");
         try
         {
             URL yahoo = new URL("SOME URL FROM WHICH I WANT TO READ
DATA");

             BufferedReader in = new BufferedReader(new
InputStreamReader(yahoo.openStream()));

             System.out.println ("Before while");
             while ((inputLine = in.readLine()) != null)

             {
                           System.out.println ("Inside while");
                           System.out.println(inputLine);
                           wholeImage=inputLine;

             }


          in.close();
         }
         catch (MalformedURLException me)
         {
             System.out.println(me);

         }
         catch (IOException ioe)
         {
             System.out.println(ioe);
         }

I think it is because I am using condition as while ((inputLine =
in.readLine()) != null)  and in phone there is not much memory to read
such a long string. I think I must have to read some part of string
then write that part into some file in phone and read another part of
string and write into phone but I don't know how to do that? Please
help me solve this issue. Thanks

-- 
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