Re: [android-beginners] Re: IllegalArgumentException occurs when passing url to post data ... plz help

2010-03-03 Thread wahib haq
hello ev1. its solved by Url.encode() function. thanks to all !!

On 3/3/10, Walt Armour waltarm...@gmail.com wrote:
 Look at Uri.encode() or Uri.parse()

 http://developer.android.com/intl/de/reference/android/net/Uri.html


 On Tue, Mar 2, 2010 at 22:54, Javadid its.va...@gmail.com wrote:

 hi Wahib,

 What you can do is replace the space character with some valid
 character like %20 or _... I also faced the same problem... Wat i
 did was use urString.replace(' ', '_') this kindof did my job... But
 your case mayb different.. you can try replacing the   character
 with %20 coz spaces aren't valid url parameters... Hope this solves
 ur problem...

 On Mar 3, 9:46 am, wahib wahib.t...@gmail.com wrote:
   hi experts !!
 
  I am stuck with this issue. I am trying to send a string to a url
  which is like 
 http://10.3.12.165/android/geteventlist.php?event_search_string=entered
  by user in a edittext
 
  it works fine if user enters a string without spaces. But as user
  enters a string with spaces this error is posted in the logcat.
 
  java.lang.IllegalArgumentException: Illegal character in query at
  index 71:
 http://10.3.12.165/android/geteventlist.php?event_search_string=Concert
  at LUMS
  E/AndroidRuntime(  271):at
  org.apache.http.client.methods.HttpGet.init(HttpGet.java:75)
  E/AndroidRuntime(  271):at
  com.eventify.app1.listevents.geteventlist_fromDB(listevents.java:121)
  E/AndroidRuntime(  271):at com.eventify.app1.listevents
  $1.onClick(listevents.java:55)
  E/AndroidRuntime(  271):at
  android.view.View.performClick(View.java:
  2344)
  E/AndroidRuntime(  271):at
  android.view.View.onTouchEvent(View.java:
  4133)
  E/AndroidRuntime(  271):at
  android.view.View.dispatchTouchEvent(View.java:3672)
  E/AndroidRuntime(  271):at
  android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:882)
  E/AndroidRuntime(  271):at
  android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:882)
  E/AndroidRuntime(  271):at
  android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:882)
  E/AndroidRuntime(  271):at
  android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:882)
  E/AndroidRuntime(  271):at
  com.android.internal.policy.impl.PhoneWindow
  $DecorView.superDispatchTouchEvent(PhoneWindow.java:1712)
  E/AndroidRuntime(  271):at
 
 com.android.internal.policy.impl.PhoneWindow.superDispatchTouchEvent(PhoneWindow.java:
  1202)
  E/AndroidRuntime(  271):at
  android.app.Activity.dispatchTouchEvent(Activity.java:1987)
  E/AndroidRuntime(  271):at
  com.android.internal.policy.impl.PhoneWindow
  $DecorView.dispatchTouchEvent(PhoneWindow.java:1696)
  E/AndroidRuntime(  271):at
  android.view.ViewRoot.handleMessage(ViewRoot.java:1658)
  E/AndroidRuntime(  271):at
  android.os.Handler.dispatchMessage(Handler.java:99)
  E/AndroidRuntime(  271):at android.os.Looper.loop(Looper.java:
  123)
  E/AndroidRuntime(  271):at
  android.app.ActivityThread.main(ActivityThread.java:4203)
  E/AndroidRuntime(  271):at
  java.lang.reflect.Method.invokeNative(Native Method)
  E/AndroidRuntime(  271):at
  java.lang.reflect.Method.invoke(Method.java:521)
  E/AndroidRuntime(  271):at com.android.internal.os.ZygoteInit
  $MethodAndArgsCaller.run(ZygoteInit.java:791)
  E/AndroidRuntime(  271):at
  com.android.internal.os.ZygoteInit.main(ZygoteInit.java:549)
  E/AndroidRuntime(  271):at
  dalvik.system.NativeStart.main(Native
  Method)
 
  how would i convert the string to a format when it gives no exception.
  The problem is that i have to pass this complete url string with
  variable to HttpGet object like...
   HttpGet request = new HttpGet(url); ///url is of type String
 
  so i have to pass it as a string type only. kindly help me out.
 
  Regards,
  wahib

 --
 You received this message because you are subscribed to the Google
 Groups Android Beginners group.

 NEW! Try asking and tagging your question on Stack Overflow at
 http://stackoverflow.com/questions/tagged/android

 To unsubscribe from this group, send email to
 android-beginners+unsubscr...@googlegroups.comandroid-beginners%2bunsubscr...@googlegroups.com
 For more options, visit this group at
 http://groups.google.com/group/android-beginners?hl=en


 --
 You received this message because you are subscribed to the Google
 Groups Android Beginners group.

 NEW! Try asking and tagging your question on Stack Overflow at
 http://stackoverflow.com/questions/tagged/android

 To unsubscribe from this group, send email to
 android-beginners+unsubscr...@googlegroups.com
 For more options, visit this group at
 http://groups.google.com/group/android-beginners?hl=en



