# Android - ListActivity : android, ListActivity
```java
package exam.Widget;
import java.util.*;
import android.app.*;
import android.content.*;
import android.os.*;
import android.view.*;
import android.widget.*;
public class ListOnly extends ListActivity {
ArrayList arGeneral;
protected void onCreate(Bundle savedInstanceState){
super.onCreate(savedInstanceState);
arGeneral = new ArrayList();
arGeneral.add("김유신");
arGeneral.add("이순신");
arGeneral.add("강감찬");
arGeneral.add("을지문덕");
ArrayAdapter Adapter;
Adapter = new ArrayAdapter(this, android.R.layout.simple_list_item_1, arGeneral);
setListAdapter(Adapter);
}
public void onListItemClick(ListView list, View view, int position, long id) {
String mes;
mes = "Select Item = " + arGeneral.get(position);
Toast.makeText(ListOnly.this,mes,Toast.LENGTH_SHORT).show();
}
}
```
댓글