本文整理汇总了Java中android.widget.AdapterView.getAdapter方法的典型用法代码示例。如果您正苦于以下问题:Java AdapterView.getAdapter方法的具体用法?Java AdapterView.getAdapter怎么用?Java AdapterView.getAdapter使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类android.widget.AdapterView
的用法示例。
在下文中一共展示了AdapterView.getAdapter方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onItemClick
import android.widget.AdapterView; //导入方法依赖的package包/类
/**
*
*/
@Override
public void onItemClick(final AdapterView<?> parent, final View view, final int position, final long id)
{
final SectionListAdapter sectionListAdapter = (SectionListAdapter) parent.getAdapter();
final Object item = sectionListAdapter.getItem(position);
if (options.select((ServerOption) item) != null) {
final List<ServerOption> newOptionList = new ArrayList<ServerOption>();
newOptionList.add((ServerOption) item);
populateList(newOptionList, false);
}
else if (((ServerOption) item).getParent() != null) {
populateList(options.getRootOptions(), true);
}
((SectionListAdapter) parent.getAdapter()).notifyDataSetChanged();
((RMBTMainActivity) getActivity()).updateMapFilter(null);
}
示例2: onItemEvent
import android.widget.AdapterView; //导入方法依赖的package包/类
private void onItemEvent(String eventType, Object object, AdapterView<?> parent, View view, int position,
long id) {
ItemEvent itemEvent = new ItemEvent();
itemEvent.setEventType(eventType);
itemEvent.setListenerName(object.getClass().getName());
if (parent != null) {
itemEvent.setPageName(parent.getContext().getClass().getName());
if (parent.getAdapter() != null) {
itemEvent.setAdapterName(parent.getAdapter().getClass().getName());
}
} else {
itemEvent.setPageName(view.getContext().getClass().getName());
}
itemEvent.setViewObject(ViewUtils.getViewSign(view));
itemEvent.setParentArray(ViewUtils.getParentArray(view));
itemEvent.setPosition(position);
itemEvent.setId(id);
addToList(itemEvent);
}
示例3: onItemClick
import android.widget.AdapterView; //导入方法依赖的package包/类
@Override
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
BluetoothDeviceAdapter deviceAdapter = ((BluetoothDeviceAdapter) parent.getAdapter());
final BluetoothDevice device = deviceAdapter.getItem(position);
if (device.getBondState() == BluetoothDevice.BOND_BONDED && !presenter.getActivePrinter().isEmpty()) {
final String[] titles = getResources().getStringArray(R.array.printlist_unpaireds);
UtilsDialog.createAlertDialog(this)
.setTitle(R.string.choice_make)
.setSingleChoiceItems(titles, -1, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
switch (which){
case 0: presenter.unpairDialog(device); break;
case 1: presenter.printTest(); break;
}
dialog.dismiss();
}
})
.setCancelable(false)
.show();
}else {
presenter.pairDevice(device, this);
}
}
示例4: onItemClick
import android.widget.AdapterView; //导入方法依赖的package包/类
public void onItemClick(AdapterView<?> adapterView, View view, int rawPosition, long id) {
SectionedBaseAdapter adapter;
if (adapterView.getAdapter().getClass().equals(HeaderViewListAdapter.class)) {
adapter = (SectionedBaseAdapter) ((HeaderViewListAdapter) adapterView.getAdapter
()).getWrappedAdapter();
} else {
adapter = (SectionedBaseAdapter) adapterView.getAdapter();
}
int section = adapter.getSectionForPosition(rawPosition);
int position = adapter.getPositionInSectionForPosition(rawPosition);
if (position == -1) {
onSectionClick(adapterView, view, section, id);
} else {
onItemClick(adapterView, view, section, position, id);
}
}
示例5: onItemClick
import android.widget.AdapterView; //导入方法依赖的package包/类
@Override
public void onItemClick(AdapterView<?> listView, View itemView,
int position, long id) {
ListView a = (ListView) listView.findViewById(R.id.itemList);
BrowseReceiverDeviceAdapter adapter = (BrowseReceiverDeviceAdapter) listView
.getAdapter();
Log.d(getClass().getName(), "position: " + position);
CheckBox checkBox = (CheckBox) itemView
.findViewById(R.id.browseItemCheckbox);
Device device = (Device) adapter.getItem(position);
if (checkBox.isChecked()) {
Log.d(getClass().getName(), "isChecked:" + device.getDisplayString());
adapter.removeSelectedDevice(device);
UpnpClient.getInstance(null).removeReceiverDevice(device);
checkBox.setChecked(false);
} else {
Log.d(getClass().getName(), "isNotChecked:" + device.getDisplayString());
adapter.addSelectedDevice(device);
UpnpClient.getInstance(null).addReceiverDevice(device);
checkBox.setChecked(true);
}
}
示例6: getOnItemClickListener
import android.widget.AdapterView; //导入方法依赖的package包/类
public AdapterView.OnItemClickListener getOnItemClickListener(final Context context, final int emotion_map_type) {
return new AdapterView.OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
Object itemAdapter = parent.getAdapter();
if (itemAdapter instanceof EmotionGridViewAdapter) {
// 点击的是表情
EmotionGridViewAdapter emotionGvAdapter = (EmotionGridViewAdapter) itemAdapter;
if (position == emotionGvAdapter.getCount() - 1) {
// 如果点击了最后一个回退按钮,则调用删除键事件
mEditText.dispatchKeyEvent(new KeyEvent(
KeyEvent.ACTION_DOWN, KeyEvent.KEYCODE_DEL));
} else {
// 如果点击了表情,则添加到输入框中
String emotionName = emotionGvAdapter.getItem(position);
// 获取当前光标位置,在指定位置上添加表情图片文本
int curPosition = mEditText.getSelectionStart();
StringBuilder sb = new StringBuilder(mEditText.getText().toString());
sb.insert(curPosition, emotionName);
// 特殊文字处理,将表情等转换一下
mEditText.setText(SpanStringUtils.getEmotionContent(emotion_map_type,
context, mEditText, sb.toString()));
// 将光标设置到新增完表情的右侧
mEditText.setSelection(curPosition + emotionName.length());
}
}
}
};
}
示例7: onItemClick
import android.widget.AdapterView; //导入方法依赖的package包/类
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
ActivityChooserViewAdapter adapter = (ActivityChooserViewAdapter) parent.getAdapter();
final int itemViewType = adapter.getItemViewType(position);
switch (itemViewType) {
case ActivityChooserViewAdapter.ITEM_VIEW_TYPE_FOOTER: {
showPopupUnchecked(ActivityChooserViewAdapter.MAX_ACTIVITY_COUNT_UNLIMITED);
} break;
case ActivityChooserViewAdapter.ITEM_VIEW_TYPE_ACTIVITY: {
dismissPopup();
if (mIsSelectingDefaultActivity) {
// The item at position zero is the default already.
if (position > 0) {
mAdapter.getDataModel().setDefaultActivity(position);
}
} else {
// If the default target is not shown in the list, the first
// item in the model is default action => adjust index
position = mAdapter.getShowDefaultActivity() ? position : position + 1;
Intent launchIntent = mAdapter.getDataModel().chooseActivity(position);
if (launchIntent != null) {
mContext.startActivity(launchIntent);
}
}
} break;
default:
throw new IllegalArgumentException();
}
}
示例8: clickAdapterView
import android.widget.AdapterView; //导入方法依赖的package包/类
private void clickAdapterView(AdapterView parent) {
final int position = parent.getPositionForView(MaterialRippleLayout.this);
final long itemId = parent.getAdapter() != null
? parent.getAdapter().getItemId(position)
: 0;
if (position != AdapterView.INVALID_POSITION) {
parent.performItemClick(MaterialRippleLayout.this, position, itemId);
}
}
示例9: onItemClick
import android.widget.AdapterView; //导入方法依赖的package包/类
@Override
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
SessionAdapter adapter = (SessionAdapter) parent.getAdapter();
final String sessionId = adapter.getSessionIdAtPosition(position);
mCallback.onSessionClicked(sessionId);
}
示例10: clickAdapterView
import android.widget.AdapterView; //导入方法依赖的package包/类
private void clickAdapterView(AdapterView parent) {
int position = parent.getPositionForView(MaterialRippleLayout.this);
long itemId = parent.getAdapter() != null ? parent.getAdapter().getItemId(position) : 0;
if (position != -1) {
parent.performItemClick(MaterialRippleLayout.this, position, itemId);
}
}
示例11: onItemClick
import android.widget.AdapterView; //导入方法依赖的package包/类
@Override
public void onItemClick(AdapterView<?> listView, View arg1, int position, long id) {
BrowseDeviceAdapter adapter = (BrowseDeviceAdapter) listView.getAdapter();
upnpClient.setProviderDevice((Device) adapter.getItem(position));
if (parent.getParent() instanceof TabBrowserActivity) {
((TabBrowserActivity) parent.getParent()).setCurrentTab(TabBrowserActivity.Tabs.CONTENT);
}
}
示例12: onItemClick
import android.widget.AdapterView; //导入方法依赖的package包/类
@Override
public void onItemClick(AdapterView<?> listView, View arg1, int position,
long id) {
ListView a = (ListView) listView.findViewById(R.id.playerList);
PlayerListItemAdapter adapter = (PlayerListItemAdapter) listView.getAdapter();
Player player = (Player) adapter.getItem(position);
openIntent(a.getContext(), player);
}
示例13: onItemClick
import android.widget.AdapterView; //导入方法依赖的package包/类
@Override
public void onItemClick(AdapterView<?> listView, View arg1, int position,
long id) {
ListView a = (ListView) listView.findViewById(R.id.contentList);
BrowseItemAdapter adapter = (BrowseItemAdapter) listView.getAdapter();
currentObject = adapter.getFolder(position);
if (currentObject instanceof Container) {
//Fixme: Cache should store information for different folders....
//IconDownloadCacheHandler.getInstance().resetCache();
// if the current id is null, go back to the top level
String newObjectId = Navigator.ITEM_ROOT_OBJECT_ID;
if (navigator == null || currentObject.getId() == null){
navigator = new Navigator();
contentListActivity.setNavigator(navigator);
}else {
newObjectId = adapter.getFolder(position).getId();
}
navigator.pushPosition(new Position(newObjectId, upnpClient.getProviderDeviceId()));
contentListActivity.populateItemList();
} else {
PlayableItem playableItem = new PlayableItem((Item)currentObject, 0);
if (playableItem.getMimeType().startsWith("video")){
play(upnpClient.initializePlayers(currentObject));
}else{
playAll();
}
}
}
示例14: onItemClick
import android.widget.AdapterView; //导入方法依赖的package包/类
@Override
public void onItemClick(AdapterView<?> av, View v, int position, long id) {
Log.i(THIS_FILE, "Item clicked : " + id +" " + position);
HelpArrayAdapter haa = (HelpArrayAdapter) av.getAdapter();
HelpEntry he = haa.getItem(position);
SherlockDialogFragment newFragment;
switch (he.choiceTag) {
case FAQ:
newFragment = Faq.newInstance();
newFragment.show(getFragmentManager(), "faq");
break;
case LEGALS:
newFragment = Legal.newInstance();
newFragment.show(getFragmentManager(), "issues");
break;
case OPEN_ISSUES:
Intent it = new Intent(Intent.ACTION_VIEW);
it.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
it.setData(Uri.parse("http://code.google.com/p/csipsimple/issues"));
startActivity(it);
break;
case NIGHTLY:
// We have to check for an update
final NightlyUpdater nu = new NightlyUpdater(getActivity());
Thread t = new Thread() {
public void run() {
UpdaterPopupLauncher ru = nu.getUpdaterPopup(true);
if (ru != null) {
getActivity().runOnUiThread(ru);
}
};
};
t.start();
break;
case SEND_LOGS:
prefsWrapper.setPreferenceStringValue(SipConfigManager.LOG_LEVEL, "1");
try {
startActivityForResult(CollectLogs.getLogReportIntent("<<<PLEASE ADD THE BUG DESCRIPTION HERE>>>", getActivity()), REQUEST_SEND_LOGS);
}catch(Exception e) {
Log.e(THIS_FILE, "Impossible to send logs...", e);
}
Log.setLogLevel(1);
break;
case START_LOGS:
prefsWrapper.setPreferenceStringValue(SipConfigManager.LOG_LEVEL, "4");
Log.setLogLevel(4);
Intent intent = new Intent(SipManager.ACTION_SIP_REQUEST_RESTART);
getActivity().sendBroadcast(intent);
dismiss();
break;
default:
break;
}
}
示例15: onItemLongClick
import android.widget.AdapterView; //导入方法依赖的package包/类
@Override
public boolean onItemLongClick(AdapterView<?> arg0, View arg1, int arg2, long arg3)
{
try
{
isLongClick = true;
SimpleCursorAdapter simpleCursorAdapter = (SimpleCursorAdapter) arg0.getAdapter();
Cursor cursor = simpleCursorAdapter.getCursor();
cursor.moveToPosition(arg2);
int cursorIndex1 = cursor.getColumnIndex(CONTACT_FILTER.NUMBER);
int cursorIndex2 = cursor.getColumnIndex(CONTACT_FILTER.RECORDABLE);
final String number = cursor.getString(cursorIndex1);
final int recordable = cursor.getInt(cursorIndex2);
LayoutInflater layoutInflater = LayoutInflater.from(Filters.this);
View dialogview = layoutInflater.inflate(R.layout.filter_dialog_detail, null);
AlertDialog.Builder builder = new AlertDialog.Builder(Filters.this);
builder.setTitle(number);
builder.setView(dialogview);
TextView numberTextview = (TextView) dialogview.findViewById(R.id.filter_dialog_detail_number);
Button acquitButton = (Button) dialogview.findViewById(R.id.filter_dialog_detail_acquit);
if(recordable == 0)
{
numberTextview.setText(getApplicationContext().getString(R.string.filter_dialog_detail_number_0));
}
else
{
numberTextview.setText(getApplicationContext().getString(R.string.filter_dialog_detail_number_1));
}
final Dialog alertDialog;
alertDialog = builder.create();
alertDialog.show();
themeManager.setAlertDialog(getApplicationContext(), alertDialog);
acquitButton.setOnClickListener(new View.OnClickListener()
{
@Override
public void onClick(View v)
{
alertDialog.dismiss();
}
});
isLongClick = false;
return true;
}
catch (Exception e)
{
return false;
}
}