Skip to content

Instantly share code, notes, and snippets.

@codeforfun-jp
Last active August 2, 2022 01:58
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save codeforfun-jp/1dae63fe6a171aa06cc05bcf0a37317b to your computer and use it in GitHub Desktop.
Save codeforfun-jp/1dae63fe6a171aa06cc05bcf0a37317b to your computer and use it in GitHub Desktop.
【Java】ListView with two textview 3
public class MainActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
/* 省略 */
// クリックイベント
list.setOnItemClickListener(new AdapterView.OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> adapterView, View view, int i, long l) {
String message = listData.get(i).get("name") + "をクリックしました。";
Toast.makeText(MainActivity.this, message, Toast.LENGTH_SHORT).show();
}
});
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment