When the application starts, it displays an error:

An error occurred in the application "Saint switcher"

What could be the error? Flies to this place: holycrap.setAdapter(adapter);

Here is the code completely

 package com.example.saintswitcher; import com.slidingmenu.lib.SlidingMenu; import android.os.Bundle; import android.app.Activity; import android.view.Menu; import android.widget.ArrayAdapter; import android.widget.ListView; public class MainActivity extends Activity { ListView holycrap; final String[] a_che = new String[] { "Тапочки", "Ластики", "Кошки", "Литераторы", "Стринги", "Томат", "Еда", "Стринги", "Лошадь на горе", "Фалопиева труба", "Иттрий", "Стринги", "Двшка" }; public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); holycrap = (ListView)findViewById(R.id.listView1); ArrayAdapter<String> adapter = new ArrayAdapter<String>(this, android.R.layout.simple_list_item_1, a_che); holycrap.setAdapter(adapter); SlidingMenu menu = new SlidingMenu(this); menu.setMode(SlidingMenu.LEFT); menu.setTouchModeAbove(SlidingMenu.TOUCHMODE_MARGIN); menu.setShadowWidthRes(R.dimen.shadow_width); menu.setShadowDrawable(R.drawable.shadow); menu.setBehindOffsetRes(R.dimen.slidingmenu_offset); menu.setFadeDegree(0.35f); menu.attachToActivity(this, SlidingMenu.SLIDING_CONTENT); menu.setMenu(holycrap); } @Override public boolean onCreateOptionsMenu(Menu menu) { // Inflate the menu; this adds items to the action bar if it is present. getMenuInflater().inflate(R.menu.main, menu); return true; } } 
  • Would you throw the irrelevant part, eh? And they said, in which procedure and which line it takes off, otherwise we have the only telepath not caught up yet. - VladD

1 answer 1

Probably holycrap not found. Check that the layout has such an element and that it has such an id as in the code.