0

I've come across with a problem that has to be really common on Android or any mobile platform. Let's say I have a list of custom objects (e.g. User, Event). I don't know how many items are there in the list. What I need is how do I edit these objects on another screen (layout) and then return the object back to the list. I thought of a few solutions for this, none of them seem to me as clean though:

  • Use SetContentView()- handling which object is being edited and returning it to the list is easy, but I'd have to setup the main screen every time the object is edited, pressing back action would have to be overwritten.
  • use another activity- this seems a clean solution, no problems with setting layout, but data handling is the problem- I don't know how to pass the object to another activity and return it back afterwards. I could use a static class to handle this for me, but it doesn't look as a way it's meant to be done.

I hope I didn't confuse you, so to clarify it you can imagine it as editing an event in Google calendar. Please note that I'm a beginner and I use Xamarin.Android.

czubehead
  • 552
  • 1
  • 5
  • 15
  • There are many samples on Xamarin's site that show how to do similar things. Have you looked at them to see how they do it? The various Tasky samples would probably be a good place to start. – Jason Oct 24 '15 at 15:18
  • To pass data from one layout to another you can use `intent`'s, `SharedPreferense`'s, global defined variables or a `Database`. Search on tutorials how you can do each of those, there are also ons tackoverflow many answers that will help you like this one http://stackoverflow.com/questions/33211449/passing-references-to-activity-intent/33217484#33217484 but what you really need is for start a tutorial on each mentioned subject i wrote. Right know your question is very generic for a straight answer, investigate further and edit the question later with a more specific problem – CDrosos Oct 24 '15 at 23:06

0 Answers0