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


Java AdapterView.OnItemClickListener方法代码示例

本文整理汇总了Java中android.widget.AdapterView.OnItemClickListener方法的典型用法代码示例。如果您正苦于以下问题:Java AdapterView.OnItemClickListener方法的具体用法?Java AdapterView.OnItemClickListener怎么用?Java AdapterView.OnItemClickListener使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在android.widget.AdapterView的用法示例。


在下文中一共展示了AdapterView.OnItemClickListener方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: newListener

import android.widget.AdapterView; //导入方法依赖的package包/类
private AdapterView.OnItemClickListener newListener() {
  return new AdapterView.OnItemClickListener() {
    @Override
    public void onItemClick(AdapterView<?> parent, View v, int x, long id) {
      TextView t = (TextView)v;
      uri = (Uri)t.getTag();
      title = t.getText().toString();
      ((TextView)getDialog().findViewById(R.id.selected))
        .setText(getString(R.string.selected) + title);

      player.reset();
      try {
        player.setDataSource(getContext(), uri);
        player.prepare();
      } catch (IOException e) {
        Log.e(TAG, "Failed to set data " + e);
      }
      player.start();
    }
  };
}
 
开发者ID:sdrausty,项目名称:buildAPKsApps,代码行数:22,代码来源:MediaPicker.java

示例2: onCreateView

import android.widget.AdapterView; //导入方法依赖的package包/类
@Nullable
@Override
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
    View view = inflater.inflate(R.layout.fragment_home, container, false);

    AdapterView.OnItemClickListener listener = new AdapterView.OnItemClickListener() {
        @Override
        public void onItemClick(AdapterView<?> arg0, View arg1, int position, long arg3) {
            TwitchChannel channel = (TwitchChannel)arg0.getItemAtPosition(position);

            ChannelFragment fragment = new ChannelFragment();

            Bundle bundle = new Bundle();
            bundle.putString("channel", channel.username);

            fragment.setArguments(bundle);
            getActivity().getSupportFragmentManager().beginTransaction().replace(R.id.fragment_holder, fragment).addToBackStack(null).commit();
        }
    };

    final ListView onlineList = view.findViewById(R.id.online_channels);
    onlineList.setOnItemClickListener(listener);

    final ListView hostingList = view.findViewById(R.id.hosting_channels);
    hostingList.setOnItemClickListener(listener);

    final ListView offlineList = view.findViewById(R.id.offline_channels);
    offlineList.setOnItemClickListener(listener);

    return view;
}
 
开发者ID:invghost,项目名称:NeoStream,代码行数:32,代码来源:HomeFragment.java

示例3: setItemClickListener

import android.widget.AdapterView; //导入方法依赖的package包/类
public WCBMenu setItemClickListener(AdapterView.OnItemClickListener listener) {
    mOnItemClickListener = listener;
    if (mBuilder != null) {
        mBuilder.setItemClickListener(listener);
    }
    return this;
}
 
开发者ID:gaelthas,项目名称:WCBMenu,代码行数:8,代码来源:WCBMenu.java

示例4: initList

import android.widget.AdapterView; //导入方法依赖的package包/类
private void initList(){

        // Create the adpater only if null, This is here so we wont override the adapter given from the extended class with setAdapter.
        if (adapter == null)
            adapter = new ChatSDKThreadsListAdapter(getActivity());

        listThreads.setAdapter(adapter);

        if (onItemClickListener==null)
        {
            onItemClickListener = new AdapterView.OnItemClickListener() {
                @Override
                public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
                    startChatActivityForID(adapter.getItem(position).getId());
                }
            };
        }

        listThreads.setOnItemClickListener(onItemClickListener);

        if (onItemLongClickListener== null)
        {
            onItemLongClickListener = new AdapterView.OnItemLongClickListener() {
                @Override
                public boolean onItemLongClick(AdapterView<?> parent, View view, int position, long id) {
                    showAlertDialog("", getResources().getString(R.string.alert_delete_thread), getResources().getString(R.string.delete),
                            getResources().getString(R.string.cancel), null, new DeleteThread(adapter.getItem(position).getEntityId()));

                    return true;
                }
            };
        }

        listThreads.setOnItemLongClickListener(onItemLongClickListener);
    }
 
