i'm sorry if there is a question like this i just wanna know, i'm trying to read file .txt on server and i convert to int and i have succeed when i try on froyo simulator
this is my code
final Context context = this;
TextView textServer, textApp;
final String textSource = "http://xxx/dev/android/androidversi.txt";
DECLARATION FOR LOCATION OF .txt file
URL textUrl;
String StringBuffer;
String stringText = "";
try {
textUrl = new URL(textSource);
BufferedReader bufferReader = new BufferedReader(new InputStreamReader(textUrl.openStream()));
while ((StringBuffer = bufferReader.readLine()) != null)
{
stringText += StringBuffer;
}
bufferReader.close();
} catch (MalformedURLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
CODE ABOVE READS .txt FILE FROM SERVER AND THIS CODE WHICE ARE ERRORS IN JELLY BEAN, BECAUSE I'VE TRIED ON FROYO IS RUNNING NORMALLY
PackageManager manager = getPackageManager();
PackageInfo info;
try {
info = manager.getPackageInfo(getPackageName(), 0);
int version = info.versionCode;
if(Integer.parseInt(stringText)>version) // I'VE CONVERTED STRING FROM .txt TO INT SO THAT I CAN COMPARE IT WITH VERSION ON APP
{
// IF VERSION ON SERVER > VERSION APP THERE IS LINK TO DOWNLOAD HERE
}
} catch (NameNotFoundException e){
e.printStackTrace();
}
compare the version
Please help me :'(