Android: checking compile time in android

I was wondering if anyone ever created some kind of system that can check the compilation time that intentional add-ons transmit? I pass on additional functions with the intention of starting another action that tells another activity how to behave

(eg:

Intent i = new Intent(CurrentActivity.this, OtherActivity.class); i.putExtra("ShowOverlay", false); startActivity(i); 

)

the problem is that I don’t want future generations of developers to launch this action without sending this intention, because there is no specific default behavior,

I suppose this is possible using some kind of annotation, but it can be tricky, since tracking object-to-object can be an impossible task at compile time. Just wondering if anyone was thinking about this, and if it is theoretically possible.

+4
source share
1 answer

I don’t think there is any tool to achieve what you want. Even if it really existed, you must program the defense.

If your activity needs some information in order to do its magic, simply confirm that you have received the correct information. Be informative in error messages and provide descriptive javadoc.

In addition, perhaps you want this activity to respond to implicit intentions, and you should still be protected from disruptions.

+2
source

All Articles