I am learning Java and Android programming courses. Such a question in the control need 3 reasons. I have only 2.

  1. Did not register Activity in AndroidManifest.

  2. When overwriting the onStart method did not call it with super

    @Override protected void onStart(){ ausgabe =+"onStart"; tvAnzeige.setText(ausgabe); 

Need another option. Tell me please.

  • any exception not caught in onStart / onCreate Activity / Application - pavel
  • and by the way with 2 points if compiled - change the compiler. - pavel
  • objects are null upon accessing, division by 0, going beyond the range of the array and any reasons leading to Runtime Exception, there are tens of them - pavlofff
  • @pavel, Why shouldn't it compile? - post_zeew

2 answers 2

Did not register Activity in AndroidManifest.

You need reasons why the application will generate an error on startup .

If you do not register the launcher activity in the manifest, the application simply will not build.

If you do not register any other activity in the manifest, the application will crash with an error, but not at the immediate launch of the application, but at the launch of this activity.

As the required reasons, you can specify any situations that result in unchecked exceptions:

  1. ArrayIndexOutOfBoundsException :

     int[] array = new int[1]; int a = array[2]; 
  2. ArithmeticException :

     float a = 5/0; 
  3. StackOverflowError as a result of infinite recursion:

     private void foo() { foo(); } ... foo(); 

You can also reproduce exceptions from the Android SDK, for example, Resources$NotFoundException :

 String s = getString(0); 
  • one
    NullPointerExeption is the most common reason for crashing when executing an application, especially in android :) - pavlofff

If I think about common ones, and those that relate directly to the launch, in addition to "I did not register an Activity in AndroidManifest"

  • referring to non-initialized components of the layout (for example, findViewById, referring to the ID that is not on your layout, but on another, for example, returns null)

  • A large number of nested views. (StackOverflowError) if I'm not mistaken - more than 15

  • display of heavy images from resources (out of memory)

enough?