当前位置: 首页>>代码示例>>Java>>正文


Java AdapterView.getItemAtPosition方法代码示例

本文整理汇总了Java中android.widget.AdapterView.getItemAtPosition方法的典型用法代码示例。如果您正苦于以下问题:Java AdapterView.getItemAtPosition方法的具体用法?Java AdapterView.getItemAtPosition怎么用?Java AdapterView.getItemAtPosition使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在android.widget.AdapterView的用法示例。


在下文中一共展示了AdapterView.getItemAtPosition方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: onItemClick

import android.widget.AdapterView; //导入方法依赖的package包/类
@Override
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
    DataEntity dataEntity = (DataEntity) parent.getItemAtPosition(position);
    // 如果dataEntity的子元素不为空
    if (dataEntity.dataEntities != null && dataEntity.dataEntities.size() > 0) {
        // 添加导航栏的子元素,没有缓存数据
        mNavBarView.addNavEntityNoCache(dataEntity.dataId, dataEntity.dataName);
        // 请求数据,刷新dataList
        mDataAdapter.setData(dataEntity.dataEntities);
    } else {
        // 如果dataEntity的子元素为空
        Toast.makeText(this, dataEntity.dataName, Toast.LENGTH_SHORT).show();
    }
}
 
开发者ID:kevinbobby,项目名称:NavigatorBar,代码行数:15,代码来源:NoCacheActivity.java

示例2: onItemClick

import android.widget.AdapterView; //导入方法依赖的package包/类
public void onItemClick(AdapterView<?> parent, View v, int position, long id)
{
    Cursor c = (Cursor)parent.getItemAtPosition(position);
    Intent i = new Intent(ManageActivity.this, EditActivity.class);
    i.putExtra("activityID", c.getInt(c.getColumnIndex(ActivityDiaryContract.DiaryActivity._ID)));
    startActivity(i);
}
 
开发者ID:ramack,项目名称:ActivityDiary,代码行数:8,代码来源:ManageActivity.java

示例3: onItemClick

import android.widget.AdapterView; //导入方法依赖的package包/类
@Override
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
    Object selectObject = parent.getItemAtPosition(position);
    if (selectObject instanceof Friend) {
        Friend friend = (Friend) selectObject;
        if (!TextUtils.isEmpty(friend.getDisplayName())) {
            RongIM.getInstance().startPrivateChat(SealSearchMoreFriendsActivity.this, friend.getUserId(), friend.getDisplayName());
        } else {
            RongIM.getInstance().startPrivateChat(SealSearchMoreFriendsActivity.this, friend.getUserId(), friend.getName());
        }
    }
}
 
开发者ID:zqHero,项目名称:rongyunDemo,代码行数:13,代码来源:SealSearchMoreFriendsActivity.java

示例4: onItemClick

import android.widget.AdapterView; //导入方法依赖的package包/类
@Override
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
    String item = (String)parent.getItemAtPosition(position);

    Toast.makeText(EmailAddressList.this, item, Toast.LENGTH_LONG).show();

    Intent intent = new Intent();
    intent.putExtra(EXTRA_EMAIL_ADDRESS, item);
    setResult(RESULT_OK, intent);
    finish();
}
 
开发者ID:philipwhiuk,项目名称:q-mail,代码行数:12,代码来源:EmailAddressList.java

示例5: onItemClick

import android.widget.AdapterView; //导入方法依赖的package包/类
@Override
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
    IIconCheckListAdapterItem item = 
            (IIconCheckListAdapterItem) parent.getItemAtPosition(position);
    item.setChecked(!item.isChecked());
    mListView.invalidateViews();
}
 
开发者ID:WrBug,项目名称:GravityBox,代码行数:8,代码来源:OngoingNotifPreference.java

示例6: onItemClick

import android.widget.AdapterView; //导入方法依赖的package包/类
@Override
public void onItemClick(AdapterView<?> parent, View view,
                        int position, long id)
{
    // An item was selected. You can retrieve the selected item
    // using parent.getItemAtPosition(pos)
    // Check id
    switch (parent.getId())
    {
    case R.id.list:
        String word = (String)parent.getItemAtPosition(position);
        String s = word.toUpperCase(Locale.getDefault());

        // Fill the letters in the slots and temporarily remove
        // the text change listener to stop unexpected
        // consequences
        for (int i = 0; i < length; i++)
        {
            TextView text = (TextView)letters.getChildAt(i);
            text.removeTextChangedListener(this);
            text.setText(s.substring(i, i + 1));
            text.addTextChangedListener(this);
        }

        // Start the web search
        Intent intent = new Intent(this, SearchActivity.class);
        intent.putExtra(WORD, word);
        startActivity(intent);
    }
}
 
开发者ID:billthefarmer,项目名称:crossword,代码行数:31,代码来源:Main.java

示例7: onItemClick

import android.widget.AdapterView; //导入方法依赖的package包/类
@Override
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
    NetworkModeItem item = (NetworkModeItem) parent.getItemAtPosition(position);
    final int networkMode = item.getNetworkMode();
    setValue(networkMode);
    setSummary(getSummaryFromValue(networkMode));
    getDialog().dismiss();
}
 
开发者ID:WrBug,项目名称:GravityBox,代码行数:9,代码来源:NetworkModePreference.java

示例8: onItemClick

