[android-developers] Re: Server Response
Hi, Not executing :-( Server Side //Script if($count==1){ echo true; }else { echo false; } ? Client Side ... if (true.equals(responseText)){ Log.i(Output,responseText); responseText = here it should be true; Toast.makeText( getApplicationContext(), responseText,Toast.LENGTH_SHORT).show(); }else{ Log.i(Output,responseText); responseText = here it should be false; Toast.makeText( getApplicationContext(), responseText,Toast.LENGTH_SHORT).show(); } Now what ever happen it shows me here it should be false it means always condition is false and only else part will be executed. where as in Logcat Output variable shows me both values true false depending on the parameter send to the server. If part is not executing even on true it always goes to else part of the condition, IN LOG CAT it is showing me value of Output in true case 02-10 11:47:20.720: INFO/Output(1358): 02-10 11:47:20.720: INFO/Output(1358): true I donot know why there is empty output above true ? may be this is the reason that its always going to false. Is it a white space ? if yes how to remove it with java ? Please help. Atif On Feb 10, 12:50 am, TreKing treking...@gmail.com wrote: On Wed, Feb 9, 2011 at 5:24 PM, Atif Musaddaq atif.musad...@gmail.comwrote: Can any one help me and tell me what i am doing wrong here ? why it is not comparing the condition ? responseText is already string and also comparing String http://www.google.com/search?q=how+to+compare+strings+in+javahttp://www.devdaily.com/java/edu/qanda/pjqa1.shtml --- -- TreKing http://sites.google.com/site/rezmobileapps/treking - Chicago transit tracking app for Android-powered devices -- 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
Re: [android-developers] Re: Server Response
The empty line is due to there being a newline character in your server's response. Trim it before testing for true / false: response = response.trim(); -- Kostya 10.02.2011 13:50, Samsung Galaxy пишет: Hi, Not executing :-( Server Side //Script if($count==1){ echo true; }else { echo false; } ? Client Side ... if (true.equals(responseText)){ Log.i(Output,responseText); responseText = here it should be true; Toast.makeText( getApplicationContext(), responseText,Toast.LENGTH_SHORT).show(); }else{ Log.i(Output,responseText); responseText = here it should be false; Toast.makeText( getApplicationContext(), responseText,Toast.LENGTH_SHORT).show(); } Now what ever happen it shows me here it should be false it means always condition is false and only else part will be executed. where as in Logcat Output variable shows me both values true false depending on the parameter send to the server. If part is not executing even on true it always goes to else part of the condition, IN LOG CAT it is showing me value of Output in true case 02-10 11:47:20.720: INFO/Output(1358): 02-10 11:47:20.720: INFO/Output(1358): true I donot know why there is empty output above true ? may be this is the reason that its always going to false. Is it a white space ? if yes how to remove it with java ? Please help. Atif On Feb 10, 12:50 am, TreKingtreking...@gmail.com wrote: On Wed, Feb 9, 2011 at 5:24 PM, Atif Musaddaqatif.musad...@gmail.comwrote: Can any one help me and tell me what i am doing wrong here ? why it is not comparing the condition ? responseText is already string and also comparing String http://www.google.com/search?q=how+to+compare+strings+in+javahttp://www.devdaily.com/java/edu/qanda/pjqa1.shtml --- -- TreKinghttp://sites.google.com/site/rezmobileapps/treking - Chicago transit tracking app for Android-powered devices -- Kostya Vasilyev -- WiFi Manager + pretty widget -- http://kmansoft.wordpress.com -- 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
[android-developers] Re: Server Response
Thanks All its working :-) On Feb 10, 11:57 am, Kostya Vasilyev kmans...@gmail.com wrote: The empty line is due to there being a newline character in your server's response. Trim it before testing for true / false: response = response.trim(); -- Kostya 10.02.2011 13:50, Samsung Galaxy пишет: Hi, Not executing :-( Server Side //Script if($count==1){ echo true; }else { echo false; } ? Client Side ... if (true.equals(responseText)){ Log.i(Output,responseText); responseText = here it should be true; Toast.makeText( getApplicationContext(), responseText,Toast.LENGTH_SHORT).show(); }else{ Log.i(Output,responseText); responseText = here it should be false; Toast.makeText( getApplicationContext(), responseText,Toast.LENGTH_SHORT).show(); } Now what ever happen it shows me here it should be false it means always condition is false and only else part will be executed. where as in Logcat Output variable shows me both values true false depending on the parameter send to the server. If part is not executing even on true it always goes to else part of the condition, IN LOG CAT it is showing me value of Output in true case 02-10 11:47:20.720: INFO/Output(1358): 02-10 11:47:20.720: INFO/Output(1358): true I donot know why there is empty output above true ? may be this is the reason that its always going to false. Is it a white space ? if yes how to remove it with java ? Please help. Atif On Feb 10, 12:50 am, TreKingtreking...@gmail.com wrote: On Wed, Feb 9, 2011 at 5:24 PM, Atif Musaddaqatif.musad...@gmail.comwrote: Can any one help me and tell me what i am doing wrong here ? why it is not comparing the condition ? responseText is already string and also comparing String http://www.google.com/search?q=how+to+compare+strings+in+javahttp://w... --- -- TreKinghttp://sites.google.com/site/rezmobileapps/treking - Chicago transit tracking app for Android-powered devices -- Kostya Vasilyev -- WiFi Manager + pretty widget --http://kmansoft.wordpress.com -- 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
Re: [android-developers] Re: Server Response
Dang too late.. lol.. use responseText.trim().equalsIgnoreCase(true). Of course I'd check for null first.. On Thu, Feb 10, 2011 at 3:18 AM, Samsung Galaxy atif.musad...@gmail.comwrote: Thanks All its working :-) On Feb 10, 11:57 am, Kostya Vasilyev kmans...@gmail.com wrote: The empty line is due to there being a newline character in your server's response. Trim it before testing for true / false: response = response.trim(); -- Kostya 10.02.2011 13:50, Samsung Galaxy пишет: Hi, Not executing :-( Server Side //Script if($count==1){ echo true; }else { echo false; } ? Client Side ... if (true.equals(responseText)){ Log.i(Output,responseText); responseText = here it should be true; Toast.makeText( getApplicationContext(), responseText,Toast.LENGTH_SHORT).show(); }else{ Log.i(Output,responseText); responseText = here it should be false; Toast.makeText( getApplicationContext(), responseText,Toast.LENGTH_SHORT).show(); } Now what ever happen it shows me here it should be false it means always condition is false and only else part will be executed. where as in Logcat Output variable shows me both values true false depending on the parameter send to the server. If part is not executing even on true it always goes to else part of the condition, IN LOG CAT it is showing me value of Output in true case 02-10 11:47:20.720: INFO/Output(1358): 02-10 11:47:20.720: INFO/Output(1358): true I donot know why there is empty output above true ? may be this is the reason that its always going to false. Is it a white space ? if yes how to remove it with java ? Please help. Atif On Feb 10, 12:50 am, TreKingtreking...@gmail.com wrote: On Wed, Feb 9, 2011 at 5:24 PM, Atif Musaddaqatif.musad...@gmail.com wrote: Can any one help me and tell me what i am doing wrong here ? why it is not comparing the condition ? responseText is already string and also comparing String http://www.google.com/search?q=how+to+compare+strings+in+javahttp://w. .. --- -- TreKinghttp://sites.google.com/site/rezmobileapps/treking - Chicago transit tracking app for Android-powered devices -- Kostya Vasilyev -- WiFi Manager + pretty widget -- http://kmansoft.wordpress.com -- 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