How to I put the condition together

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() {
  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));
      } catch (ClassNotFoundException e) {
        Log.e(TAG, "Finding class by name failed", e);

Let’s continue this discussion in the original topic:

Just keep posting in the original thread, please. No need to create new topics as long as we continue working through the same problem.