' + grSpan); lc_cat_dep++; lc_cat_outputTrees(sChild, l_defs); lc_cat_dep--; document.write(''); } } } function lc_cat_createMainLink(l_grTitle, l_grCap, l_boxStr) { //Script by http://lctree.blog26.fc2.com/ var grIconId = 'lc_cat_box_' + lc_cat_pCnt; var hsFunc = 'lc_cat_HideAndShow(\'' + lc_cat_pCnt + '\'); return false;'; var linkSt = ''; if (LC_CAT_PARENTBOLD) { linkSt += 'font-weight:bold;'; } if (LC_CAT_DECOLESS_PARENT) { linkSt += 'text-decoration:none;'; } var ret = '' + l_boxStr + ''; var sIcon = lc_cat_iconList[l_grCap]; if (!sIcon) { sIcon = lc_cat_iconList['<�e' + lc_cat_dep + '>']; } if (!sIcon) { sIcon = lc_cat_iconList['<�e>']; } if (sIcon) { ret += ''; } var sText = lc_cat_aliasList[l_grCap]; if (!sText) { sText = l_grCap; } ret += sText + ''; return ret; } function lc_cat_outputLeaf(l_obj, l_treeMark) { //Script by http://lctree.blog26.fc2.com/ var sHref = l_obj.href; var sCount = l_obj.count; var sName = l_obj.name; var sNo = l_obj.no; var treeP = '
'; if (lc_cat_dep != 0) { treeP += lc_cat_indent(lc_cat_dep - 1, false); if (LC_CAT_CLASS) { treeP += '' + l_treeMark + ''; } else { treeP += l_treeMark; } } var sText = lc_cat_aliasList[sName]; if (!sText) { sText = lc_cat_aliasList[sHref]; } if (!sText) { sText = sName; } var sTitle = lc_cat_titleList[sName]; if (!sTitle) { sTitle = lc_cat_titleList[sHref]; } if (sTitle) { sTitle = '\n' + sTitle; } else { sTitle = ''; } var sIcon = lc_cat_iconList[sName]; if (!sIcon) { sIcon = lc_cat_iconList[sHref]; } if (!sIcon) { sIcon = lc_cat_iconList['<�q' + lc_cat_dep + '>']; } if (!sIcon) { sIcon = lc_cat_iconList['<�q>']; } if (sIcon) { sIcon = ''; } else { if (LC_CAT_CLASS) { sIcon = '' + LC_CAT_CATEGORY_MARK + ''; } else { sIcon = LC_CAT_CATEGORY_MARK; } } var spanP = '' + sIcon + ''; var linkSt = ''; if (LC_CAT_DYNAMIC_SIZE) { var fsize = 68 + (64 * sCount / lc_cat_maxNum); linkSt += 'font-size:' + fsize + '%;'; } if (LC_CAT_DECOLESS_CHILD) { linkSt += 'text-decoration:none;'; } var linkP = '' + spanP + '' + sText + ''; } else { linkP += '">' + spanP + sText; } if (LC_CAT_DISPLAYNUM) { if (LC_CAT_CLASS) { linkP += ' (' + sCount + ')'; } else { linkP += ' (' + sCount + ')'; } } linkP += ''; document.write(treeP + linkP + '
'); } //-->
�J�e�S��
Script by Lc-Factory
(�ڍ�:Lc-Factory/�G�L)
(Seesaa��:Lc-Factory��Seesaa�u���O)
' + linkText + ''; linkCount = '' + linkCount + ''; } else { linkText = LC_CAT_CATEGORY_MARK + linkText; } document.write('' + linkText + linkCount + ''); } } //-->
�X�|���T�[�h�����N
<< 2012�N09�� >>
�� �� �� �� �� �� �y
            1
2 3 4 5 6 7 8
9 10 11 12 13 14 15
16 17 18 19 20 21 22
23 24 25 26 27 28 29
30            
br_c_1004_1.gif.png
Android �u���O�����L���O��
�ŋ߂̃R�����g
�ߋ����O
2012�N09��(1)
2012�N07��(4)
2012�N06��(4)
2012�N05��(15)
2012�N04��(13)
2012�N03��(28)
2012�N02��(13)
2012�N01��(10)
2011�N12��(5)
2011�N11��(10)
RDF Site Summary
RSS 2.0
�t�@��
 ���b�Z�[�W�𑗂�
 ���̃u���O�̓ǎ҂ɂȂ�
 �X�V�����`�F�b�N����
 �u�b�N�}�[�N����
 �F�B�ɋ�����
�v���t�B�[��
���O:kenken
����:�v�̕�
����:�Ђ̂��̖_
Lv:13
�E��:���l�ɂȂ肽��
���S�҂̂��߂��w�E�����}�ł�

�܂�����������󂯕t���Ă���܂�
2012�N04��26��

onItemClick�̈���


�O��A���X�g�r���[�̃C�x���g�擾�ɂ�����
setOnItemClickListener��setOnItemSelectedListene���g�p���܂���

ListView�̃N���b�N
�w�肵�����X�g�r���[��item���擾����̂�onItemClick���g�p����Ă��܂�
����͂���onItemClick�����������ڂ������Ă��������Ǝv���܂�

onItemClick(AdapterView parent, View view,int position, long id)
parent�F�N���b�N���ꂽAdapter�̃r���[�ƂȂ�
view�F���ۂɃN���b�N���ꂽ�r���[
position�F�A�_�v�^�[�̉��Ԗڂ��N���b�N���ꂽ��
id�F�N���b�N���ꂽ���id

�O��̃v���O�������ȉ��̂悤�ɕύX���ĉ����擾����Ă���̂����ڂ����������Ǝv���܂�
MainActivity.java
package blog.test;
 
import android.app.Activity;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.widget.AdapterView;
import android.widget.ArrayAdapter;
import android.widget.ListView;
 
public class MainActivity extends Activity {

    private String[] mStrings ={ "test1", "test2", "test3", "test4" };
    
 
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        //���X�g�r���[���쐬 
        ListView lv = new ListView(this);
        setContentView(lv);

        ArrayAdapter adapter = new ArrayAdapter(this,
                android.R.layout.simple_list_item_1, mStrings);
        lv.setAdapter(adapter);
 
        //�N���b�N�C�x���g�����o
        lv.setOnItemClickListener(new AdapterView.OnItemClickListener() {
            public void onItemClick(AdapterView parent, View view,
                    int position, long id) {
            	//listView���w��
                //ListView listView = (ListView) parent;
                //�N���b�N���ꂽ���̂��擾
                String get_parent = (String) parent.getClass().getSimpleName();
                String get_position = String.valueOf(position);
                String get_id = String.valueOf(id);
                //Log�o��
                Log.v("tag", String.format("onItemClick: %s", get_parent));
                Log.v("tag", String.format("onItemClick: %s", get_position));
                Log.v("tag", String.format("onItemClick: %s", get_id));
            }
        });
        
        //�Z���N�g���ꂽ�Ƃ��Ɏ��s�����
        lv.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
            public void onItemSelected(AdapterView parent, View view,
                    int position, long id) {
            	//listView���w��
                //ListView listView = (ListView) parent;
                //�N���b�N���ꂽ���̂��擾
                String get_parent = (String) parent.getClass().getSimpleName();
                String get_position = String.valueOf(position);
                String get_id = String.valueOf(id);
                //Log�o��
                Log.v("tag", String.format("onItemClick: %s", get_parent));
                Log.v("tag", String.format("onItemClick: %s", get_position));
                Log.v("tag", String.format("onItemClick: %s", get_id));
            }
            //�����I�����ĂȂ��Ƃ��Ɏ��s
            public void onNothingSelected(AdapterView parent) {
                Log.v("tag", "onNothingSelected");
            }
        });
    }
}

���߂���test1���N���b�N���Ă݂�ƁE�E�E
device97.png
parent��ListView���Aposition��0���i1�Ԗ�-1�j�Aid��0���i1�Ԗ�-1�j��
���ꂼ��Log�Ƃ��ďo�͂���܂�

���l�ɉ��{�^����test1���Z���N�g�����
device95.png

device98.png
����������l��parent��ListView���Aposition��0���i1�Ԗ�-1�j�Aid��0���i1�Ԗ�-1�j��
Log�Ƃ��ďo�͂���܂�

�X�|���T�[�h�����N

���̋L���ւ̃R�����g
�R�����g������
�����O:

���[���A�h���X:

�z�[���y�[�W�A�h���X:

�R�����g:

�F�؃R�[�h: [�K�{����]


���摜�̒��̕����𔼊p�œ��͂��Ă��������B
���u���O�I�[�i�[�����F�����R�����g�̂ݕ\������܂��B

���̋L���ւ̃g���b�N�o�b�N