CopyPastor

Detecting plagiarism made easy.

Score: 0.9866157224160115; Reported for: String similarity Open both answers

Possible Plagiarism

Plagiarized on 2016-05-01
by Rahul Shah

Original Post

Original - Posted on 2014-02-20
by Saadi



            
Present in both answers; Present only in the new answer; Present only in the old answer;

the **onCeate()** is protected so to avoid calling of it from the activity object.

MyActivity activity = new MyActivity(); activity.onCreate(args); // which doesn't make sense because activity is not yet created
Since this method is only called when the activity gets created, calling it yourself will most probably give you a **nullpointerException** because the activity is not yet created. <a href="https://stackoverflow.com/questions/5652661/why-is-oncreate-in-activity-protected">S/O Post</a>
the **onCeate()** is protected so to avoid calling of it from the activity object.

MyActivity activity = new MyActivity(); activity.onCreate(args); // which doesn't make sense because activity is not yet created
Since this method is only called when the activity gets created, calling it yourself will most probably give you a **nullpointerException** because the activity is not yet created.

        
Present in both answers; Present only in the new answer; Present only in the old answer;