This is a part of android app project, i have got this code I am not able to understand that setOnItemClickListener takes (AdapterView.OnItemClickListener listener) as paramter but the other method void onItemClick is also in paramter space . I am not able to understand that how the object of AdapterView.OnItemClickListener() is calling/using onItemClick ? listView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> adapterView, View view, int position, long l) {
String forecast = mForecastAdapter.getItem(position);
Intent intent = new Intent(getActivity(), MainActivity2Activity.class)
.putExtra(Intent.EXTRA_TEXT, forecast);
startActivity(intent);
}
})
Aucun commentaire:
Enregistrer un commentaire