Search code examples
androidandroid-activity

Allow a user to "create a new Activity" for themselves?


I've completed the mini tutorial Android Studio provides for itself, so as far as I'm aware, there's no way for a user to create a new Activity themselves. My goal is for the main activity to have a button which, when pressed, allows the user to create a new page, fill it with information, and then have the main activity link to the new page. I might be thinking about it the wrong way (maybe that's not an activity?), but can someone let me know how I can do that? Thank you!


Solution

  • You can't have them "create a new activity", but you could do something that appears to do so to the user.

    For example, you could create an activity CustomActivity which is built up programmatically from a data structure you define CustomActivityConfiguration.

    The user could set up multiple instances of the CustomActivityConfiguration object by whatever GUI you provide to do that, and when they click "Launch My Activity A", for example, you launch CustomActivity and pass the appropriate configuration to it.