Android Tutorial Programmatically Adding UI elements - for .Net users

Here's a little tutorial/sample project for users coming from .net

It shows how you can have one activity show lots of ui elements, some hidden, some not within the same activity programmatically. It does not use any layout files or the designer.

An email client is a good example. You could have one panel showing the inbox folders, but when one is clicked, you load the email list onto the second panel and show it, and hide the first panel.

It's easier to think of an activity as an asp.net page.
Activity_Create() pretty much = Page_Load()

Things like rotation invalidate the activity, much like refreshing the browser on an asp.net page causing a server request for a new page/content.
 

Attachments

  • PanelExample.zip
    308.7 KB · Views: 674
Top