Buggy code:
public class Main extends FragmentActivity implements OnClickListener , CustomDialogFragment . OnCloseCustomDialogListener { public static final String FIELD_ORIENTATION_NAME = "displayOrientation" ; public static final String FIELD_DOCS_LIST_OPENING_TIME_DELAY_NAME = "docListOpeningTimeDelay" ; public static final String FIELD_ORIENTATION_AUTO_NAME = "auto" ; public static final String FIELD_ORIENTATION_PORTRAIT_NAME = "portrait" ; public static final String FIELD_ORIENTATION_LANDSCAPE_NAME = "landscape" ; public static final String FIELD_DEMOMODE_NAME = "demoModePrefs" ; public static final int DIALOG_DATA_CLEANING_CONFIRMATION = 1 ; public static DBase db ; public static Main main ; private static boolean demoMode ; private Button buttonMain ; private MediaPlayer mp ; private final int OPTIONS_MENU_PREFERENCES_BUTTON_ID = 0 ; private final int OPTIONS_MENU_CLEAR_TABLE_BUTTON_ID = 1 ; private static GregorianCalendar lastDocsListFetchingTime ; @ Override protected void onCreate ( Bundle savedInstanceState ) { } @ Override public void onResume ( ) { } private void setStartButtonText ( ) { } @ Override public void onSaveInstanceState ( Bundle outState ) { } @ Override public boolean onCreateOptionsMenu ( Menu menu ) { } @ Override public void onCloseCustomDialog ( int dialogId , int buttonId ) { } @ Override public boolean onPrepareOptionsMenu ( Menu menu ) { } @ Override public void onClick ( View v ) { } @ Override public boolean onOptionsItemSelected ( MenuItem item ) { } @ Override public void onActivityResult ( int requestCode , int resultCode , Intent data ) { } private long getLoadedItemsCount ( ) { } public static void setStyle ( Activity activity ) { activity . setTitle ( Main . getLoadedDocumentDescription ( activity ) ) ; Main . setOrientation ( activity ) ; Drawable image = null ; String className = activity . getClass ( ) . getSimpleName ( ) ; if ( className . equals ( "Main" ) ) { if ( Main . isDemoMode ( ) ) { image = activity . getResources ( ) . getDrawable ( demo_texture ) ; image . setAlpha ( 30 ) ; } else { image = activity . getResources ( ) . getDrawable ( work_texture ) ; image . setAlpha ( 255 ) ; } <START_BUG> View v = activity . findViewById ( backgroundLayout_main ) ; <END_BUG> v . setBackgroundDrawable ( image ) ; } else if ( className . equals ( "PreferencesActivity" ) ) { if ( Main . isDemoMode ( ) ) { image = activity . getResources ( ) . getDrawable ( demo_texture ) ; image . setAlpha ( 30 ) ; } else { image = activity . getResources ( ) . getDrawable ( work_texture ) ; image . setAlpha ( 255 ) ; } View v = activity . findViewById ( list ) ; v . setBackgroundDrawable ( image ) ; } else if ( className . equals ( "DocsListFragmentActivity" ) ) { if ( Main . isDemoMode ( ) ) { image = activity . getResources ( ) . getDrawable ( demo_texture ) ; image . setAlpha ( 30 ) ; } else { image = activity . getResources ( ) . getDrawable ( work_texture ) ; image . setAlpha ( 100 ) ; } View v = activity . findViewById ( backgroundLayout ) ; v . setBackgroundDrawable ( image ) ; } else if ( className . equals ( "ItemsListFragmentActivity" ) ) { if ( Main . isDemoMode ( ) ) { image = activity . getResources ( ) . getDrawable ( demo_texture ) ; image . setAlpha ( 30 ) ; } else { image = activity . getResources ( ) . getDrawable ( work_texture ) ; image . setAlpha ( 100 ) ; } View v = activity . findViewById ( backgroundLayout ) ; v . setBackgroundDrawable ( image ) ; } } private static String getLoadedDocumentDescription ( Activity activity ) { } private static void setOrientation ( Activity activity ) { } public static boolean docsListNeedsToBeFetched ( ) { } public static GregorianCalendar getLastDocsListFetchingTime ( ) { } public static void setLastDocsListFetchingTime ( GregorianCalendar time ) { } public static boolean isDemoMode ( ) { } public static void setDemoMode ( Activity activity , boolean value ) { } public static boolean isNetworkAvailable ( Context context ) { } }

Fix:
View v = activity . findViewById ( backgroundLayout ) ;