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


Java ListView.setOnItemClickListener方法代码示例

本文整理汇总了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);
}
 
开发者ID:fekracomputers,项目名称:QuranAndroid,代码行数:23,代码来源:SearchActivity.java

示例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();
        }
    });
}
 
开发者ID:OlayinkaPeter,项目名称:Toodoo,代码行数:37,代码来源:ToodooNote.java

示例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;
}
 
开发者ID:tomoya92,项目名称:android-apps,代码行数:19,代码来源:OtherNewsFragment.java

示例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);

}
 
开发者ID:yusufcakal,项目名称:RestaurantApp,代码行数:25,代码来源:DeskOrdersActivity.java

示例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();
    }
}
 
开发者ID:odoo-mobile-intern,项目名称:odoo-work,代码行数:22,代码来源:SelectMembers.java

示例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);
}
 
开发者ID:alidili,项目名称:Demos,代码行数:21,代码来源:ShowUtils.java

示例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);
}
 
开发者ID:eyeRS,项目名称:eyeRS,代码行数:12,代码来源:ItemManagementSettings.java

示例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);
}
 
开发者ID:mapbox,项目名称:mapbox-plugins-android,代码行数:11,代码来源:OfflineRegionListActivity.java

示例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;
}
 
开发者ID:tomoya92,项目名称:android-apps,代码行数:32,代码来源:TencentHuaTiFragment.java

示例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) {
    }
}
 
开发者ID:hsllany,项目名称:HtmlNative,代码行数:16,代码来源:ExampleListActivity.java

示例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));
}
 
开发者ID:masterjc,项目名称:bluewatcher,代码行数:14,代码来源:BlueWatcherActivity.java

示例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;
}
 
开发者ID:tomoya92,项目名称:android-apps,代码行数:31,代码来源:TencentMilFragment.java

示例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");
    }
}
 
开发者ID:androidthings,项目名称:sample-lowpan,代码行数:29,代码来源:LowpanScanActivity.java

示例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);
        }
    });
}
 
开发者ID:jpaijh,项目名称:TYT,代码行数:18,代码来源:TitlePopup.java

示例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);
        }
    });
}
 
开发者ID:ccfish86,项目名称:sctalk,代码行数:15,代码来源:InternalFragment.java


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