Hi I was wondering how do I combine this three condition into one?
How do I put the 2 codes I have put below together, if not is there any alternatives
Upon detecting motion or upon click, it can go to the next activity to display the information
private void updateCurrentNearable(List<Nearable> nearables) {
for (Nearable nearable : nearables) {
if (nearable.equals(currentNearable) || nearable.isMoving)
{
currentNearable = nearable;
}
}
}
private AdapterView.OnItemClickListener createOnItemClickListener() {
return new AdapterView.OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
if (getIntent().getStringExtra(EXTRAS_TARGET_ACTIVITY) != null) {
try {
Class<?> clazz = Class.forName(getIntent().getStringExtra(EXTRAS_TARGET_ACTIVITY));
Intent intent = new Intent(ListNearablesActivity.this, clazz);
intent.putExtra(EXTRAS_NEARABLE, adapter.getItem(position));
startActivity(intent);
} catch (ClassNotFoundException e) {
Log.e(TAG, "Finding class by name failed", e);
}
}
}
};
}