PagedListAdapter.submitList() Behaving Weird When Updating Existing Items
Little story of this topic : the app just updating clicked row's values with dialog when confirmed. Uses pagination scenario on room database.
When an item added or removed, the latest dataset is fetched and passed to submitList method, then all changes are seen and worked well.
The problem starts there, if an existing item updated, again the latest dataset is fetched properly and passed to submitList, but this time changes didn't seem.
When i debug the DIFF_CALLBACK
and caught my item in areItemsTheSame
, the newHistory
and oldHistory
values are same! (How!)
There could be any bug in submitList
method ?
- Room v. : 2.1.0-alpha02
- Paging v. : 2.1.0-beta01
After initializing, observe
fetches list from room and passes to mHistoryAdapter.submitList(it)
. Then if i update an item, observe gets triggered again(and i'm seeing updated value in param it
) and passes to submitList
.
Unfortunately, adapter wont change...
mResolvedAddressViewModel = ViewModelProviders.of(this).get(ResolvedAddressViewModel::class.java)
mResolvedAddressViewModel.getAddresses(false).observe(this, Observer {
mHistoryAdapter.submitList(it)
})
All the parts
Model
@Parcelize
@Entity
data class ResolvedAddress(
@PrimaryKey var id: String = UUID.randomUUID().toString(),
var requestedLat: Double = 0.0,
var requestedLon: Double = 0.0,
var requestedAddress: String = "",
var lat: Double,
var lon: Double,
var address: String,
var country: String,
var countryCode: String,
var city: String,
var alias: String? = null,
var favorite: Boolean = false,
var provider: String? = null,
var lastUseDate: Long = 0L) : Parcelable
Adapter
class HistoryAdapter(var context: Context)
: PagedListAdapter<ResolvedAddress, HistoryItemHolder>(DIFF_CALLBACK) {
companion object {
private val DIFF_CALLBACK = object : DiffUtil.ItemCallback<ResolvedAddress>() {
override fun areItemsTheSame(
oldHistory: ResolvedAddress, newHistory: ResolvedAddress): Boolean {
return oldHistory.id == newHistory.id
}
override fun areContentsTheSame(
oldHistory: ResolvedAddress, newHistory: ResolvedAddress): Boolean {
return oldHistory == newHistory
}
}
}
}
Fragment
class HistoryFragment : Fragment() {
private lateinit var mHistoryAdapter: HistoryAdapter
private lateinit var mResolvedAddressViewModel: ResolvedAddressViewModel
override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?,
savedInstanceState: Bundle?): View? {
return inflater.inflate(R.layout.fragment_history, container, false)
}
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
super.onViewCreated(view, savedInstanceState)
recyclerViewHistory.setHasFixedSize(true)
recyclerViewHistory.layoutManager = LinearLayoutManager(activity)
recyclerViewHistory.itemAnimator = DefaultItemAnimator()
mHistoryAdapter = HistoryAdapter(context!!)
recyclerViewHistory.adapter = mHistoryAdapter
mResolvedAddressViewModel = ViewModelProviders.of(this)
.get(ResolvedAddressViewModel::class.java)
mResolvedAddressViewModel.getAddresses(false).observe(this, Observer {
mHistoryAdapter.submitList(it)
})
}
}
android android-architecture-components androidx android-paging
add a comment |
Little story of this topic : the app just updating clicked row's values with dialog when confirmed. Uses pagination scenario on room database.
When an item added or removed, the latest dataset is fetched and passed to submitList method, then all changes are seen and worked well.
The problem starts there, if an existing item updated, again the latest dataset is fetched properly and passed to submitList, but this time changes didn't seem.
When i debug the DIFF_CALLBACK
and caught my item in areItemsTheSame
, the newHistory
and oldHistory
values are same! (How!)
There could be any bug in submitList
method ?
- Room v. : 2.1.0-alpha02
- Paging v. : 2.1.0-beta01
After initializing, observe
fetches list from room and passes to mHistoryAdapter.submitList(it)
. Then if i update an item, observe gets triggered again(and i'm seeing updated value in param it
) and passes to submitList
.
Unfortunately, adapter wont change...
mResolvedAddressViewModel = ViewModelProviders.of(this).get(ResolvedAddressViewModel::class.java)
mResolvedAddressViewModel.getAddresses(false).observe(this, Observer {
mHistoryAdapter.submitList(it)
})
All the parts
Model
@Parcelize
@Entity
data class ResolvedAddress(
@PrimaryKey var id: String = UUID.randomUUID().toString(),
var requestedLat: Double = 0.0,
var requestedLon: Double = 0.0,
var requestedAddress: String = "",
var lat: Double,
var lon: Double,
var address: String,
var country: String,
var countryCode: String,
var city: String,
var alias: String? = null,
var favorite: Boolean = false,
var provider: String? = null,
var lastUseDate: Long = 0L) : Parcelable
Adapter
class HistoryAdapter(var context: Context)
: PagedListAdapter<ResolvedAddress, HistoryItemHolder>(DIFF_CALLBACK) {
companion object {
private val DIFF_CALLBACK = object : DiffUtil.ItemCallback<ResolvedAddress>() {
override fun areItemsTheSame(
oldHistory: ResolvedAddress, newHistory: ResolvedAddress): Boolean {
return oldHistory.id == newHistory.id
}
override fun areContentsTheSame(
oldHistory: ResolvedAddress, newHistory: ResolvedAddress): Boolean {
return oldHistory == newHistory
}
}
}
}
Fragment
class HistoryFragment : Fragment() {
private lateinit var mHistoryAdapter: HistoryAdapter
private lateinit var mResolvedAddressViewModel: ResolvedAddressViewModel
override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?,
savedInstanceState: Bundle?): View? {
return inflater.inflate(R.layout.fragment_history, container, false)
}
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
super.onViewCreated(view, savedInstanceState)
recyclerViewHistory.setHasFixedSize(true)
recyclerViewHistory.layoutManager = LinearLayoutManager(activity)
recyclerViewHistory.itemAnimator = DefaultItemAnimator()
mHistoryAdapter = HistoryAdapter(context!!)
recyclerViewHistory.adapter = mHistoryAdapter
mResolvedAddressViewModel = ViewModelProviders.of(this)
.get(ResolvedAddressViewModel::class.java)
mResolvedAddressViewModel.getAddresses(false).observe(this, Observer {
mHistoryAdapter.submitList(it)
})
}
}
android android-architecture-components androidx android-paging
Possible duplicate of ListAdapter not updating item in reyclerview
– Bink
Dec 10 at 19:28
add a comment |
Little story of this topic : the app just updating clicked row's values with dialog when confirmed. Uses pagination scenario on room database.
When an item added or removed, the latest dataset is fetched and passed to submitList method, then all changes are seen and worked well.
The problem starts there, if an existing item updated, again the latest dataset is fetched properly and passed to submitList, but this time changes didn't seem.
When i debug the DIFF_CALLBACK
and caught my item in areItemsTheSame
, the newHistory
and oldHistory
values are same! (How!)
There could be any bug in submitList
method ?
- Room v. : 2.1.0-alpha02
- Paging v. : 2.1.0-beta01
After initializing, observe
fetches list from room and passes to mHistoryAdapter.submitList(it)
. Then if i update an item, observe gets triggered again(and i'm seeing updated value in param it
) and passes to submitList
.
Unfortunately, adapter wont change...
mResolvedAddressViewModel = ViewModelProviders.of(this).get(ResolvedAddressViewModel::class.java)
mResolvedAddressViewModel.getAddresses(false).observe(this, Observer {
mHistoryAdapter.submitList(it)
})
All the parts
Model
@Parcelize
@Entity
data class ResolvedAddress(
@PrimaryKey var id: String = UUID.randomUUID().toString(),
var requestedLat: Double = 0.0,
var requestedLon: Double = 0.0,
var requestedAddress: String = "",
var lat: Double,
var lon: Double,
var address: String,
var country: String,
var countryCode: String,
var city: String,
var alias: String? = null,
var favorite: Boolean = false,
var provider: String? = null,
var lastUseDate: Long = 0L) : Parcelable
Adapter
class HistoryAdapter(var context: Context)
: PagedListAdapter<ResolvedAddress, HistoryItemHolder>(DIFF_CALLBACK) {
companion object {
private val DIFF_CALLBACK = object : DiffUtil.ItemCallback<ResolvedAddress>() {
override fun areItemsTheSame(
oldHistory: ResolvedAddress, newHistory: ResolvedAddress): Boolean {
return oldHistory.id == newHistory.id
}
override fun areContentsTheSame(
oldHistory: ResolvedAddress, newHistory: ResolvedAddress): Boolean {
return oldHistory == newHistory
}
}
}
}
Fragment
class HistoryFragment : Fragment() {
private lateinit var mHistoryAdapter: HistoryAdapter
private lateinit var mResolvedAddressViewModel: ResolvedAddressViewModel
override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?,
savedInstanceState: Bundle?): View? {
return inflater.inflate(R.layout.fragment_history, container, false)
}
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
super.onViewCreated(view, savedInstanceState)
recyclerViewHistory.setHasFixedSize(true)
recyclerViewHistory.layoutManager = LinearLayoutManager(activity)
recyclerViewHistory.itemAnimator = DefaultItemAnimator()
mHistoryAdapter = HistoryAdapter(context!!)
recyclerViewHistory.adapter = mHistoryAdapter
mResolvedAddressViewModel = ViewModelProviders.of(this)
.get(ResolvedAddressViewModel::class.java)
mResolvedAddressViewModel.getAddresses(false).observe(this, Observer {
mHistoryAdapter.submitList(it)
})
}
}
android android-architecture-components androidx android-paging
Little story of this topic : the app just updating clicked row's values with dialog when confirmed. Uses pagination scenario on room database.
When an item added or removed, the latest dataset is fetched and passed to submitList method, then all changes are seen and worked well.
The problem starts there, if an existing item updated, again the latest dataset is fetched properly and passed to submitList, but this time changes didn't seem.
When i debug the DIFF_CALLBACK
and caught my item in areItemsTheSame
, the newHistory
and oldHistory
values are same! (How!)
There could be any bug in submitList
method ?
- Room v. : 2.1.0-alpha02
- Paging v. : 2.1.0-beta01
After initializing, observe
fetches list from room and passes to mHistoryAdapter.submitList(it)
. Then if i update an item, observe gets triggered again(and i'm seeing updated value in param it
) and passes to submitList
.
Unfortunately, adapter wont change...
mResolvedAddressViewModel = ViewModelProviders.of(this).get(ResolvedAddressViewModel::class.java)
mResolvedAddressViewModel.getAddresses(false).observe(this, Observer {
mHistoryAdapter.submitList(it)
})
All the parts
Model
@Parcelize
@Entity
data class ResolvedAddress(
@PrimaryKey var id: String = UUID.randomUUID().toString(),
var requestedLat: Double = 0.0,
var requestedLon: Double = 0.0,
var requestedAddress: String = "",
var lat: Double,
var lon: Double,
var address: String,
var country: String,
var countryCode: String,
var city: String,
var alias: String? = null,
var favorite: Boolean = false,
var provider: String? = null,
var lastUseDate: Long = 0L) : Parcelable
Adapter
class HistoryAdapter(var context: Context)
: PagedListAdapter<ResolvedAddress, HistoryItemHolder>(DIFF_CALLBACK) {
companion object {
private val DIFF_CALLBACK = object : DiffUtil.ItemCallback<ResolvedAddress>() {
override fun areItemsTheSame(
oldHistory: ResolvedAddress, newHistory: ResolvedAddress): Boolean {
return oldHistory.id == newHistory.id
}
override fun areContentsTheSame(
oldHistory: ResolvedAddress, newHistory: ResolvedAddress): Boolean {
return oldHistory == newHistory
}
}
}
}
Fragment
class HistoryFragment : Fragment() {
private lateinit var mHistoryAdapter: HistoryAdapter
private lateinit var mResolvedAddressViewModel: ResolvedAddressViewModel
override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?,
savedInstanceState: Bundle?): View? {
return inflater.inflate(R.layout.fragment_history, container, false)
}
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
super.onViewCreated(view, savedInstanceState)
recyclerViewHistory.setHasFixedSize(true)
recyclerViewHistory.layoutManager = LinearLayoutManager(activity)
recyclerViewHistory.itemAnimator = DefaultItemAnimator()
mHistoryAdapter = HistoryAdapter(context!!)
recyclerViewHistory.adapter = mHistoryAdapter
mResolvedAddressViewModel = ViewModelProviders.of(this)
.get(ResolvedAddressViewModel::class.java)
mResolvedAddressViewModel.getAddresses(false).observe(this, Observer {
mHistoryAdapter.submitList(it)
})
}
}
android android-architecture-components androidx android-paging
android android-architecture-components androidx android-paging
edited Nov 24 at 10:52
asked Nov 21 at 7:51
blackkara
2,48241338
2,48241338
Possible duplicate of ListAdapter not updating item in reyclerview
– Bink
Dec 10 at 19:28
add a comment |
Possible duplicate of ListAdapter not updating item in reyclerview
– Bink
Dec 10 at 19:28
Possible duplicate of ListAdapter not updating item in reyclerview
– Bink
Dec 10 at 19:28
Possible duplicate of ListAdapter not updating item in reyclerview
– Bink
Dec 10 at 19:28
add a comment |
1 Answer
1
active
oldest
votes
There's a couple things missing from the question that could help provide a more detailed answer.
Ex. What does your RecyclerView.Adapter
look like? Does it extend PagedListAdapter
?
What does your model class look like? Is it a Kotlin data class?
For the sake of providing an answer, let's assume those unknowns are what we expect.
If I understand the question, it seems like you're just updating
an item and not removing or adding any items.
Therefore, the DiffUtil.ItemCallback
's areItemsTheSame
will always return true, because the old list and new list has not been modified in terms of their size.
Meaning, if you've updated an item, you've probably updated it's contents and not removed it from the list.
Therefore, areItemsTheSame
will return true, because their ids are still the same.
It's more likely that the second method, areContentsTheSame
will return false since you've updated the item's content.
If your model class, ResolvedAddress
, is a Kotlin data class, then the method areContentsTheSame
should return false when comparing the item that was updated from the old list and the new list. This should trigger the onBindViewHolder
method in your adapter at this point for you to rebind that item with the updated data.
If that model is not a Kotlin data class
, than you must make sure the class implements the compareTo
method. If not, you are comparing the object's memory address vs the actual contents of the object. If that is the case, the method areContentsTheSame
will always return true, since the object's memory address has not changed.
These are some debugging tips, as it is difficult to provide a clearer answer without more knowledge about how the code has been implemented.
I've just updated question. Therefore, areItemsTheSame will return true, because their ids are still the same yesareItemsTheSame
return true and also id of both models same too. But interesting part is why i'm seeing theoldHistory
as updated ??
– blackkara
Nov 24 at 11:01
It's more likely that the second method, areContentsTheSame will return false since you've updated the item's content No, as i saidoldHistory
andnewHistory
are fully same. AndoldHistory
is also updated.
– blackkara
Nov 24 at 11:05
1
Did you solve this? Having the same issue.
– Nick Nelson
Dec 10 at 13:03
@NickNelson Unfortunately not yet.
– blackkara
Dec 15 at 19:43
add a comment |
Your Answer
StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53407419%2fpagedlistadapter-submitlist-behaving-weird-when-updating-existing-items%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
There's a couple things missing from the question that could help provide a more detailed answer.
Ex. What does your RecyclerView.Adapter
look like? Does it extend PagedListAdapter
?
What does your model class look like? Is it a Kotlin data class?
For the sake of providing an answer, let's assume those unknowns are what we expect.
If I understand the question, it seems like you're just updating
an item and not removing or adding any items.
Therefore, the DiffUtil.ItemCallback
's areItemsTheSame
will always return true, because the old list and new list has not been modified in terms of their size.
Meaning, if you've updated an item, you've probably updated it's contents and not removed it from the list.
Therefore, areItemsTheSame
will return true, because their ids are still the same.
It's more likely that the second method, areContentsTheSame
will return false since you've updated the item's content.
If your model class, ResolvedAddress
, is a Kotlin data class, then the method areContentsTheSame
should return false when comparing the item that was updated from the old list and the new list. This should trigger the onBindViewHolder
method in your adapter at this point for you to rebind that item with the updated data.
If that model is not a Kotlin data class
, than you must make sure the class implements the compareTo
method. If not, you are comparing the object's memory address vs the actual contents of the object. If that is the case, the method areContentsTheSame
will always return true, since the object's memory address has not changed.
These are some debugging tips, as it is difficult to provide a clearer answer without more knowledge about how the code has been implemented.
I've just updated question. Therefore, areItemsTheSame will return true, because their ids are still the same yesareItemsTheSame
return true and also id of both models same too. But interesting part is why i'm seeing theoldHistory
as updated ??
– blackkara
Nov 24 at 11:01
It's more likely that the second method, areContentsTheSame will return false since you've updated the item's content No, as i saidoldHistory
andnewHistory
are fully same. AndoldHistory
is also updated.
– blackkara
Nov 24 at 11:05
1
Did you solve this? Having the same issue.
– Nick Nelson
Dec 10 at 13:03
@NickNelson Unfortunately not yet.
– blackkara
Dec 15 at 19:43
add a comment |
There's a couple things missing from the question that could help provide a more detailed answer.
Ex. What does your RecyclerView.Adapter
look like? Does it extend PagedListAdapter
?
What does your model class look like? Is it a Kotlin data class?
For the sake of providing an answer, let's assume those unknowns are what we expect.
If I understand the question, it seems like you're just updating
an item and not removing or adding any items.
Therefore, the DiffUtil.ItemCallback
's areItemsTheSame
will always return true, because the old list and new list has not been modified in terms of their size.
Meaning, if you've updated an item, you've probably updated it's contents and not removed it from the list.
Therefore, areItemsTheSame
will return true, because their ids are still the same.
It's more likely that the second method, areContentsTheSame
will return false since you've updated the item's content.
If your model class, ResolvedAddress
, is a Kotlin data class, then the method areContentsTheSame
should return false when comparing the item that was updated from the old list and the new list. This should trigger the onBindViewHolder
method in your adapter at this point for you to rebind that item with the updated data.
If that model is not a Kotlin data class
, than you must make sure the class implements the compareTo
method. If not, you are comparing the object's memory address vs the actual contents of the object. If that is the case, the method areContentsTheSame
will always return true, since the object's memory address has not changed.
These are some debugging tips, as it is difficult to provide a clearer answer without more knowledge about how the code has been implemented.
I've just updated question. Therefore, areItemsTheSame will return true, because their ids are still the same yesareItemsTheSame
return true and also id of both models same too. But interesting part is why i'm seeing theoldHistory
as updated ??
– blackkara
Nov 24 at 11:01
It's more likely that the second method, areContentsTheSame will return false since you've updated the item's content No, as i saidoldHistory
andnewHistory
are fully same. AndoldHistory
is also updated.
– blackkara
Nov 24 at 11:05
1
Did you solve this? Having the same issue.
– Nick Nelson
Dec 10 at 13:03
@NickNelson Unfortunately not yet.
– blackkara
Dec 15 at 19:43
add a comment |
There's a couple things missing from the question that could help provide a more detailed answer.
Ex. What does your RecyclerView.Adapter
look like? Does it extend PagedListAdapter
?
What does your model class look like? Is it a Kotlin data class?
For the sake of providing an answer, let's assume those unknowns are what we expect.
If I understand the question, it seems like you're just updating
an item and not removing or adding any items.
Therefore, the DiffUtil.ItemCallback
's areItemsTheSame
will always return true, because the old list and new list has not been modified in terms of their size.
Meaning, if you've updated an item, you've probably updated it's contents and not removed it from the list.
Therefore, areItemsTheSame
will return true, because their ids are still the same.
It's more likely that the second method, areContentsTheSame
will return false since you've updated the item's content.
If your model class, ResolvedAddress
, is a Kotlin data class, then the method areContentsTheSame
should return false when comparing the item that was updated from the old list and the new list. This should trigger the onBindViewHolder
method in your adapter at this point for you to rebind that item with the updated data.
If that model is not a Kotlin data class
, than you must make sure the class implements the compareTo
method. If not, you are comparing the object's memory address vs the actual contents of the object. If that is the case, the method areContentsTheSame
will always return true, since the object's memory address has not changed.
These are some debugging tips, as it is difficult to provide a clearer answer without more knowledge about how the code has been implemented.
There's a couple things missing from the question that could help provide a more detailed answer.
Ex. What does your RecyclerView.Adapter
look like? Does it extend PagedListAdapter
?
What does your model class look like? Is it a Kotlin data class?
For the sake of providing an answer, let's assume those unknowns are what we expect.
If I understand the question, it seems like you're just updating
an item and not removing or adding any items.
Therefore, the DiffUtil.ItemCallback
's areItemsTheSame
will always return true, because the old list and new list has not been modified in terms of their size.
Meaning, if you've updated an item, you've probably updated it's contents and not removed it from the list.
Therefore, areItemsTheSame
will return true, because their ids are still the same.
It's more likely that the second method, areContentsTheSame
will return false since you've updated the item's content.
If your model class, ResolvedAddress
, is a Kotlin data class, then the method areContentsTheSame
should return false when comparing the item that was updated from the old list and the new list. This should trigger the onBindViewHolder
method in your adapter at this point for you to rebind that item with the updated data.
If that model is not a Kotlin data class
, than you must make sure the class implements the compareTo
method. If not, you are comparing the object's memory address vs the actual contents of the object. If that is the case, the method areContentsTheSame
will always return true, since the object's memory address has not changed.
These are some debugging tips, as it is difficult to provide a clearer answer without more knowledge about how the code has been implemented.
answered Nov 23 at 16:10
Felipe Roriz
1244
1244
I've just updated question. Therefore, areItemsTheSame will return true, because their ids are still the same yesareItemsTheSame
return true and also id of both models same too. But interesting part is why i'm seeing theoldHistory
as updated ??
– blackkara
Nov 24 at 11:01
It's more likely that the second method, areContentsTheSame will return false since you've updated the item's content No, as i saidoldHistory
andnewHistory
are fully same. AndoldHistory
is also updated.
– blackkara
Nov 24 at 11:05
1
Did you solve this? Having the same issue.
– Nick Nelson
Dec 10 at 13:03
@NickNelson Unfortunately not yet.
– blackkara
Dec 15 at 19:43
add a comment |
I've just updated question. Therefore, areItemsTheSame will return true, because their ids are still the same yesareItemsTheSame
return true and also id of both models same too. But interesting part is why i'm seeing theoldHistory
as updated ??
– blackkara
Nov 24 at 11:01
It's more likely that the second method, areContentsTheSame will return false since you've updated the item's content No, as i saidoldHistory
andnewHistory
are fully same. AndoldHistory
is also updated.
– blackkara
Nov 24 at 11:05
1
Did you solve this? Having the same issue.
– Nick Nelson
Dec 10 at 13:03
@NickNelson Unfortunately not yet.
– blackkara
Dec 15 at 19:43
I've just updated question. Therefore, areItemsTheSame will return true, because their ids are still the same yes
areItemsTheSame
return true and also id of both models same too. But interesting part is why i'm seeing the oldHistory
as updated ??– blackkara
Nov 24 at 11:01
I've just updated question. Therefore, areItemsTheSame will return true, because their ids are still the same yes
areItemsTheSame
return true and also id of both models same too. But interesting part is why i'm seeing the oldHistory
as updated ??– blackkara
Nov 24 at 11:01
It's more likely that the second method, areContentsTheSame will return false since you've updated the item's content No, as i said
oldHistory
and newHistory
are fully same. And oldHistory
is also updated.– blackkara
Nov 24 at 11:05
It's more likely that the second method, areContentsTheSame will return false since you've updated the item's content No, as i said
oldHistory
and newHistory
are fully same. And oldHistory
is also updated.– blackkara
Nov 24 at 11:05
1
1
Did you solve this? Having the same issue.
– Nick Nelson
Dec 10 at 13:03
Did you solve this? Having the same issue.
– Nick Nelson
Dec 10 at 13:03
@NickNelson Unfortunately not yet.
– blackkara
Dec 15 at 19:43
@NickNelson Unfortunately not yet.
– blackkara
Dec 15 at 19:43
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Some of your past answers have not been well-received, and you're in danger of being blocked from answering.
Please pay close attention to the following guidance:
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53407419%2fpagedlistadapter-submitlist-behaving-weird-when-updating-existing-items%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Possible duplicate of ListAdapter not updating item in reyclerview
– Bink
Dec 10 at 19:28