1

Topic: How to make Runnable c entering parameters String, int?

private static void readMySQL ()
{
Thread threadReadMySQL = new Thread (readMySQL);
threadReadMySQL.setDaemon (true);
threadReadMySQL.start ();
}
private static final Runnable readMySQL = new Runnable () {
@Override
public void run () {
try {
URL url = new URL ("http://..............");
final HttpURLConnection connect = (HttpURLConnection) url.openConnection ();
connect.setRequestMethod ("POST");
........
}
catch (IOException e) {Log.e (LOG, "IOException:" + e.getMessage ());
}
}
};

I tried in private static void readMySQL (String s), but in Runnable, does not climb anywhere String s.
Till now transferred in Runnable to a global variable....

2

Re: How to make Runnable c entering parameters String, int?

Google urgently recommends to refuse from Runnable in favor https://developer.android.com/reference … cTask.html

3

Re: How to make Runnable c entering parameters String, int?

wadman, it is is here better described
[url =] http://startandroid.ru/ru/uroki/vse-uro … rimer.html [/url]
There 5 or 6 lessons on this subject. AsyncTask removes all questions, except:
- AsyncTask can be launched (execute) only once, differently will be exception
I strongly did not dig, but implementation AsyncTask was pleasant.

4

Re: How to make Runnable c entering parameters String, int?

JavaStudent wrote:

- AsyncTask can be launched (execute) only once, differently will be exception

This restriction of a flow as a whole. On each start - a new copy.