Beispiel #1
0
  @Override
  public void onClick(View arg0) {
    // TODO 自動生成されたメソッド・スタブ
    String search = "";
    if (searchText.getText() != null) search = searchText.getText().toString();

    ServerDBHelper server = new ServerDBHelper(this);
    server.getPlanList("list", search, "1");
  }
Beispiel #2
0
  @Override
  public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.kensaku);

    searchText = (TextView) findViewById(R.id.editText1);
    listView = (ListView) findViewById(R.id.listView1);

    // リストデータを詰め込む前にインスタンス生成
    data = new ArrayList<HashMap<String, String>>();

    adapter =
        new SimpleAdapter(
            this,
            data,
            R.layout.newarrivals_row,
            new String[] {"plan_name", "categories"},
            new int[] {R.id.plan_name, R.id.categories});
    listView.setAdapter(adapter);
    listView.setOnItemClickListener(
        new AdapterView.OnItemClickListener() {
          @Override
          public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
            ListView listView = (ListView) parent;
            // クリックされたアイテムを取得します
            HashMap item = (HashMap) listView.getItemAtPosition(position);

            Toast.makeText(
                    getApplicationContext(), item.get("plan_id").toString(), Toast.LENGTH_LONG)
                .show();
          }
        });
    Button searchButton = (Button) findViewById(R.id.button2);
    searchButton.setOnClickListener(this);
    ServerDBHelper server = new ServerDBHelper(this);
    server.getPlanList("list", "", "");

    Button exit = (Button) findViewById(R.id.exitbutton);
    exit.setOnClickListener(
        new View.OnClickListener() {

          public void onClick(View v) {
            finish();
          }
        });
  }