IF the data is big, it would of course take time. You could do some debugging, to figure out which part of your code is taking so much time.
That would help you in figuring out the actual problem. *Thanks and Regards, Kumar Bibek* * http://techdroid.kbeanie.com http://www.kbeanie.com* On Wed, Jun 22, 2011 at 7:57 PM, NaveenShrivastva < kumarnaveen.si...@gmail.com> wrote: > > > On Wed, Jun 22, 2011 at 7:48 PM, Kumar Bibek <coomar....@gmail.com> wrote: > >> Are you parsing stream or string? >> >> >> *Thanks and Regards, >> Kumar Bibek* >> * >> http://techdroid.kbeanie.com >> http://www.kbeanie.com* >> >> >> >> On Wed, Jun 22, 2011 at 7:45 PM, NaveenShrivastva < >> kumarnaveen.si...@gmail.com> wrote: >> >>> >>> >>> On Wed, Jun 22, 2011 at 7:37 PM, Kumar Bibek <coomar....@gmail.com>wrote: >>> >>>> Parse the stream using XMLPullParser if it's an XML. >>>> >>>> If not, then, there is not other way. Saving to string first for such a >>>> large response is not good. >>>> >>>> *Thanks and Regards, >>>> Kumar Bibek* >>>> * >>>> http://techdroid.kbeanie.com >>>> http://www.kbeanie.com* >>>> >>>> >>>> >>>> On Wed, Jun 22, 2011 at 7:35 PM, naveen kumar < >>>> kumarnaveen.si...@gmail.com> wrote: >>>> >>>>> i am getting large response of https server. i am not able to store >>>>> complete response in string variable, there fore i am witting the file >>>>> by using fileoutputstrem, it's takes more time for write on file and >>>>> parse them. >>>>> >>>>> Please fix this issue in android also. >>>>> >>>>> >>>>> thanks, >>>>> Naveen Kumar >>>>> >>>>> -- >>>>> 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 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 >>>> >>> >>> i am Parsing file by XMLPullParser.it's take approx 10mints, i want time >>> perforate, when tring to store in string then outofmemory exception,so >>> writing in file, then parsing the file, give me idea for imporve the time >>> performance , >>> >>> -- >>> Naveen Shrivastava >>> BCA+MCA(LAST SEM)+O/A/B Level(DOEACC SOCITY IT GOVT INDIA) >>> >>> -- >>> 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 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 >> > > > Sir, > > writing server response using fileoutputstream > > FileOutputStream fileOutputStream = null; > try { > fileOutputStream = new FileOutputStream( > sdImageMainDirectory.toString() + "/" + "test.xml", > true); > // fileOutputStream =null; > } catch (FileNotFoundException e) { > // TODO Auto-generated catch block > e.printStackTrace(); > } > BufferedOutputStream bos = new BufferedOutputStream( > fileOutputStream); > > try { > InputStreamReader resultInputStream = new > InputStreamReader( > conn.getInputStream()); > BufferedReader rd = new BufferedReader(resultInputStream); > String line; > > while ((line = rd.readLine()) != null) { > by_new = line.getBytes(); > // st=st+new String(line); > > try { > fileOutputStream.write(by_new, 0, by_new.length); > fileOutputStream.flush(); > > } catch (IOException e) { > // TODO Auto-generated catch block > e.printStackTrace(); > } > > Log.i("Huzza", "RES Message: " + line); > } > fileOutputStream.close(); > rd.close(); > resultInputStream.close(); > } catch (IOException ioex) { > > Log.e("Huzza", "error: " + ioex.getMessage(), ioex); > } > > > then parsing the file > public Object ParsingResponse(String responsData) throws XMLRPCException { > System.out.print("######"); > String path = Environment.getExternalStorageDirectory() + > "/test.xml"; > File file = new File(path); > XMLRPCCommon obj1 = new XMLRPCCommon(); > > try { > fis = new FileInputStream(file); > // setup pull parser > XmlPullParser pullParser = > XmlPullParserFactory.newInstance().newPullParser(); > Reader reader; > responsData = ""; > pullParser.setInput(fis, "UTF-8"); > // lets start pulling... > > pullParser.nextTag(); > pullParser.require(XmlPullParser.START_TAG, > null,Tag.METHOD_RESPONSE); > pullParser.nextTag(); // either Tag.PARAMS (<params>) or > Tag.FAULT > // (<fault>) > String tag = pullParser.getName(); > if (tag.equals(Tag.PARAMS)) { > // normal response > pullParser.nextTag(); // Tag.PARAM (<param>) > pullParser.require(XmlPullParser.START_TAG, null, > Tag.PARAM); > pullParser.nextTag(); // Tag.VALUE (<value>) > // no parser.require() here since its called in > // XMLRPCSerializer.deserialize() below > > // deserialize result > Object obj = > obj1.iXMLRPCSerializer.deserialize(pullParser); > // entity.consumeContent(); > // System.out.print("Data in Method is :"+obj.toString()); > return obj; > } else if (tag.equals(Tag.FAULT)) { > // fault response > pullParser.nextTag(); // Tag.VALUE (<value>) > // no parser.require() here since its called in > // XMLRPCSerializer.deserialize() below > > // deserialize fault result > Map<String, Object> map = (Map<String, Object>) > obj1.iXMLRPCSerializer.deserialize(pullParser); > String faultString = (String) map.get(Tag.FAULT_STRING); > int faultCode = (Integer) map.get(Tag.FAULT_CODE); > // entity.consumeContent(); > throw new XMLRPCFault(faultString, faultCode); > } else { > // entity.consumeContent(); > throw new XMLRPCException("Bad tag <" + tag+ "> in XMLRPC > response - neither <params> nor <fault>"); > } > } catch (XMLRPCException e) { > // catch & propagate XMLRPCException/XMLRPCFault > throw e; > } catch (Exception e) { > e.printStackTrace(); > // wrap any other Exception(s) around XMLRPCException > throw new XMLRPCException(e); > } > > } > > But taking more time approx 10minutes. > > i want reduce time here. > > please help me. > > > thanks in advance, > > > > -- > Naveen Shrivastava > BCA+MCA(LAST SEM)+O/A/B Level(DOEACC SOCITY IT GOVT INDIA) > > -- > 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 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