當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。