-- 
Wahib-ul-haq

3rd year Communications Engineering Student,
NUST, Pakistan.
Microsoft Student Partner
follow me on twitter @wahibhaq

-- 
You received this message because you are subscribed to the Google
Groups Android 

[android-beginners] Re: IllegalArgumentException occurs when passing url to post data ... plz help

2010-03-02 Thread Javadid
hi Wahib,

What you can do is replace the space character with some valid
character like %20 or _... I also faced the same problem... Wat i
did was use urString.replace(' ', '_') this kindof did my job... But
your case mayb different.. you can try replacing the   character
with %20 coz spaces aren't valid url parameters... Hope this solves
ur problem...

On Mar 3, 9:46 am, wahib wahib.t...@gmail.com wrote:
  hi experts !!

 I am stuck with this issue. I am trying to send a string to a url
 which is like 
 http://10.3.12.165/android/geteventlist.php?event_search_string=entered
 by user in a edittext

 it works fine if user enters a string without spaces. But as user
 enters a string with spaces this error is posted in the logcat.

 java.lang.IllegalArgumentException: Illegal character in query at
 index 
 71:http://10.3.12.165/android/geteventlist.php?event_search_string=Concert
 at LUMS
 E/AndroidRuntime(  271):        at
 org.apache.http.client.methods.HttpGet.init(HttpGet.java:75)
 E/AndroidRuntime(  271):        at
 com.eventify.app1.listevents.geteventlist_fromDB(listevents.java:121)
 E/AndroidRuntime(  271):        at com.eventify.app1.listevents
 $1.onClick(listevents.java:55)
 E/AndroidRuntime(  271):        at
 android.view.View.performClick(View.java:
 2344)
 E/AndroidRuntime(  271):        at
 android.view.View.onTouchEvent(View.java:
 4133)
 E/AndroidRuntime(  271):        at
 android.view.View.dispatchTouchEvent(View.java:3672)
 E/AndroidRuntime(  271):        at
 android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:882)
 E/AndroidRuntime(  271):        at
 android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:882)
 E/AndroidRuntime(  271):        at
 android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:882)
 E/AndroidRuntime(  271):        at
 android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:882)
 E/AndroidRuntime(  271):        at
 com.android.internal.policy.impl.PhoneWindow
 $DecorView.superDispatchTouchEvent(PhoneWindow.java:1712)
 E/AndroidRuntime(  271):        at
 com.android.internal.policy.impl.PhoneWindow.superDispatchTouchEvent(PhoneWindow.java:
 1202)
 E/AndroidRuntime(  271):        at
 android.app.Activity.dispatchTouchEvent(Activity.java:1987)
 E/AndroidRuntime(  271):        at
 com.android.internal.policy.impl.PhoneWindow
 $DecorView.dispatchTouchEvent(PhoneWindow.java:1696)
 E/AndroidRuntime(  271):        at
 android.view.ViewRoot.handleMessage(ViewRoot.java:1658)
 E/AndroidRuntime(  271):        at
 android.os.Handler.dispatchMessage(Handler.java:99)
 E/AndroidRuntime(  271):        at android.os.Looper.loop(Looper.java:
 123)
 E/AndroidRuntime(  271):        at
 android.app.ActivityThread.main(ActivityThread.java:4203)
 E/AndroidRuntime(  271):        at
 java.lang.reflect.Method.invokeNative(Native Method)
 E/AndroidRuntime(  271):        at
 java.lang.reflect.Method.invoke(Method.java:521)
 E/AndroidRuntime(  271):        at com.android.internal.os.ZygoteInit
 $MethodAndArgsCaller.run(ZygoteInit.java:791)
 E/AndroidRuntime(  271):        at
 com.android.internal.os.ZygoteInit.main(ZygoteInit.java:549)
 E/AndroidRuntime(  271):        at
 dalvik.system.NativeStart.main(Native
 Method)

 how would i convert the string to a format when it gives no exception.
 The problem is that i have to pass this complete url string with
 variable to HttpGet object like...
  HttpGet request = new HttpGet(url); ///url is of type String

 so i have to pass it as a string type only. kindly help me out.

 Regards,
 wahib

-- 
You received this message because you are subscribed to the Google
Groups Android Beginners group.

NEW! Try asking and tagging your question on Stack Overflow at
http://stackoverflow.com/questions/tagged/android

To unsubscribe from this group, send email to
android-beginners+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-beginners?hl=en


Re: [android-beginners] Re: IllegalArgumentException occurs when passing url to post data ... plz help

