android listview和arrayList数据优化

标签 android mysql arrays database listview

我有 my_songs 表,包括列:

 id (int)
 name (varchar)
 title (varchar)
 photo_url (string)
 lyrics (string)
 date (date)
 info (string)
 genre (varchar)
 file_size (int)
 mp3_url (string)

我的表格包括 10,000 行。我使用 volley 库在我的应用程序的 ListView 中加载歌曲列表:

 select id, name, title, photo_url from my_songs limit 1,20 .....

当用户点击 ListView 项目时:

 select * from my_songs where id = click_item

enter image description here

现在,listview mysongs list arrayList 哪个更好:

A.

 class songsListModel() {
      int id;
      string name;
      string title;
      string photo_url;
 }

 List<songsListModel> songs_list_for_listview = select id, name, title, photo_urel from my_songs;

B.

 class songsListModel() {
      int id;
      string name;
      string title;
      string photo_url;
      string mp3_url;
      string genre;
      string date;
      string lyric;
      string info;
      intfile_size;
 }


 List<songsListModel> songs_list_for_listview = select * from my_songs;

我不想在服务器上点击项目请求以获取其他歌曲详细信息,例如 lyric、mp3_url、genre 和 ....

A方法中,数组中的数据量很大,不会造成什么问题?哪个更好?

最佳答案

从我的角度来看,选项 A. 比 B. 好,因为根据该请求,用户查看列表的时间会更少。当他们点击时,您可以播放歌曲并同时加载有关歌曲的其他信息。因此,用户不会厌倦看到加载。

关于android listview和arrayList数据优化,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37584894/

相关文章:

android - AnalyticService如何处理多个发送

android - View ID 的命名约定是什么?

android - 为什么在android中出现FATAL EXCEPTION的原因?

简单查询上的 Python MySQL 语法错误

Android:无论屏幕类型如何,都将 TextView 保持在位图上的相同位置

mysql - 如何锁定单行

Java 将 INT 数组中的项目添加到 String 数组

java - 有没有一个Java函数可以将有序对数组转换为整数数组?

c++ - 字符串/数组情况 c++

mysql - 带有纯文本输出的 osx mysql gui?