In this Android WorldClub tutorial i will show you how to create a custom listview in android studio. I will also implement on item click on listview.
#AndroidWorldClub #customlistview

PLEASE LIKE, SUBSCRIBE, COMMENT, SHARE AND PRESS BELL ICON FOR LATEST VIDEOS

Blog:
fb page:

Source Code Link:

Music License:
ZAYFALL – The Origins (Official Music) by ZAYFALL
Creative Commons — Attribution 3.0 Unported — CC BY 3.0

Music promoted by Audio Library

Nguồn:https://u-os.org/

Xem Thêm Bài Viết Khác:https://u-os.org/cong-nghe

Author

43 Comments

  1. Beatles BOB Reply

    First of all, thank you a lot, but I was wondering how save one of this row in Sharedpreference to keep it even if you close the app or something

  2. When i write postion ==1 it shows a message condition position==1 is always false ?? Any solutions

  3. Not working for me here's the code in a picture https://5.top4top.net/p_1453yayx30.jpg
    Get layout inflater problem any solutions??

  4. henry Gritchen Reply

    MyAdapter gave me error on compilation.The error message is error: code too largePlease sir tell me what to do?This is the code I used in MyAdapter class which is assumed to being hardcoded!if (modellist.get(i).getTitle().equals("Song 901 | ")) {
                        //start NewActivity with title for actionbar and text for textview
                        Intent intent = new Intent(mContext, NewActivity.class);
                        intent.putExtra("actionBarTitle", "song Wordings 745");
                        intent.putExtra("position", 901); //locating the audio files in raw folder
                        intent.putExtra("contentTv", "This is my song words or lyrics for song 901");
                        mContext.startActivity(intent);
                    }

  5. นันทวัฒน์ Reply

    Shortcut key for /! – – so our layout is set – – / still using

  6. Tee Yi Heng Reply

    thank, i learn a lot of things from you. But you forget to change 0 in the if(position==0) to other number.

  7. Sean Rubio Reply

    Sir where did u get the title on the super (c,R.layout.row,R.id.textView1,title); ? tnx

  8. Victor Graphics Reply

    Thanks man, you saved my life

    I already have the return of php, but i was stuck in the customize in the list view
    Now I get it, thanks

  9. TheUnknownGuy Reply

    I had so much trouble trying this until i found your vid… it helped me a lot thank you sir!

  10. Kriswella Lyn Matthew Reply

    Sir, my problem is when I make search filter, the position of the string (for example, there is one row result, in the filter, but.. String in position 0 Stays in its original position 0 .. after the filter..) please reply, if you know what i mean.. I need to finish my project ASAP.

  11. doesn't appear list view items, no errors 🙁

    i only need image

    ListView listView;

    int images[] = {R.drawable.supermercadoyalmacen,R.drawable.verduleria};

    @Override

    protected void onCreate(Bundle savedInstanceState) {

    super.onCreate(savedInstanceState);

    setContentView(R.layout.activity_lA);

    listView = findViewById(R.id.listviewM);

    MyAdapter adapter = new MyAdapter(this, images);

    listView.setAdapter(adapter);

    listView.setOnItemClickListener(new AdapterView.OnItemClickListener() {

    @Override

    public void onItemClick(AdapterView<?> parent, View view, int position, long id) {

    if (position == 0)

    {

    Intent intent = new Intent(LA.this, CategoriaActivity.class);

    startActivity(intent);

    }

    if (position == 1)

    {

    Intent intent = new Intent(LA.this, CategoriaActivity.class);

    startActivity(intent);

    }

    }

    });

    }

    class MyAdapter extends ArrayAdapter<String>

    {

    Context context;

    int rImgs[];

    MyAdapter(Context c,int imgs[])

    {

    super(c, R.layout.row_data);

    this.context = c;

    this.rImgs = imgs;

    }

    @NonNull

    @Override

    public View getView(int position, @Nullable View convertView, @NonNull ViewGroup parent) {

    LayoutInflater layoutInflater = (LayoutInflater)getApplicationContext().getSystemService(Context.LAYOUT_INFLATER_SERVICE);

    View row = layoutInflater.inflate(R.layout.row_data, parent, false);

    ImageView images = row.findViewById(R.id.nonoimages);

    images.setImageResource(rImgs[position]);

    return row;

    }

    }

  12. Benjamin Davis Reply

    I added a background xml file (which was just a rectangle with rounded corners) to the row.xml file and although it shows it it only has rounded corners on the right side. Also how can i add padding between the list view rows?

  13. Lidor I Eliyahu Shelef Reply

    awesome video! I've been following you for a while now, and I Was wondering, how can I change the images dynamically? and adding more items with different icons dynamically?

  14. Wilfried Touedi Reply

    hi
    thanks for the tutorial, i did it and it worked for me but i am trying to have two items for each row.So if i have 8 items i wish i could show them on just 4 rows. I tried to do it by adding another Layout in row.xml to have two items on a row and after that i linked it with another properties with a findviewById in the xml as we did with another one.
    now it works i have two items by row but it is just showing the samething on the same row.
    I wish someone could have solution for me thanks

  15. I use a Button to navigate from one activity to another but with this, it just keeps crashing! I've checked everything and have no idea what the problem can be.

  16. manasi kadu Reply

    This code is not working properly, I have tried it 5 times. I receive a blank output.

  17. CS Success Gamer Reply

    the toast messages for setOnItemClickListener doesn't show up when you click on the items.

  18. Pyaar lafzon main Reply

    bhai live tv app banyo list view laga kr or firebase sa control ke jaya possabile hai asea

  19. Yash Gaming Reply

    Ha Ha ! it still takes 20 minutes to build custom list view , In flutter , it can be built in 5 minutes or less 🙂 Try Switching

  20. For some reason the only thing that pops up for me is the image… Any idéa what it can be?

  21. Ewan Fairfull Reply

    Great video but I was wondering if you could show us how to connect these list views with firebase so they can be changed within the application itself. For example the user uploads an image and text which is then displayed in the list view. Im creating my own app and really need your help! Thankyou sir

  22. deojer zepoler Reply

    anyone have an approach for onclick listener for multiple listview

  23. Malak Wehbe Reply

    It gave me 2 errors; one with the: layoutinflater(r.layout.row, parent, false)
    And 2nd one in with new Myadapter(this,…,….,…)

    Does anyone know the solution?

  24. hey sir please answare how to remove that text CostumListView

  25. hey sir how can i move to another activity from that list 1 by 1 tq

  26. The Coding Bus Reply

    well done babu…. thodi awaj lga dete to achha hota

Write A Comment