Skip to content

Conversation

@arihant-001
Copy link

No description provided.

@hareshkh
Copy link
Collaborator

hareshkh commented Feb 8, 2017

  • Directory names need to be in lower case and should not begin with a capital letter
  • Use proper code formatting. This is very easy to achieve by just using a key binding of the android studio : Ctrl + Alt + L . This formats the code of the active file properly.

@hareshkh
Copy link
Collaborator

hareshkh commented Feb 8, 2017

Also there is no need of the package arihant that you have made. All its contents can be in the main package.

android:layout_height="match_parent"
android:background="#466"
tools:context="com.sdsmdg.hareshkh.lectureassignment.arihant.Activities.RecyclerViewActivity">
<android.support.v7.widget.RecyclerView
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

RecyclerView is an extension of a viewgroup, and can be used as root layout in absence of other views, which is the case here.

@@ -0,0 +1,46 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is preferable to use a single Relative Layout instead of nested Linear Layouts

@Override
public void onBindViewHolder(RecyclerView.ViewHolder holder, final int position) {
final MovieModel movieModel = movieModels.get(position);
((Item)holder).itemName.setText(movieModel.getName());
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OnBindViewholder can have first parameter as the object of your custom viewHolder ie item so holder does not need to cast to “Item” for every object. Refer AndroidHive again.

@harjot-oberai
Copy link

Package names must be in lower case, haresh already told you to do that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants