ช่วยแก้โค้ด List View ทีครับเพราะเวลาเลือกแล้วข้อมูลไม่ตรงกับที่เลือกครับ

import java.util.ArrayList;
import java.util.HashMap;
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.text.Editable;
import android.text.TextWatcher;
import android.view.View;
import android.view.Window;
import android.widget.AdapterView;
import android.widget.AdapterView.OnItemClickListener;
import android.widget.ArrayAdapter;
import android.widget.EditText;
import android.widget.ListView;

public class Page_Select_Symptom extends Activity {
    
    private ListView listSelect;    
    EditText editTextSearch;
    ArrayAdapter<String> adapter;
        ArrayList<HashMap<String, String>> DataList;

    
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        requestWindowFeature(Window.FEATURE_NO_TITLE);
        setContentView(R.layout.page_select_symptom);
        
            ///////////////////////////////////  Data ListMenu
        String data[] = {"กระจกบังลมแตก","เกียร์เข้าไม่ได้","เกียร์หลุด","แก๊สหมดเร็วกว่าปกติ (รถยนต์ติดแก๊ส)","คลัตช์มีเสียงดัง","คลัตช์ลื่น","เครื่องยนต์ดับ (รถยนต์ติดแก๊ส)","เครื่องยนต์ร้อนจัด","เครื่องยนต์เร่งไม่ขึ้น (รถยนต์ติดแก๊ส)","เครื่องยนต์สะดุด (รถยนต์ติดแก๊ส)","เครื่องยนต์เสียงดังผิดปกติ","เติมแก๊สไม่เข้าถัง (รถยนต์ติดแก๊ส)","เบรคติด","เบรกแตก","เบรคมีเสียงดัง","เบรคมือใช้การไม่ได้","เบรคสั่น","พวงมาลัยสั่น","พวงมาลัยหนัก","พวงมาลัยหลวม","ไฟไม่ติด","มีกลิ่นแก๊สบริเวณรถยนต์ (รถยนต์ติดแก๊ส)","ยางแตก","ยางบวมล่อน","ล้อหลุด","สตาร์ทไม่ติด","หม้อต้มแก๊สมีเสียงดัง (รถยนต์ติดแก๊ส)","แอร์ไม่เย็น"};
        
            
          
                
      
         listSelect = (ListView)findViewById(R.id.listSelect);
         editTextSearch = (EditText)findViewById(R.id.editTextSearch);
         listSelect.setAdapter(new ArrayAdapter(this
                    , android.R.layout.simple_list_item_1, data));
        
        
         ////////////////////////////////////////////// SearchMenu
         adapter = new ArrayAdapter<String>ร้องไห้this, R.layout.list_item, R.id.product_name, data);
         listSelect.setAdapter(adapter);
         editTextSearch.addTextChangedListener(new TextWatcher() {
             public void onTextChanged(CharSequence cs, int arg1, int arg2, int arg3) {
                            Page_Select_Symptom.this.adapter.getFilter().filter(cs);  
                }
                
             public void beforeTextChanged(CharSequence arg0, int arg1, int arg2,
                        int arg3) {
                                        
                }
                
                @Override
                public void afterTextChanged(Editable arg0) {
                                    
                }
                
            });
        
        

         ////////////////////////////////////// เลือกอาการจาก Data ListMenu
          listSelect.setOnItemClickListener(new OnItemClickListener() {
                public void onItemClick(AdapterView<?>parent, View view, int position, long id) {
                    Intent intent;
                    switch(position) {
                        case 0 :
                            intent = new Intent(getApplicationContext(), S1001.class);
                            startActivity(intent);
                            break;
                        case 1 :
                            intent = new Intent(getApplicationContext(), S1002.class);
                            startActivity(intent);
                            break;
                        case 2 :
                            intent = new Intent(getApplicationContext(),S1003.class);
                            startActivity(intent);
                            break;
                        case 3 :
                            intent = new Intent(getApplicationContext(),S1004.class);
                            startActivity(intent);
                            break;
                        case 4 :
                            intent = new Intent(getApplicationContext(),S1005.class);
                            startActivity(intent);
                            break;
                        case 5 :
                            intent = new Intent(getApplicationContext(),S1006.class);
                            startActivity(intent);
                            break;
                        case 6 :
                            intent = new Intent(getApplicationContext(),S1007.class);
                            startActivity(intent);
                            break;
                        case 7 :
                            intent = new Intent(getApplicationContext(),S1008.class);
                            startActivity(intent);
                            break;
                        case 8 :
                            intent = new Intent(getApplicationContext(),S1009.class);
                            startActivity(intent);
                            break;
                        case 9 :
                            intent = new Intent(getApplicationContext(),S1010.class);
                            startActivity(intent);
                            break;
                        case 10 :
                            intent = new Intent(getApplicationContext(),S1011.class);
                            startActivity(intent);
                            break;
                        case 11 :
                            intent = new Intent(getApplicationContext(),S1012.class);
                            startActivity(intent);
                            break;
                        case 12 :
                            intent = new Intent(getApplicationContext(),S1013.class);
                            startActivity(intent);
                            break;
                        case 13 :
                            intent = new Intent(getApplicationContext(),S1014.class);
                            startActivity(intent);
                            break;
                        case 14 :
                            intent = new Intent(getApplicationContext(),S1015.class);
                            startActivity(intent);
                            break;
                        case 15 :
                            intent = new Intent(getApplicationContext(),S1016.class);
                            startActivity(intent);
                            break;
                        case 16 :
                            intent = new Intent(getApplicationContext(),S1017.class);
                            startActivity(intent);
                            break;
                        case 17 :
                            intent = new Intent(getApplicationContext(),S1018.class);
                            startActivity(intent);
                            break;
                        case 18 :
                            intent = new Intent(getApplicationContext(),S1019.class);
                            startActivity(intent);
                            break;
                        case 19 :
                            intent = new Intent(getApplicationContext(),S1020.class);
                            startActivity(intent);
                            break;
                        case 20 :
                            intent = new Intent(getApplicationContext(),S1021.class);
                            startActivity(intent);
                            break;
                        case 21 :
                            intent = new Intent(getApplicationContext(),S1022.class);
                            startActivity(intent);
                            break;
                        case 22 :
                            intent = new Intent(getApplicationContext(),S1023.class);
                            startActivity(intent);
                            break;
                        case 23 :
                            intent = new Intent(getApplicationContext(),S1024.class);
                            startActivity(intent);
                            break;
                        case 24 :
                            intent = new Intent(getApplicationContext(),S1025.class);
                            startActivity(intent);
                            break;
                        case 25 :
                            intent = new Intent(getApplicationContext(),S1026.class);
                            startActivity(intent);
                            break;
                        case 26 :
                            intent = new Intent(getApplicationContext(),S1027.class);
                            startActivity(intent);
                            break;
                        case 27 :
                            intent = new Intent(getApplicationContext(),S1028.class);
                            startActivity(intent);
                            break;
                            
                  }
                }        
                
                  
                public boolean onCreateOptionsMenu(Menu menu) {
                    getMenuInflater().inflate(R.menu.main, menu);
                    return true;  
               }
          });
      
          
    }
แก้ไขข้อความเมื่อ
แสดงความคิดเห็น
โปรดศึกษาและยอมรับนโยบายข้อมูลส่วนบุคคลก่อนเริ่มใช้งาน อ่านเพิ่มเติมได้ที่นี่