[ask] responsiveness getting data from web service

by Handita Okviyanto » Tue, 05 Apr 2011 00:14:06 GMT


Sponsored Links
 Hey guys
 I wanna ask something about getting data through the web. About
consuming data from webservice. I just newbie in android. I want to
connect my application to json data on the web. I successfully made it
and running it. But the problem is about responsiveness. I using
thread to get data from the server. But when I test using my device it
takes so long and then android automatically show a dialog that my
application is not responding and providing user to close it. It maybe
takes more than 5 seconds to fetch data from the server. I am not
understand intent service yet. Maybe somebody can help me to find out
the problem. Or I make mistake in designing my application..? Please
help me

-- 



[ask] responsiveness getting data from web service

by Handita Okviyanto » Tue, 05 Apr 2011 00:14:20 GMT


 Hey guys
 I wanna ask something about getting data through the web. About
consuming data from webservice. I just newbie in android. I want to
connect my application to json data on the web. I successfully made it
and running it. But the problem is about responsiveness. I using
thread to get data from the server. But when I test using my device it
takes so long and then android automatically show a dialog that my
application is not responding and providing user to close it. It maybe
takes more than 5 seconds to fetch data from the server. I am not
understand intent service yet. Maybe somebody can help me to find out
the problem. Or I make mistake in designing my application..? Please
help me

-- 


Sponsored Links


Re: [ask] responsiveness getting data from web service

by Kostya Vasilyev » Tue, 05 Apr 2011 00:19:28 GMT


 Based on this:

But the problem is about responsiveness. I using
thread to get data from the server. But when I test using my device it
takes so long and then android automatically show a dialog that my
application is not responding and providing user to close it. It maybe
takes more than 5 seconds to fetch data from the server.
<<

you are not using a thread, or not using it correctly. One frequent mistake
is to treat Thread as a Runnable and call "myThread.run()" - this does not
start the thread, but rather executes the thread's worker function right
there. Use myThread.start() to start a thread.

Take a look as Androd's AsyncTask class that makes this type of thing
easier, including updating the UI with progress information, and showing the
data fetched from the net in your UI.

-- Kostya

2011/4/4 Handita Okviyanto <viyanatm...@gmail.com>


-- 



Re: [ask] responsiveness getting data from web service

by Handita Okviyanto » Tue, 05 Apr 2011 00:43:30 GMT


 Oke. I will try it.
Thanks for the response




-- 



Other Threads

1. android keyboard

Is it possible, that you can update the dial pad like the dial pad of
the iphone for the on screen android keyboard

-- 

2. A very strange ServerSocket.accept problem

Hi,

I have asked this question before but no answers, so I post again hope that
someone might help me, thank you.

I'm now facing a very strange server socket problem, I have a server that
will listen on a TCP port, I use the following code to do this work.

public class RequestListenerThread extends Thread {

private final ServerSocket serversocket;

public RequestListenerThread(int port, final String docroot)
throws IOException {
this.serversocket = new ServerSocket(port);
setDaemon(true);
}

public void run() {
Log.v("FE", "SMB Server Listening on port "
+ this.serversocket.getLocalPort());

while (!Thread.interrupted()) {
try {
// Setup incoming client connection
Socket socket = this.serversocket.accept();
Log.v("FE", "Incoming connection from "
+ socket.getInetAddress());
// Start worker thread
Thread t = new WorkerThread(socket);
t.start();
} catch (InterruptedIOException ex) {
break;
} catch (IOException e) {
Log.v("FE", "Network I/O error: "
+ e.getMessage());
break;
}
}
}
    }

My target device is running on Android 1.6 & 2.1

When I run this code, it can start to listen on port but can't accept any
incoming connections. When it runs into serversocket.accept function, it
never return, just like dead lock.

I found that if I establish any connections from my phone to computer, then
my phone could be successfully found that there're incoming connections and
of course, accept them.

In emulator, above code works fine, has no this strange problem.

Is that my phone's bug or I have something wrong in my code?

Thanks a lot!

Alex

-- 

3. Setting an Intent extra value that's an array of String and Integer

4. DFW Developer Group

5. Who recycled My Bitmap?

6. Which Background model to run

7. how can i know that emulator is fully loaded (which display home screen )