title: How to filter a List of objects in Android
body: <p>I am trying to create an android application (New to it)! </p>
  
  <p>My question is as follows:<br>
  Suppose I am an administrator of a university X.<br>
  I need to put a list of courses each with different points.  </p>
  
  <p>E.g: </p>
  
  <ul>
  <li>Medicine: 30</li>
  <li>Physics: 28</li>
  <li>Maths: 24</li>
  <li>English: 20</li>
  </ul>
  
  <p>Now suppose a student enter the point 28.</p>
  
  <p>My app should be able to detect the course that has 28 points but also that of lower points. That is; Physics, Maths and English BUT NOT Medicine!!!</p>
  
  <p>Can anyone help me on this? I have searched everywhere but no results yet!</p>
  
  <p>Please guys am having a hard time doing this! Thank you!</p>
  
  <p><strong>MainActivity.java</strong></p>
  
  <pre><code>import android.os.Bundle;
  import android.app.Activity;
  import android.view.LayoutInflater; 
  import android.view.View;
  import android.view.ViewGroup;
  import android.widget.AdapterView;
  import android.widget.AdapterView.OnItemClickListener;
  import android.widget.ArrayAdapter;
  import android.widget.EditText;
  import android.widget.ListView;
  
  
   public class MainActivity extends  Activity {
  
  
    String[] courses = new String[]{
  
          "Mathematics",
          "Chemical Engineering",
          "Civil Engineering",
          "Agriculture",
          "Law and Management",
          "Sociology",
          "Information and Communication Technologies",
          "Computer Science",
          "Information Systems",
          "Software Engineering",
  
  
  };
  
    @Override
    public void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);
      setContentView(R.layout.event2icon);
      EditText editText = null;
      editText=(EditText)findViewById(R.id.edit_text);
      final String point=editText.getText().toString();
      final int point_integer=Integer.parseInt(point);
  
  
      final ListView courselist = (ListView)findViewById(R.id.courseNames);
  
  
      LayoutInflater inflater = getLayoutInflater();
      ViewGroup header = (ViewGroup)inflater.inflate(R.layout.listviewheader,  courselist, false);
      courselist.addHeaderView(header, null, false);
  
  
      final ArrayAdapter&lt;String&gt; adapter = new ArrayAdapter&lt;String&gt;(this,  android.R.layout.simple_list_item_1, courses);
      courselist.setAdapter(adapter);
      courselist.setOnItemClickListener(new OnItemClickListener(){
  
          @Override
          public void onItemClick(AdapterView&lt;?&gt; parent, View view, int   position, long id) {
              // TODO Auto-generated method stub
  
              //we use the items of the listview as title of the next activity
              if((Integer.parseInt(String.valueOf(point_integer))&lt;=10))
              {
  
  
              }
          }
  
        });
  
    }
   }
  </code></pre>
  
  <hr>
  
  <p><strong>event2icon.xml</strong></p>
  
  <pre><code> &lt;?xml version="1.0" encoding="utf-8"?&gt;
   &lt;LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
  android:orientation="vertical" android:layout_width="match_parent"
  android:layout_height="match_parent"&gt;
  
      &lt;EditText
      android:layout_width="wrap_content"
      android:layout_height="wrap_content"
      android:id="@+id/edit_text"
      android:text="Enter your points:"/&gt;
       &lt;ListView
      android:id="@+id/courseNames"
      android:layout_width="match_parent"
      android:layout_below="@+id/edit_text"
      android:layout_height="wrap_content"
      android:layout_alignParentLeft="true"
      android:dividerHeight="15.0sp"
          &gt;
     &lt;/ListView&gt;
  
  
    &lt;/LinearLayout&gt;
  </code></pre>
  
  <hr>
  
  <p><strong>listviewheader.xml</strong></p>
  
  <pre><code>&lt;LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
  android:layout_width="match_parent"
  android:layout_height="match_parent"
  android:orientation="vertical"
  &gt;
  
  
  &lt;/LinearLayout&gt;
  </code></pre>