开发者ID:MobileDev418,项目名称:chat-sdk-android-push-firebase,代码行数:36,代码来源:ChatSDKAbstractConversationsFragment.java

示例5: setItemsWithoutChk

import android.widget.AdapterView; //导入方法依赖的package包/类
public void setItemsWithoutChk(CharSequence[] items,
                               AdapterView.OnItemClickListener onItemClickListener) {
    ListView listview = new ListView(content.getContext());
    listview.setLayoutParams(new FrameLayout.LayoutParams(-1, -2));
    DialogAdapter adapter = new DialogAdapter(items);
    adapter.setShowChk(false);
    listview.setDivider(null);
    listview.setAdapter(adapter);
    listview.setOnItemClickListener(onItemClickListener);
    setContent(listview, 0);
}
 
开发者ID:hsj-xiaokang,项目名称:OSchina_resources_android,代码行数:12,代码来源:CommonDialog.java

示例6: initAdapter

import android.widget.AdapterView; //导入方法依赖的package包/类
private void initAdapter() {
    listAdapter = new TAdapter<>(context, itemTextList, new TAdapterDelegate() {
        @Override
        public int getViewTypeCount() {
            return itemTextList.size();
        }

        @Override
        public Class<? extends TViewHolder> viewHolderAtPosition(int position) {
            return MultiSelectDialogViewHolder.class;
        }

        @Override
        public boolean enabled(int position) {
            return true;
        }
    });
    itemListener = new AdapterView.OnItemClickListener() {
        @Override
        public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
            itemTextList.set(position,new Pair<String, Boolean>(itemTextList.get(position).first,!itemTextList.get(position).second));
            boolean hasChecked = false;
            for(Pair<String, Boolean> pair:itemTextList) {
                if(pair.second == true) {
                    hasChecked = true;
                }
            }
            positiveBtn.setEnabled(hasChecked);
            listAdapter.notifyDataSetChanged();
        }
    };
}
 
开发者ID:newDeepLearing,项目名称:decoy,代码行数:33,代码来源:MultiSelectDialog.java

示例7: BaseRecyclerAdapter

