简体   繁体   English

如何从Android应用程序提取通用代码并将其包含到库模块中

[英]How to extract common code from Android applications and include that to a library module

I have a project where i need to just create a webview which points to a website. 我有一个项目,我只需要创建一个指向网站的网络视图即可。 In the future i might need to create many similar apps with minor changes; 将来,我可能需要创建许多类似的应用程序,但要进行细微的更改。 1)Changing the endpoint of the webview 2)Changing the app icon 3)Changing the splash screen 1)更改Webview的端点2)更改应用程序图标3)更改初始屏幕

How should i create this library? 我应该如何创建这个库? Is it good practice to include activities in a library ? 将活动纳入图书馆是一种好习惯吗? Which parts of the code should be included in the library? 库中应包括代码的哪些部分?

On creating the library, this might help you: https://developer.android.com/studio/projects/android-library.html 在创建库时,这可能会对您有所帮助: https : //developer.android.com/studio/projects/android-library.html

Every part of the code that is reusable should be included. 应包括可重用的代码的每个部分。

EDIT: You should put the activity in the library, if it is reusable. 编辑:如果可重用,您应该将活动放在库中。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM