java - Equivalent for Strict mode in API level less than 8 -
i'm developing android application.i connect application mysql database through php file hosted in webserver.the code use is
strictmode.threadpolicy policy = new strictmode.threadpolicy.builder().permitall().build(); strictmode.setthreadpolicy(policy); final arraylist<namevaluepair> namevaluepairs = new arraylist<namevaluepair>(); if(fid.gettext().tostring().trim().length() > 0 && it1.gettext().tostring().trim().length() > 0 && it2.gettext().tostring().trim().length() > 0 && it3.gettext().tostring().trim().length() > 0 && it4.gettext().tostring().trim().length() > 0 && it5.gettext().tostring().trim().length() > 0 && it6.gettext().tostring().trim().length() > 0) { namevaluepairs.add(new basicnamevaluepair("item1",item1)); namevaluepairs.add(new basicnamevaluepair("item2",item2)); namevaluepairs.add(new basicnamevaluepair("item3",item3)); namevaluepairs.add(new basicnamevaluepair("item4",item4)); namevaluepairs.add(new basicnamevaluepair("item5",item5)); namevaluepairs.add(new basicnamevaluepair("item6",item6)); namevaluepairs.add(new basicnamevaluepair("fr", fr)); try{ httpclient httpclient = new defaulthttpclient(); httppost httppost = new httppost("http://applicationdownloader.net46.net/walcliff/newitems.php"); httppost.setentity(new urlencodedformentity(namevaluepairs)); httpresponse response = httpclient.execute(httppost); httpentity entity = response.getentity(); = entity.getcontent(); //convert response string try{ bufferedreader reader = new bufferedreader(new inputstreamreader(is,"iso-8859-1"),8); stringbuilder sb = new stringbuilder(); string line = null; while ((line = reader.readline()) != null) { sb.append(line + "\n"); } is.close(); result=sb.tostring();
the problem face is
1.the application not running version 2.2 ie.froyo,i checked error , found strictmode not available in api level below 8.
2.the application runs fine , database updated in api level greater 8.
i commented strictmode , debugged in mobile 2.2 version exception.
please suggest me equivalent strictmode i'm helpless because application should scalable devices.
Comments
Post a Comment