2010-03-02 Thread Walt Armour
Look at Uri.encode() or Uri.parse()

http://developer.android.com/intl/de/reference/android/net/Uri.html


On Tue, Mar 2, 2010 at 22:54, Javadid its.va...@gmail.com wrote:

 hi Wahib,

 What you can do is replace the space character with some valid
 character like %20 or _... I also faced the same problem... Wat i
 did was use urString.replace(' ', '_') this kindof did my job... But
 your case mayb different.. you can try replacing the   character
 with %20 coz spaces aren't valid url parameters... Hope this solves
 ur problem...

 On Mar 3, 9:46 am, wahib wahib.t...@gmail.com wrote:
   hi experts !!
 
  I am stuck with this issue. I am trying to send a string to a url
  which is like 
 http://10.3.12.165/android/geteventlist.php?event_search_string=entered
  by user in a edittext
 
  it works fine if user enters a string without spaces. But as user
  enters a string with spaces this error is posted in the logcat.
 
  java.lang.IllegalArgumentException: Illegal character in query at
  index 71:
 http://10.3.12.165/android/geteventlist.php?event_search_string=Concert
  at LUMS
  E/AndroidRuntime(  271):at
  org.apache.http.client.methods.HttpGet.init(HttpGet.java:75)
  E/AndroidRuntime(  271):at
  com.eventify.app1.listevents.geteventlist_fromDB(listevents.java:121)
  E/AndroidRuntime(  271):at com.eventify.app1.listevents
  $1.onClick(listevents.java:55)
  E/AndroidRuntime(  271):at
  android.view.View.performClick(View.java:
  2344)
  E/AndroidRuntime(  271):at
  android.view.View.onTouchEvent(View.java:
  4133)
  E/AndroidRuntime(  271):at
  android.view.View.dispatchTouchEvent(View.java:3672)
  E/AndroidRuntime(  271):at
  android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:882)
  E/AndroidRuntime(  271):at
  android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:882)
  E/AndroidRuntime(  271):at
  android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:882)
  E/AndroidRuntime(  271):at
  android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:882)
  E/AndroidRuntime(  271):at
  com.android.internal.policy.impl.PhoneWindow
  $DecorView.superDispatchTouchEvent(PhoneWindow.java:1712)
  E/AndroidRuntime(  271):at
 
 com.android.internal.policy.impl.PhoneWindow.superDispatchTouchEvent(PhoneWindow.java:
  1202)
  E/AndroidRuntime(  271):at
  android.app.Activity.dispatchTouchEvent(Activity.java:1987)
  E/AndroidRuntime(  271):at
  com.android.internal.policy.impl.PhoneWindow
  $DecorView.dispatchTouchEvent(PhoneWindow.java:1696)
  E/AndroidRuntime(  271):at
  android.view.ViewRoot.handleMessage(ViewRoot.java:1658)
  E/AndroidRuntime(  271):at
  android.os.Handler.dispatchMessage(Handler.java:99)
  E/AndroidRuntime(  271):at android.os.Looper.loop(Looper.java:
  123)
  E/AndroidRuntime(  271):at
  android.app.ActivityThread.main(ActivityThread.java:4203)
  E/AndroidRuntime(  271):at
  java.lang.reflect.Method.invokeNative(Native Method)
  E/AndroidRuntime(  271):at
  java.lang.reflect.Method.invoke(Method.java:521)
  E/AndroidRuntime(  271):at com.android.internal.os.ZygoteInit
  $MethodAndArgsCaller.run(ZygoteInit.java:791)
  E/AndroidRuntime(  271):at
  com.android.internal.os.ZygoteInit.main(ZygoteInit.java:549)
  E/AndroidRuntime(  271):at
  dalvik.system.NativeStart.main(Native
  Method)
 
  how would i convert the string to a format when it gives no exception.
  The problem is that i have to pass this complete url string with
  variable to HttpGet object like...
   HttpGet request = new HttpGet(url); ///url is of type String
 
  so i have to pass it as a string type only. kindly help me out.
 
  Regards,
  wahib

 --
 You received this message because you are subscribed to the Google
 Groups Android Beginners group.

 NEW! Try asking and tagging your question on Stack Overflow at
 http://stackoverflow.com/questions/tagged/android

 To unsubscribe from this group, send email to
 android-beginners+unsubscr...@googlegroups.comandroid-beginners%2bunsubscr...@googlegroups.com
 For more options, visit this group at
 http://groups.google.com/group/android-beginners?hl=en


-- 
You received this message because you are subscribed to the Google
Groups Android Beginners group.

NEW! Try asking and tagging your question on Stack Overflow at
http://stackoverflow.com/questions/tagged/android

To unsubscribe from this group, send email to
android-beginners+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-beginners?hl=en