title: Is there a way of opening each searchable listview item in a dial pad?
body: <p>im new to android development and i have managed to develop an application with a listview of name, phone number and district, which is searchable and it is working really well. im using positions to click and take me to the dial pad, but the problem is, if an item is searched, it does not mantain its position given to it initially. what i want  when a user searches for a name or district, it opens in the dial pad with a number written there.
  <strong>Here is my contacts.java</strong></p>
  <pre><code>public class Contacts extends AppCompatActivity {
      ListView listView;
      String[] name = {&quot;Achibu john peter - Serere - 0772698033&quot;, &quot;Agaba - Amon - Rukiga - 
       0782090694\n&quot;, &quot;Agaja joseph - kaberamaido - 0775004193/0752451894\n&quot;,}
       ArrayAdapter&lt;String&gt; arrayAdapter;
  
      @Override
      protected void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          setContentView(R.layout.activity_contacts);
  
          Toolbar toolbar = findViewById(R.id.toolbar);
          setSupportActionBar(toolbar);
          getSupportActionBar().setTitle(&quot;DFO Contacts&quot;);
          getSupportActionBar().setDisplayHomeAsUpEnabled(true);
  
          listView = findViewById(R.id.listview);
  
  
          arrayAdapter = new ArrayAdapter&lt;String&gt;(this, android.R.layout.simple_list_item_1, name);
          listView.setAdapter(arrayAdapter);
  
          listView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
              @Override
              public void onItemClick(AdapterView&lt;?&gt; adapterView, View view, int position, long l) {
                  if (position == 0){
                      Intent intent = new Intent(Intent.ACTION_DIAL);
                        intent.setData(Uri.parse(&quot;tel: +256772698033&quot;));
                        startActivity(intent);
                  }
              }
          });
  
  
      }
  
  
  
      @Override
      public boolean onCreateOptionsMenu(Menu menu){
          getMenuInflater().inflate(R.menu.menu, menu);
          MenuItem menuItem = menu.findItem(R.id.action_search);
  
          SearchView searchView = (SearchView) menuItem.getActionView();
          searchView.setQueryHint(&quot;Search for your DFO&quot;);
  
          searchView.setOnQueryTextListener(new SearchView.OnQueryTextListener() {
              @Override
              public boolean onQueryTextSubmit(String query) {
                  return false;
              }
  
              @Override
              public boolean onQueryTextChange(String newText) {
                  arrayAdapter.getFilter().filter(newText);
                  return false;
              }
          });
          return super.onCreateOptionsMenu(menu);
              
  </code></pre>
  <p>and menu.xml</p>
  <pre><code>&lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt;
  &lt;menu xmlns:android=&quot;http://schemas.android.com/apk/res/android&quot;
      xmlns:app=&quot;http://schemas.android.com/apk/res-auto&quot;&gt;
  
      &lt;item
          android:id=&quot;@+id/search_view&quot;
          android:title=&quot;Search&quot;
          app:showAsAction=&quot;always&quot;
          android:icon=&quot;@drawable/ic_search&quot;
          app:actionViewClass=&quot;android.widget.SearchView&quot;
  
          /&gt;
  &lt;/menu&gt;
  </code></pre>
  <p>And the activity_contacts</p>
  <pre><code>&lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt;
  &lt;LinearLayout xmlns:android=&quot;http://schemas.android.com/apk/res/android&quot;
      xmlns:app=&quot;http://schemas.android.com/apk/res-auto&quot;
      xmlns:tools=&quot;http://schemas.android.com/tools&quot;
      android:layout_width=&quot;match_parent&quot;
      android:layout_height=&quot;match_parent&quot;
      android:orientation=&quot;vertical&quot;
      tools:context=&quot;.Contacts&quot;&gt;
  
  
  
      &lt;androidx.appcompat.widget.Toolbar
          android:id=&quot;@+id/toolbar&quot;
          android:layout_width=&quot;match_parent&quot;
          android:layout_height=&quot;wrap_content&quot;
          android:background=&quot;#D4AC0D&quot;
          app:subtitleTextColor=&quot;#0A0A0A&quot;
          app:titleTextColor=&quot;#111111&quot;
           /&gt;
  
      &lt;ListView
          android:id=&quot;@+id/listview&quot;
          android:layout_width=&quot;match_parent&quot;
          android:layout_height=&quot;match_parent&quot;
          android:fontFamily=&quot;@font/poppinsmedium&quot;
          android:textSize=&quot;20sp&quot;
          android:layout_marginLeft=&quot;15dp&quot;
          android:clickable=&quot;true&quot;
          /&gt;
  
  
  &lt;/LinearLayout&gt;
  </code></pre>