Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/232.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
下载数据并将其设置为android中的listview适配器_Android - Fatal编程技术网

下载数据并将其设置为android中的listview适配器

下载数据并将其设置为android中的listview适配器,android,Android,我正在构建一个android应用程序,使用Json从mysql远程服务器下载数据库记录。然后,我将下载的数据设置为我的listview适配器,并将其显示给用户。这意味着,用户只有在连接到internet时才能访问数据 现在,我希望用户能够查看来自远程服务器数据库的atmost 20记录,即使他处于脱机状态。这还意味着我必须将一些数据保存到本地数据库中,并在用户脱机时预览它 MY LOGICS. 1. I save the newest (20 records) into the

我正在构建一个android应用程序,使用Json从mysql远程服务器下载数据库记录。然后,我将下载的数据设置为我的listview适配器,并将其显示给用户。这意味着,用户只有在连接到internet时才能访问数据

现在,我希望用户能够查看来自远程服务器数据库的atmost 20记录,即使他处于脱机状态。这还意味着我必须将一些数据保存到本地数据库中,并在用户脱机时预览它

    MY LOGICS.

    1. I save the newest (20 records) into the local database, anytime the activity loads new set of data from the remote server database

    2. I then truncate the already existing data in the local database to open way for the newest set of data from the remote server. This means, the local database would have the maximum of 20 records at any point in time.

    3. I show these 20 records from the local database to the user anytime there he is offline
问题:

请注意,我正在执行上述逻辑以将数据从远程服务器数据库设置到我的listview中,我想知道我所做的是标准方法还是有标准方法来实现这一点。我想实现facebook和twitter处理其帖子或新闻提要活动的相同方式。任何想法都值得赞赏。提前谢谢