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