Hello I'm working with android android and doing some task in a async task. I want to call the async task and pass on string as a parameter. I've search google but with no luck, here is my code to call the async task
new warkah_detail().execute(id_warkah);
and here is my async task
class warkah_detail extends AsyncTask<String, String, String>
{
@Override
protected void onPreExecute()
{
pDialog = new ProgressDialog(warkah.this);
pDialog.setMessage("Fetching Details...");
pDialog.setIndeterminate(false);
pDialog.setCancelable(false);
pDialog.show();
}
@Override
protected String doInBackground(String... args)
{
try
{
List<NameValuePair> params = new ArrayList<NameValuePair>();
params.add(new BasicNameValuePair("id_warkah", id_warkah));
json = jParser.makeHttpRequest(url_warkah, "POST", params);
Those code raise an error like this Caused by: java.lang.RuntimeException: Can't create handler inside thread that has not called Looper.prepare()
What is the best way to pass string to async task? I will appreciate any help. Thanks.
[UPDATE] I had removed the toast, but I still not receive the correct string that pass to async task from the called. Any idea?