Search code examples
javaandroidandroid-layoutandroid-recyclerviewandroid-cardview

Android CardView implementation


I created an Android app with list view. Whenever the an element is clicked, it passes intent to cardview.I have a single cardview in my layout file, and use it for every element in the listView.

For each list item, I define different implementation for the CardView in Java passing intents from one java file to the other. .

Please is this a good practice using a single card view and Recycler View for multiple elements changing their text programmatically. I haven't seen anyone do something like that.

Edit @Ankit something like ...

Something like

>
<android.support.v7.widget.RecyclerView/>
</LinearLayout>```



**Tutorial page 1**
       ```public class Lesson_Galaxy_One extends AppCompatActivity
{ super.onCreate(savedInstanceState);
        setContentView(R.layout.lesson_galaxy);

}```


**Tutorial 2**
       ```public class Lesson_Galaxy_Two extends AppCompatActivity
{ super.onCreate(savedInstanceState);
        setContentView(R.layout.lesson_galaxy);

}```

**Tutorial 3**
       ```public class Lesson_Galaxy_Three extends AppCompatActivity
{ super.onCreate(savedInstanceState);
        setContentView(R.layout.lesson_galaxy);

}```


Each with different elements for the RecyclerView's CardView with intents being passed from one to the other.

Solution

  • There won't be any issues of using a single card view for multiple list items.It's totally fine .