本文整理匯總了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();
}
}
示例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);
}
示例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());
}
}
}
示例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();
}
示例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();
}
示例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);
}
}
示例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();
}
示例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);
}
}
示例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());
}
}
示例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);
}
示例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);
}
}
示例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);
}
示例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
}
}
示例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();
}
示例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);
}