What are you doing wrong? Well, that try/catch, for starters. The
answer to your question lies in that exception, which you caught and
discarded without even examining!

Also, you're doing network IO in the UI thread. That will get your
application killed; you shouldn't do anything that can block or is
timeconsuming in the main thread. Use an AsyncTask to do the network
IO, and handle setting the result in the onPostExecute() method.

Actually log the exception, don't just tell the user something broke.
Sophisticated users may even look at the log, but more importantly, it
will help you understand what happened.

And actually catch more specific exceptions, and give a more useful
error message in specific cases (like if you get an
UnknownHostException or NoRouteToHostException, tell the user they
don't seem to have a network connection).

And use the debugger. Either it will answer the question for you far
quicker than posting a message will -- or it will give you enough
information to ask a question that people can answer. Either way,
spending time in the debugger will speed up your efforts AND greatly
speed up your learning.

On Jan 13, 4:34 am, kandroid <mdrezaulho...@gmail.com> wrote:
> Hi
> I am a new bee to the android world. trying to call a .net web service
> from my android app with no luck.
>
> This is my code:
> -------------------------------------------------------
> ...
> public class callWebservice extends Activity {
>     public void call()
>     {
>             try {
> ... a bunch of network IO ...
>             catch (Exception e) {
>                 tv.setText("oooopppss error occured...");
>             }
>     }}
>
> --------------------------------------------------
> after running the code, i see only my error message. which is
> "oooopppss error occured..."
>
> can anybody guide me what i am doing wrong.

-- 
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

Reply via email to