import android.widget.AdapterView; //导入方法依赖的package包/类
public BaseRecyclerAdapter(Collection<T> collection, @LayoutRes int layoutId, AdapterView.OnItemClickListener listener) {
    setHasStableIds(false);
    setOnItemClickListener(listener);
    this.mList = new ArrayList<>(collection);
    this.mLayoutId = layoutId;
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:7,代码来源:BaseRecyclerAdapter.java

示例8: setOnItemClickListener

import android.widget.AdapterView; //导入方法依赖的package包/类
/**
 * DO NOT USE. Prefer {@link #setOnAddressSelectedListener} instead
 */
@Override
public final void setOnItemClickListener(final AdapterView.OnItemClickListener l) {
    throw new UnsupportedOperationException("Use set" + OnAddressSelectedListener.class.getSimpleName() + "() instead");
}
 
开发者ID:RacZo,项目名称:Smarty-Streets-AutoCompleteTextView,代码行数:8,代码来源:SmartyStreetsAutocompleteTextView.java

示例9: setOnItemClickListener

import android.widget.AdapterView; //导入方法依赖的package包/类
public void setOnItemClickListener(AdapterView.OnItemClickListener listener) {
	getListView().setOnItemClickListener(listener);
}
 
开发者ID:MobClub,项目名称:BBSSDK-for-Android,代码行数:4,代码来源:PullToRefreshEmptyAdapter.java

示例10: setListener

import android.widget.AdapterView; //导入方法依赖的package包/类
public void setListener(AdapterView.OnItemClickListener listener)
{
    this.listener = listener;
}
 
开发者ID:icaynia,项目名称:pracler,代码行数:5,代码来源:MenuSelecter.java

示例11: getItemClickListener

import android.widget.AdapterView; //导入方法依赖的package包/类
private AdapterView.OnItemClickListener getItemClickListener(){
    return new AdapterView.OnItemClickListener() {
        @Override
        public void onItemClick(AdapterView<?> parent, View view, final int position, long id) {
            final Intent intent = new Intent();

            showProgDialog("Opening thread.");

            getNetworkAdapter().createThreadWithUsers("", contactsFragment.getAdapter().getItem(position).asBUser(), getNetworkAdapter().currentUserModel())
                    .done(new DoneCallback<BThread>() {
                        @Override
                        public void onDone(final BThread thread) {
                            if (thread == null) {
                                if (DEBUG) Timber.e("thread added is null");
                                return;
                            }

                            if (isOnMainThread()) {
                                intent.putExtra(THREAD_ID, thread.getId());
                                setResult(RESULT_OK, intent);
                                finish();
                            } else
                                ChatSDKThreadDetailsActivity.this.runOnUiThread(new Runnable() {
                                    @Override
                                    public void run() {
                                        intent.putExtra(THREAD_ID, thread.getId());
                                        setResult(RESULT_OK, intent);
                                        finish();
                                    }
                                });
                        }
                    })
                    .fail(new FailCallback<BError>() {
                        @Override
                        public void onFail(BError error) {
                            if (isOnMainThread()) {
                                showAlertToast(getString(R.string.create_thread_with_users_fail_toast));
                                dismissProgDialog();
                            } else
                                ChatSDKThreadDetailsActivity.this.runOnUiThread(new Runnable() {
                                    @Override
                                    public void run() {
                                        showAlertToast(getString(R.string.create_thread_with_users_fail_toast));
                                        dismissProgDialog();
                                    }
                                });
                        }
                    });
        }
    };
}
 
开发者ID:MobileDev418,项目名称:chat-sdk-android-push-firebase,代码行数:52,代码来源:ChatSDKThreadDetailsActivity.java

示例12: setOnItemClickListener

import android.widget.AdapterView; //导入方法依赖的package包/类
public void setOnItemClickListener(AdapterView.OnItemClickListener onItemClickListener) {
    this.onItemClickListener = onItemClickListener;
}
 
开发者ID:NICOLITE,项目名称:HutHelper,代码行数:4,代码来源:MenuAdapter.java

示例13: showChooseDialog

import android.widget.AdapterView; //导入方法依赖的package包/类
public void showChooseDialog(String title, List<String> list, AdapterView.OnItemClickListener listener) {
    ListView view = (ListView) getLayoutInflater().inflate(R.layout.base_dialog_list, null);
    view.setAdapter(new ArrayAdapter<>(this, android.R.layout.simple_list_item_1, list));
    view.setOnItemClickListener(listener);
    mBaseDialog.setDialogContentView(view).setTitle(title).setBottomLayoutVisible(false).show();
}
 
开发者ID:HelloChenJinJun,项目名称:TestChat,代码行数:7,代码来源:BaseActivity.java

示例14: setOnItemClickListener

import android.widget.AdapterView; //导入方法依赖的package包/类
@Override
public void setOnItemClickListener(AdapterView.OnItemClickListener listener) {
    mOnItemClicked = listener;
}
 
开发者ID:abook23,项目名称:godlibrary,代码行数:5,代码来源:HorizontalListView.java

示例15: setOnItemClickListener

import android.widget.AdapterView; //导入方法依赖的package包/类
/**
 * Sets the listview or gridview's item click listener of the view
 *
 * @param viewId   The view id.
 * @param listener The item on click listener;
 * @return The BaseViewHolder for chaining.
 * Please use {@link #addOnClickListener(int)} (int)} (adapter.setOnItemChildClickListener(listener))}
 */
@Deprecated
public BaseViewHolder setOnItemClickListener(int viewId, AdapterView.OnItemClickListener listener) {
    AdapterView view = getView(viewId);
    view.setOnItemClickListener(listener);
    return this;
}
 
开发者ID:liu-xiao-dong,项目名称:JD-Test,代码行数:15,代码来源:BaseViewHolder.java


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