SHARE
TWEET

Untitled

a guest Jun 18th, 2019 56 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. mListView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
  2.         @Override
  3.         public void onItemClick(AdapterView<?> adapterView, View view, int
  4. position, long id) {
  5.  
  6.             String selected = (String)
  7. mListView.getItemAtPosition(position);
  8.             mItemTextView = findViewById(R.id.itemWords);
  9.             mItemNumberTextView = findViewById(R.id.itemNumber);
  10.             mId = id;
  11.  
  12.             mBookCopied =
  13. mItemHeaderNameTextView.getText().toString();
  14.             mItemCategoryNumberCopied = Integer.toString(mCategorySelected + 1);
  15.             mItemNumberCopied =
  16. mItemNumberTextView.getText().toString();
  17.             mPosition = position + 1;
  18.             mCopiedItemListItem = mItemCopied + " " +
  19. mCategoryNumberCopied + ":" + mPosition + "nn" + selected;
  20.  
  21.             showMenu(view);
  22.         }
  23.     });
  24.      
  25. public ItemAdapter(Context context, int resource1, List<String> items) {
  26.     super(context, resource1, items);
  27.     mContext = context;
  28.     mResource1 = resource1;
  29.     mItems= items;
  30.  
  31. }
  32.  
  33. @NonNull
  34. @Override
  35. public View getView(int position, @Nullable View convertView, @NonNull ViewGroup parent) {
  36.  
  37.     View listItem = convertView;
  38.     int pos = position + 1;
  39.  
  40.     if (listItem == null) {
  41.         listItem = LayoutInflater.from(mContext).inflate(mResource1, parent, false);
  42.     }
  43.     mItemNumberTextView = (TextView) listItem.findViewById(R.id.itemNumber);
  44.     mItemumberTextView.setText(String.valueOf(pos) + " ");
  45.  
  46.     mItemTextView = (TextView) listItem.findViewById(R.id.itemWords);
  47.     mItemTextView.setText(mItems.get(position));
  48.  
  49.     }
  50.  
  51.     return listItem;
  52. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top