Do not know whether people have this situation, to do a new project, the need to use some of the previously written tool classes, and then from the previous written project copy to the new project, this approach does not have any major problems, but the work is too high repetition, not conducive to accumulation.
Can we try another solution? Put the tool class each time you write into a project, and then for other projects to reference, and can be a little bit to improve the toolkit, and eventually become your development tool.
Let me give you a simple example of how to build your own toolkit step-by-step.
1 Create a new Android project--LANDPTF
This removes some code that is not available and retains only two package,controls and tools
Controls put some custom control inside, and the custom controls I wrote on my previous blogs can be put here. I'm not going to dwell on it.
Tools inside tool class, of course, you can specify the location, such as some time management classes, string management classes, network operation classes, unit conversions, picture processing classes, and so on, these basic tools need to accumulate in the project.
2 Package the LANDPTF into a. jar
2.1 Select Item Right---->export pop up the following page
2.2 Select Java---->jar file,next
Left Res removed, all right removed, select the saved path, finish can generate Jar file, copy it to other project Libs
Note: If a layout file is included in your project, you will need to copy the layout file to the new project, the name is not allowed to change, but it is not recommended to do so, which destroys the project's independence.
3 Another way to reference the project as a library for other projects is described below
3.1 Select item right---->properties pop up the following page
3.2 Select Android on the left, check the is library on the right
How do I reference it in other projects???
Also select the item right---->properties pop up the following page
Click Add at the bottom right to select the item for your tool
Summary: In the beginning of the building of the toolkit is recommended to choose the second approach, which helps to debug the changes, when your toolkit is very stable, few modifications can choose the first way to introduce the jar package, or as the company's underlying tool class, its source code for only a few open, you can choose the first way!
I wonder if everyone is interested in it! Hurry up and move on! A bit of accumulation!
Build your own Toolkit for Android