Closed dattran2346 closed 7 years ago
Thanks for your suggestion, @dattran2346 I'm trying improve my prework. I'm a beginner in Android, I have learned from many toturials online. There are few issues that I'm not fully understood.
@ledaian41 What issue are you not really understood? Perhaps I can help you? Ps: Sorry for late reply to you ðŸ˜
@dattran2346
@ledaian41
RecyclerViewAdapter
:@Override
public void onBindViewHolder(RecyclerView.ViewHolder holder, int position) {
holder.itemView.setOnClickListener(v -> {
});
}
Activity
is the subclass of Context
; but View
has Context
, you can see that in View construction. People usually pass the activity via RecyclerAdapter construction, the ViewGroup is actually the RecyclerView where the Adapter attach to. Because ViewGroup is also a View, so you can also use Context from ViewGroup. Choose whatever you favor.Ps: Does that make sense to you?
@dattran2346 Thank you, I have understood about Context and have handled onItemClick event in RecyclerViewAdapter. Many thanks,
Thank you for your submission
Good Stuff
ArrayAdapter
withListView
SQLOpenHelper
andContentValues
Suggesstions
RecyclerView
andRecyclerAdapter
, they are very similar toListView
andArrayAdapter
putExtra("item")
, you can extract theitem
string intopublic final String ITEM = "item"
constant, I have seen people make bugs because they mistype the wordfindViewById()
boilerplate code, they also supportonClick()
very nicelySave
andCancel
button, try usingItemMenu
andToolbar
instead, that will look definitely better