Android : Calling an ayncTask and getting static related error

on Friday, March 27, 2015


I am calling php script which accesses my db from an android lass. The class is below;



public class pk_http {

// Progress Dialog
private ProgressDialog qDialog;

// JSON parser class
JSONParser jParser = new JSONParser();

class phpCall extends AsyncTask<String, String, String> {
@Override
protected String doInBackground(String... args) {
// Building Parameters
String url = args[0];
List<NameValuePair> params = new ArrayList<NameValuePair>();
// getting JSON string from URL
JSONObject json = jParser.makeHttpRequest(url, "GET",params);



return null;
}
}


Now when i call that from my calling class (the calling class does not extend Activity btw) this way;



public static ArrayList<String> getLoginTileDataArray(Context c)
{
//CODE STUB: HTTP GET RETURNS THE FOLLOWING STRING
String result = pk_http.phpCall.execute("http://myUrl/phpFile.php");
.
.
.


I have a error pre-compilation that says;



Non-static method 'execute(Params...) cannot be referenced from a static context.



if i remove the 'sttic' no change. Am i calling the async method correctly?


0 comments:

Post a Comment