Skip to content

Instantly share code, notes, and snippets.

@PierfrancescoSoffritti
Last active February 14, 2019 07:33
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save PierfrancescoSoffritti/8a64b583f9c40caa25041a6500302b75 to your computer and use it in GitHub Desktop.
Save PierfrancescoSoffritti/8a64b583f9c40caa25041a6500302b75 to your computer and use it in GitHub Desktop.
How to build sample apps for Android libraries with just a few lines of code.
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
val intent = Intent(this, SampleAppTemplateActivity::class.java)
intent.putExtra(Constants.TITLE.name, getString(R.string.title))
intent.putExtra(Constants.GITHUB_URL.name, "https://github.com/username/repo")
intent.putExtra(Constants.HOMEPAGE_URL.name(), "https://github.com/username/repo/README.md");
intent.putExtra(Constants.PLAYSTORE_PACKAGE_NAME.name(), "com.name.appname");
val examples = arrayOf(
ExampleActivityDetails(R.string.name1, R.drawable.icon, ExampleActivity1::class.java),
ExampleActivityDetails(R.string.name2, null, ExampleActivity2::class.java)
)
intent.putExtra(Constants.EXAMPLES.name, examples)
startActivity(intent)
finish()
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment