English 中文(简体)
Anders ListView and EditText with Live data
原标题:Android ListView and EditTexts with live data

我有一份简单的清单,由我的ArrayAdapter支持,每秒5秒左右更新一次,有新的数据。 每5秒,Im援引通知DataSetChanged在我的ArrayAdapter上,结果名单中重新引用新数据。 所有这一切都奏效,每5秒看到新数据。

然而,在我的ArrayAdapter的收听方法中,Im 冲锋相对,包括EditText。 在这里,我试图解决问题:

  1. User has selected the EditText in one of the rows and types in some input.
  2. User stays focused on the EditText for more than 5 seconds.
  3. notifyDataSetChanged gets invoked as new data has arrived in my array adapter.
  4. User loses focus on the EditText as it has been redrawn. notifyDataSetChanged seems to result in all ListView elements getting redrawn.

允许用户继续关注EditText但确保数据总是新鲜的最佳途径是什么?

Thanks,

海 地

问题回答

这也许不是最佳途径,而是快捷的方式。 超出标准通知了数据交换,如果你有重点的内容(或当它得到重点而不是失去重点时储存),则首先进行核对,储存投入,称为超级。 通知 数据集 改动,写上旧价值。

如果适应者的项目太多,这也许不是一个好的解决方案。





相关问题
Android - ListView fling gesture triggers context menu

I m relatively new to Android development. I m developing an app with a ListView. I ve followed the info in #1338475 and have my app recognizing the fling gesture, but after the gesture is complete, ...

AsyncTask and error handling on Android

I m converting my code from using Handler to AsyncTask. The latter is great at what it does - asynchronous updates and handling of results in the main UI thread. What s unclear to me is how to handle ...

Android intent filter for a particular file extension?

I want to be able to download a file with a particular extension from the net, and have it passed to my application to deal with it, but I haven t been able to figure out the intent filter. The ...

Android & Web: What is the equivalent style for the web?

I am quite impressed by the workflow I follow when developing Android applications: Define a layout in an xml file and then write all the code in a code-behind style. Is there an equivalent style for ...

TiledLayer equivalent in Android [duplicate]

To draw landscapes, backgrounds with patterns etc, we used TiledLayer in J2ME. Is there an android counterpart for that. Does android provide an option to set such tiled patterns in the layout XML?

Using Repo with Msysgit

When following the Android Open Source Project instructions on installing repo for use with Git, after running the repo init command, I run into this error: /c/Users/Andrew Rabon/bin/repo: line ...

Android "single top" launch mode and onNewIntent method

I read in the Android documentation that by setting my Activity s launchMode property to singleTop OR by adding the FLAG_ACTIVITY_SINGLE_TOP flag to my Intent, that calling startActivity(intent) would ...

From Web Development to Android Development

I have pretty good skills in PHP , Mysql and Javascript for a junior developer. If I wanted to try my hand as Android Development do you think I might find it tough ? Also what new languages would I ...

热门标签