Note that there are some explanatory texts on larger screens.

plurals
  1. POListView positioning after filtering
    primarykey
    data
    text
    <p>I have searched but I do not understand the answers, I have a ListView, the filter works but when it filtered result is clicked on, the initial position is what it brings up, opening an unwanted activity. Here is my code</p> <pre><code>public class IndexPageActivity extends Activity implements OnItemClickListener { ListView listView; EditText editTextB; ArrayAdapter&lt;String&gt; adapter1; @Override protected void onCreate(Bundle savedInstanceState) { // TODO Auto-generated method stub super.onCreate(savedInstanceState); setContentView(R.layout.indexpage); listView = (ListView) findViewById(R.id.pageList); editTextB = (EditText) findViewById(R.id.searchB); String[] pages = getResources().getStringArray(R.array.page_data); // Row layout defined by Android: android.R.layout.simple_list_item_1 adapter1 = (new ArrayAdapter&lt;String&gt;(this, android.R.layout.simple_list_item_1, pages)); listView.setAdapter(adapter1); adapter1.notifyDataSetChanged(); listView.setOnItemClickListener(this); editTextB.addTextChangedListener(new TextWatcher() { @Override public void onTextChanged(CharSequence cs, int arg1, int arg2, int arg3) { // When user changed the Text IndexPageActivity.this.adapter1.getFilter().filter(cs); adapter1.notifyDataSetChanged(); } @Override public void beforeTextChanged(CharSequence arg0, int arg1, int arg2, int arg3) { // TODO Auto-generated method stub } @Override public void afterTextChanged(Editable arg0) { // TODO Auto-generated method stub } }); } @Override public void onItemClick(AdapterView&lt;?&gt; arg0, View arg1, int index, long arg3) { // TODO Auto-generated method stub if (index == 0) { Intent i = new Intent(this, WebViewActivity.class); i.putExtra("keyHTML", "file:///android_asset/page1.html"); startActivity(i); } else if (index == 1) { Intent i = new Intent(this, WebViewActivity.class); i.putExtra("keyHTML", "file:///android_asset/page2.html"); startActivity(i); </code></pre> <p>How do I make the filter work with the right string/item when the filter is in the works?</p> <p>Thanks</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload