In the application, sometimes, the entire code is same except the name of the activity for the next process. If there is a way to make the name of the activity string variable, then what the programmer only has to do would be changeing the string name.
For example,
private static string ActivityName = "com.brbr.brbr.ListenerActivity";
..
ActivityName.listener = new onfunctionnameListener(){
..
though this isn't working.
The currently working code goes like this.
..
ListenerActivity.listener = new onfunctionnameListener(){
..
Let's share the opinions toward the java, string concept :)
If I understood your problem correctly, I would propose to use a parent class that already implements all your methods, eg ActivityForm
.
After this class could after that be extended by your other activities and so you do just have to override the methods where the code differs.
A tutorial and a bit more information can be fount here .
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.