本文整理汇总了Java中android.widget.ListView.setOnItemClickListener方法的典型用法代码示例。如果您正苦于以下问题:Java ListView.setOnItemClickListener方法的具体用法?Java ListView.setOnItemClickListener怎么用?Java ListView.setOnItemClickListener使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类android.widget.ListView
的用法示例。
在下文中一共展示了ListView.setOnItemClickListener方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: init
import android.widget.ListView; //导入方法依赖的package包/类
/**
* Function to init views
*/
private void init() {
Intent intent = getIntent();
searchText = intent.getStringExtra(AppConstants.General.SEARCH_TEXT);
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
toolbar.setTitle(getString(R.string.search));
setSupportActionBar(toolbar);
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
getSupportActionBar().setDisplayShowHomeEnabled(true);
resultsInfo = (TextView) findViewById(R.id.textView13);
ayas = new ArrayList<Aya>();
adapter = new SearchShowAdapter(this, searchText, ayas);
searchResults = (ListView) findViewById(R.id.listView3);
searchResults.setOnItemClickListener(this);
searchResults.setEmptyView(findViewById(R.id.progressBar3));
searchResults.setAdapter(adapter);
new SearchResults().executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
}
示例2: onCreate
import android.widget.ListView; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
// TODO Auto-generated method stub
super.onCreate(savedInstanceState);
this.setContentView(R.layout.label_dialog);
labelList = (ListView) findViewById(R.id.label_list);
cancel = (Button) findViewById(R.id.cancel);
// ListView
SimpleAdapter adapter = new SimpleAdapter(context, getLabelList(),
R.layout.label_list_item, new String[]{"label_img",
"label_value"}, new int[]{
R.id.label_img, R.id.label_value});
labelList.setAdapter(adapter);
//ListView
labelList
.setOnItemClickListener(new AdapterView.OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> arg0, View arg1,
int position, long arg3) {
HashMap<String, Object> label = getLabelList().get(position);
selectedLabel = (String) label.get("label_value");
ToodooOptionsModel ToodooOptionsModel = toodooOptionsList.get(0);
ToodooOptionsModel.setOptionValue(selectedLabel);
mAdapter.notifyDataSetChanged();
labelDialog.dismiss();
}
});
cancel.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
labelDialog.dismiss();
}
});
}
示例3: onCreateView
import android.widget.ListView; //导入方法依赖的package包/类
@Nullable
@Override
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.fragment_news_list, container, false);
listView = (ListView) view.findViewById(R.id.list_view);
listView.setAdapter(adapter = new MyBaseAdapter<Map<String, Object>>(getActivity(), data) {
@Override
public View getView(int position, View convertView, ViewGroup parent) {
ViewHolder holder = ViewHolder.get(super.context, convertView, parent, R.layout.list_view_item_news, position);
Map<String, Object> map = _data.get(position);
holder.setText(R.id.name, map.get("name").toString());
holder.setDrawableImage(R.id.logo, (Integer) map.get("logo"));
return holder.getConvertView();
}
});
listView.setOnItemClickListener(this);
return view;
}
示例4: onCreate
import android.widget.ListView; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
setTheme(R.style.AppThemeStaffLogin);
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_desk_orders);
orderHistoryList = new ArrayList<>();
orderHistoryAdapter = new OrderHistoryAdapter(this, orderHistoryList);
getSupportActionBar().setDisplayOptions(android.support.v7.app.ActionBar.DISPLAY_SHOW_CUSTOM);
getSupportActionBar().setCustomView(R.layout.custom_actionbar);
tvActionBar = (TextView)getSupportActionBar().getCustomView().findViewById(R.id.tvActionBar);
tvActionBar.setText(getResources().getText(R.string.orderHistory));
lvOrderHistory = (ListView) findViewById(R.id.lvOrderHistory);
lvOrderHistory.setOnItemClickListener(this);
orderId = getIntent().getStringExtra("orderId");
url+=orderId;
Request request = new Request(this, url, com.android.volley.Request.Method.GET);
request.requestVolley(this);
}
示例5: onCreate
import android.widget.ListView; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_select_members);
textNoRecord = (TextView) findViewById(R.id.textEmpty);
listView = (ListView) findViewById(R.id.list_team_members);
listView.setOnItemClickListener(this);
memberList = new ArrayList<>();
editAddMembers = (EditText) findViewById(R.id.editAddTeamMember);
editAddMembers.addTextChangedListener(this);
findViewById(R.id.image_search).setOnClickListener(this);
try {
odoo = Odoo.createWithUser(this, OUser.current(this));
} catch (OdooVersionException e) {
e.printStackTrace();
}
}
示例6: showPopupWindow
import android.widget.ListView; //导入方法依赖的package包/类
/**
* PopupWindow选择提示框
*
* @param activity 当前Activity
* @param targetView 与提示框关联的控件
* @param width 提示框宽
* @param height 提示框高
* @param list 提示框内容列表
* @param itemClick 列表点击事件
*/
public static void showPopupWindow(Activity activity, View targetView, int width, int height,
List<String> list, AdapterView.OnItemClickListener itemClick) {
createPopupWindow(activity, targetView, DensityUtils.dp2px(activity, width),
DensityUtils.dp2px(activity, height));
ListView lvOptions = (ListView) view.findViewById(R.id.lv_options);
popupWindowAdapter = new PopupWindowAdapter(activity, list);
lvOptions.setAdapter(popupWindowAdapter);
lvOptions.setOnItemClickListener(itemClick);
}
示例7: onCreate
import android.widget.ListView; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
SettingUtilities.onActivityCreateSetTheme(this);
setContentView(R.layout.activity_item_management_settings);
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
setSupportActionBar(toolbar);
listView = (ListView) findViewById(R.id.list_item_mgmt);
listView.setOnItemClickListener(this);
}
示例8: onCreate
import android.widget.ListView; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_offline_region_list);
ListView listView = findViewById(R.id.listView);
listView.setAdapter(adapter = new OfflineRegionAdapter(this));
listView.setEmptyView(findViewById(android.R.id.empty));
listView.setOnItemClickListener(this);
}
示例9: onCreateView
import android.widget.ListView; //导入方法依赖的package包/类
@Override
@Nullable
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.fragment_tencent_huati, container, false);
refreshLayout = (SwipeRefreshLayout) view.findViewById(R.id.refresh_layout);
listView = (ListView) view.findViewById(R.id.list_view);
adapter = new MyBaseAdapter<Map<String, Object>>(getActivity(), data) {
@Override
public View getView(int position, View convertView, ViewGroup parent) {
ViewHolder holder = ViewHolder.get(context, convertView, parent, R.layout.list_view_item_tencent_huati, position);
Map<String, Object> map = data.get(position);
holder.setText(R.id.title, map.get("n_title").toString())
.setText(R.id.desc, map.get("n_describe").toString())
.setText(R.id.author, map.get("n_use_user").toString())
.setText(R.id.time, FormatUtil.getRelativeTimeSpanString(
FormatUtil.string2Date(map.get("n_pushtime").toString(), FormatUtil.DATETIME)
));
holder.setNetImage(R.id.thumbnails, map.get("n_pic").toString());
return holder.getConvertView();
}
};
listView.setAdapter(adapter);
loadMoreFooter = new LoadMoreFooter(getActivity(), listView, this);
refreshLayout.setOnRefreshListener(this);
listView.setOnItemClickListener(this);
refreshLayout.setRefreshing(true);
return view;
}
示例10: onCreate
import android.widget.ListView; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
try {
mAssetFileList = filterHtmlFile(AssetsUtils.allFiles(this)).toArray();
ListView listView = new ListView(this);
ArrayAdapter<Object> arrayAdapter = new ArrayAdapter<>(this, R.layout
.example_list_item, R.id.example_list_title, mAssetFileList);
listView.setAdapter(arrayAdapter);
listView.setOnItemClickListener(this);
setContentView(listView);
} catch (IOException e) {
}
}
示例11: initializeConfigurationOptions
import android.widget.ListView; //导入方法依赖的package包/类
private void initializeConfigurationOptions() {
listView = (ListView) findViewById(R.id.list_config_view);
ArrayAdapter<ConfigurationOption> adapter = new ArrayAdapter<ConfigurationOption>(this.getBaseContext(), android.R.layout.simple_list_item_1);
adapter.add(new ConfigurationOption(NotificationsActivity.class, getString(R.string.notifications_service)));
adapter.add(new ConfigurationOption(ControlModesActivity.class, getString(R.string.phone_control_menu_text)));
adapter.add(new ConfigurationOption(PhoneFinderConfigActivity.class, getString(R.string.phone_finder_service), servicesContainer));
adapter.add(new ConfigurationOption(TimeConfigActivity.class, getString(R.string.time_sync_service)));
adapter.add(new ConfigurationOption(AvailableServicesActivity.class, getString(R.string.show_available_services_text), servicesContainer));
adapter.add(new ConfigurationOption(SettingsActivity.class, getString(R.string.bluewatcher_settings)));
listView.setAdapter(adapter);
listView.setOnItemClickListener(new OnConfigurationOptionSelected(this, listView));
}
示例12: onCreateView
import android.widget.ListView; //导入方法依赖的package包/类
@Override
@Nullable
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.fragment_tencent_mil, container, false);
refreshLayout = (SwipeRefreshLayout) view.findViewById(R.id.refresh_layout);
listView = (ListView) view.findViewById(R.id.list_view);
adapter = new MyBaseAdapter<Map<String, Object>>(getActivity(), data) {
@Override
public View getView(int position, View convertView, ViewGroup parent) {
ViewHolder holder = ViewHolder.get(context, convertView, parent, R.layout.list_view_item_tencent_news, position);
Map<String, Object> map = data.get(position);
holder.setText(R.id.title, map.get("title").toString())
.setText(R.id.abstract_content, map.get("abstract").toString())
.setText(R.id.time, FormatUtil.getRelativeTimeSpanString(
new Date((long) (((double) map.get("timestamp")) * 1000))
));
holder.setNetImage(R.id.thumbnails, ((List) map.get("thumbnails_qqnews")).get(0).toString());
return holder.getConvertView();
}
};
listView.setAdapter(adapter);
loadMoreFooter = new LoadMoreFooter(getActivity(), listView, this);
refreshLayout.setOnRefreshListener(this);
listView.setOnItemClickListener(this);
refreshLayout.setRefreshing(true);
return view;
}
示例13: onCreate
import android.widget.ListView; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_lowpan_scan);
mScanButton = findViewById(R.id.scanButton);
mScanButton.setOnClickListener((view) -> beginScan());
Button provisionButton = findViewById(R.id.provisionButton);
provisionButton.setOnClickListener(view -> createNewNetwork());
Button leaveButton = findViewById(R.id.leaveButton);
leaveButton.setOnClickListener(view -> leaveNetwork());
ListView beaconsView = findViewById(R.id.beacons);
beaconsView.setOnItemClickListener(this);
mBeaconsAdapter = new LowpanBeaconAdapter(this);
beaconsView.setAdapter(mBeaconsAdapter);
mInterfaceStatus = findViewById(R.id.interfaceStatus);
mNetworkStatus = findViewById(R.id.networkStatus);
try {
mLowpanManager.registerCallback(mInterfaceCallback);
} catch (LowpanException e) {
Log.e(TAG, "Unable to attach LoWPAN callback");
}
}
示例14: initUI
import android.widget.ListView; //导入方法依赖的package包/类
/**
* 初始化弹窗列表
*/
private void initUI() {
mListView = (ListView) getContentView().findViewById(R.id.title_list);
mListView.setOnItemClickListener(new OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> arg0, View arg1, int index, long arg3) {
//点击子类项后,弹窗消失
dismiss();
if (mItemOnClickListener != null)
mItemOnClickListener.onItemClick(mActionItems.get(index), index);
}
});
}
示例15: initRes
import android.widget.ListView; //导入方法依赖的package包/类
private void initRes() {
// 设置顶部标题栏
setTopTitle(getActivity().getString(R.string.main_innernet));
internalListView = (ListView)curView.findViewById(R.id.internalListView);
internalListView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> adapterView, View view, int i, long l) {
String url = mAdapter.getItem(i).getItemUrl();
Intent intent=new Intent(InternalFragment.this.getActivity(),WebViewFragmentActivity.class);
intent.putExtra(IntentConstant.WEBVIEW_URL, url);
startActivity(intent);
}
});
}