Skip to content

Instantly share code, notes, and snippets.

View martinomburajr's full-sized avatar
🦆
Relentlessly pursuing those carbs

Martin Ombura Jr. martinomburajr

🦆
Relentlessly pursuing those carbs
View GitHub Profile
@martinomburajr
martinomburajr / medium-starting-activity-main-instrumentation-class.java
Created December 15, 2017 19:27
Instrumentation class, calling the Activity's onCreate
/**
* @Retrieved from AOSP
* Instrumentation class
*/
public void callActivityOnCreate(Activity activity, Bundle icicle) {
//Note that the activity has already been initialized thanks to the prepareLaunchActivity().
//all that remains is just calling onCreate()
prePerformCreate(activity); //prepares the activity
activity.performCreate(icicle); //calls the oncreate
postPerformCreate(activity);
/**
* Retrieved from AOSP
* ActivityThread class
*/
//Handler created within the ActivityThreadClass, that holds a variety of id's for app events/states
private class H extends Handler {
public static final int LAUNCH_ACTIVITY = 100;
public static final int PAUSE_ACTIVITY = 101;
public static final int PAUSE_ACTIVITY_FINISHING= 102;
/**
* Retrieved from AOSP.
* ActivityThread class
*/
private void handleLaunchActivity(ActivityClientRecord r, Intent customIntent, String reason) {
//... initialize graphics,do some logging, call GC if need be, etc
Activity a = performLaunchActivity(r, customIntent);
//... handle how to resume an existing activity
}
/**
* Retrieved from AOSP
* H class embedded in the ActivityThread class
*/
private class H extends Handler {
//Several Application State Identifiers ...
public void handleMessage(Message msg) {
//other code
switch (msg.what) {
public class Parent {
public static void main(Object []args) {
System.out.println("Im in the main method!");
}
}
public class Parent {
public static void main(String []args) {
System.out.println("Im in the parent main method!");
}
}
//This is the class that is run
public class Child {
public static void main(String []args) {
Parent.main(args);
@martinomburajr
martinomburajr / medium-main-method-vb.vb
Created December 7, 2017 11:47
Visual Basic Programming Language - Main Method
Sub Main()
Debug.Print "Hello World!"
MsgBox "Arguments if any are: " & Command$
End Sub
@martinomburajr
martinomburajr / medium-main-method-python.py
Created December 7, 2017 11:46
Python Programming Language - Main Method
import sys
def main(argv):
n = int(argv[1])
print(n + 1)
if __name__ == '__main__':
sys.exit(main(sys.argv))
@martinomburajr
martinomburajr / medium-main-method-pike.pike
Created December 7, 2017 11:44
Pike Programming Language - Main Method
int main() {
write("Hello world!\n");
return 0;
}
@martinomburajr
martinomburajr / medium-main-method-haskell.hs
Created December 7, 2017 11:42
Haskell Programming Language main method
main :: IO()
main =
putStrLn "Hello, World!"