2010. 6. 29. 15:20
사용 예
package com.demo.grid;
import android.app.AlertDialog;
import android.content.DialogInterface;
import android.view.View;
import android.widget.AdapterView;
import android.widget.AdapterView.OnItemClickListener;
public class GridViewOnItemClickListener implements OnItemClickListener {
@Override
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
AlertDialog dlg = new AlertDialog.Builder(parent.getContext()).create();
dlg.setTitle("타이틀");
dlg.setMessage(position + " 번째 item 을 선택했습니다.");
dlg.setCancelable(false);
dlg.setButton("OK", new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int whichButton) {
dialog.cancel();
}
});
dlg.show();
}
}
import android.app.AlertDialog;
import android.content.DialogInterface;
import android.view.View;
import android.widget.AdapterView;
import android.widget.AdapterView.OnItemClickListener;
public class GridViewOnItemClickListener implements OnItemClickListener {
@Override
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
AlertDialog dlg = new AlertDialog.Builder(parent.getContext()).create();
dlg.setTitle("타이틀");
dlg.setMessage(position + " 번째 item 을 선택했습니다.");
dlg.setCancelable(false);
dlg.setButton("OK", new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int whichButton) {
dialog.cancel();
}
});
dlg.show();
}
}
'android' 카테고리의 다른 글
[android] - Log 사용하기 (0) | 2010.06.30 |
---|---|
[android] - XML 가지고 놀기 (0) | 2010.06.29 |
[android] - Intent (0) | 2010.06.29 |