I need help on a specific task :
I have a ListView in my main activity with a custom Adapter associated, and an OnItemLongClick listener that displays a Dialog with many operations configured (change quantity, cancel item…) and it works like a charm.
My goal is to have a physical copy of the clicked item in the Dialog, to display immediately the changes made.
Since my ListView item is complex and designed by the Adapter, i can’t just get the reference to the original object, i need a visual copy of the selected ListView item…
I thought about creating the same structure (ListView and Adapter) with only the selected item associated but it’s kind of heavy…
Is there a simpler solution that can help me in this situation ? I mean real copy of the original ListView Item with changes made in my Dialog done to the original object…
Posting your relavent code may help us to guide you more clearly.
However you can get your object in
onItemLongClick((AdapterView, View, int position, long)usingpositionparams i.enow when showing dialog, pass this
objReferenceto your dialog and when changes made, change the contents of thisobjReferenceand callinstead of passing the
objReferenceto dialog, you can passint positionand while changes made, get the reference to that object, change contents and notify data set changed to Adapter.