second day in android self teachin and saw this code bleow. from what I understood, it seems to me that the code is getting the button value
final Button GetServerData = (Button) findViewById(R.id.GetServerData);
and then I am not sure what happened. Being from php background this syntax looks very unfamiliar that a method is being called as a methods parameter in here
GetServerData.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View arg0) {
// WebServer Request URL
String serverURL = "http://androidexample.com/media/webservice/JsonReturn.php";
// Use AsyncTask execute Method To Prevent ANR Problem
new LongOperation().execute(serverURL);
}
});
I also am not sure what View arg0 is.
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.rest_ful_webservice);
final Button GetServerData = (Button) findViewById(R.id.GetServerData);
GetServerData.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View arg0) {
// WebServer Request URL
String serverURL = "http://androidexample.com/media/webservice/JsonReturn.php";
// Use AsyncTask execute Method To Prevent ANR Problem
new LongOperation().execute(serverURL);
}
});
}