import android.widget.AdapterView; //导入方法依赖的package包/类
@Override
public void onItemClick(AdapterView<?> parent, View view, int position, long id)
{
	Genre genre = (Genre) parent.getItemAtPosition(position);

	if (genre != null)
	{
		Intent intent = new Intent(this, SelectAlbumActivity.class);
		intent.putExtra(Constants.INTENT_EXTRA_NAME_GENRE_NAME, genre.getName());
		intent.putExtra(Constants.INTENT_EXTRA_NAME_ALBUM_LIST_SIZE, Util.getMaxSongs(this));
		intent.putExtra(Constants.INTENT_EXTRA_NAME_ALBUM_LIST_OFFSET, 0);
		startActivityForResultWithoutTransition(this, intent);
	}
}
 
开发者ID:ultrasonic,项目名称:ultrasonic,代码行数:15,代码来源:SelectGenreActivity.java

示例9: onItemSelected

import android.widget.AdapterView; //导入方法依赖的package包/类
@Override
public void onItemSelected(final AdapterView<?> parent, final View view, final int pos,
        final long id) {
    final LocaleRenderer locale = (LocaleRenderer)parent.getItemAtPosition(pos);
    if (locale.isMoreLanguages()) {
        PreferenceActivity preferenceActivity = (PreferenceActivity)getActivity();
        preferenceActivity.startPreferenceFragment(new UserDictionaryLocalePicker(), true);
    } else {
        mContents.updateLocale(locale.getLocaleString());
    }
}
 
开发者ID:sergeychilingaryan,项目名称:AOSP-Kayboard-7.1.2,代码行数:12,代码来源:UserDictionaryAddWordFragment.java

示例10: onItemClick

import android.widget.AdapterView; //导入方法依赖的package包/类
@Override
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
    CommonListItem item = (CommonListItem) parent.getItemAtPosition(position);
    Intent intent = new Intent(mContext,SubjectActivity.class);
    intent.putExtra("item",item);
    startActivity(intent);
}
 
开发者ID:SavorGit,项目名称:Hotspot-master-devp,代码行数:8,代码来源:SubjectActivity.java

示例11: onItemClick

import android.widget.AdapterView; //导入方法依赖的package包/类
@Override
public void onItemClick(AdapterView<?> adapter, View view, int position, long id) {
    if (mItemListener != null) {
        Object item = adapter.getItemAtPosition(position);
        mItemListener.onMenuItemClick(position, item);
    }
}
 
开发者ID:suomenriistakeskus,项目名称:oma-riista-android,代码行数:8,代码来源:SlideMenu.java

示例12: onItemClick

import android.widget.AdapterView; //导入方法依赖的package包/类
@Override
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
    Cursor c = (Cursor) parent.getItemAtPosition(position);
    String groupId = c.getString(c.getColumnIndexOrThrow("_id"));
    String groupName = c.getString(c.getColumnIndexOrThrow("title"));
    Intent intent = new Intent(getApplicationContext(), AllArticlesListViewActivity.class);
    intent.putExtra("group_id", Long.parseLong(groupId));
    intent.putExtra("group_name", groupName);
    startActivity(intent);
}
 
开发者ID:white-collar,项目名称:mobile-grammar,代码行数:11,代码来源:UserGroupLessonsActivity.java

示例13: onItemSelected

import android.widget.AdapterView; //导入方法依赖的package包/类
@Override
public void onItemSelected(AdapterView<?> arg0, View arg1, int arg2, long arg3) {
    // TODO Auto-generated method stub

    //Currency Format
    NumberFormat formatter = NumberFormat.getCurrencyInstance();

    if (arg0.getId() == R.id.book_spinner) {
        //Save the choice as a string
        Object item = arg0.getItemAtPosition(arg2);
        String title = item.toString();

        //Loop through the available books list to see if the title matches
        for(int i=0; i<availableBooks.size(); i++){
            //if it matches change the text of the details
            if(availableBooks.get(i).getTitle().equals(title)){
                TextView main = (TextView) findViewById(R.id.main);

                main.setText("");

                main.append("Title: " + availableBooks.get(i).getTitle() + "\n");
                main.append("Author: " + availableBooks.get(i).getAuthor() + "\n");
                main.append("ISBN: " + availableBooks.get(i).getIsbn() + "\n");
                main.append("Cost Per Hour: " + formatter.format(availableBooks.get(i).getPrice()));
                cost = availableBooks.get(i).getPrice();

            }
        }


        //get the book in the array with this Title
    }

}
 
开发者ID:Mikerr1111,项目名称:Library-System-Android,代码行数:35,代码来源:BookResults.java

示例14: onItemClick

import android.widget.AdapterView; //导入方法依赖的package包/类
@Override
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {

    //Get the device MAC address , the last 17 char in the view
    String info = (String) parent.getItemAtPosition(position);
    String MACAddress = info.substring(info.length() - 17);

    // Create the result Intent and include the MAC address
    Intent intent = new Intent();
    intent.putExtra(BluetoothStates.EXTRA_DEVICE_ADDRESS, MACAddress);

    // Set result and finish this Activity
    setResult(Activity.RESULT_OK, intent);
    finish();
}
 
开发者ID:Ahmed-Abdelmeged,项目名称:Android-BluetoothMCLibrary,代码行数:16,代码来源:BluetoothDevices.java

示例15: onItemClick

import android.widget.AdapterView; //导入方法依赖的package包/类
@Override
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
    Ringer r = (Ringer) parent.getItemAtPosition(position);
    setRingerMode(r.mRingerMode, r.mVibrateWhenRinging);
}
 
开发者ID:WrBug,项目名称:GravityBox,代码行数:6,代码来源:RingerModeTile.java


注:本文中的android.widget.AdapterView.getItemAtPosition方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。