title: Why my simple SQLite app on Android doesn´t work?
body: <p>When I run a project on emulator I get a message "Unfortunately, dezo12 has stopped".</p>
  
  <p>LogCat doesn't show anything, and I also tried to run directly on smartphone, but my app also crashed.</p>
  
  <p>I work with eclipse neon and I recently install all needed tools in Android sdk manager.</p>
  
  <p>Here is a code:</p>
  
  <p><code>MAIN ACTIVITY.java</code></p>
  
  <pre><code>package com.example.dezo12;
  
  import android.app.Activity;
  import android.database.Cursor;
  import android.database.sqlite.SQLiteDatabase;
  import android.os.Bundle;
  import android.view.Menu;
  import android.view.MenuItem;
  import android.widget.TextView;
  
  public class MainActivity extends Activity {
  
      @Override
      protected void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          setContentView(R.layout.activity_main);
  
          TextView textView = (TextView)findViewById(R.id.textView1);
  
          SQLiteDatabase database = openOrCreateDatabase("rex.db", MODE_PRIVATE, null);
          database.execSQL("create table if not exist sampletable(name text, location text)");
          database.execSQL("insert into sampletable values('dezo', 'bela')");
          Cursor cursor = database.rawQuery("select * from sampletable", null);
          cursor.moveToFirst();
          String name = cursor.getString(0);
          String location = cursor.getString(1);
          textView.setText(name+ "/n" +location);
  
  
          database.close();
  
      }
  }
  </code></pre>
  
  <p><code>ACTIVITY_MAIN xml</code></p>
  
  <pre><code>&lt;RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
      xmlns:tools="http://schemas.android.com/tools"
      android:layout_width="match_parent"
      android:layout_height="match_parent"
      tools:context="${relativePackage}.${activityClass}" &gt;
  
      &lt;TextView
          android:id="@+id/textView1"
          android:layout_width="wrap_content"
          android:layout_height="wrap_content"
          android:layout_alignParentLeft="true"
          android:layout_alignParentTop="true"
          android:layout_marginLeft="49dp"
          android:layout_marginTop="40dp"
          android:text="Large Text"
          android:textAppearance="?android:attr/textAppearanceLarge" /&gt;
  
  &lt;/RelativeLayout&gt;
  </code></pre>
  
  <p><code>AndroidManifest.xml</code></p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;manifest xmlns:android="http://schemas.android.com/apk/res/android"
      package="com.example.dezo12"
      android:versionCode="1"
      android:versionName="1.0" &gt;
  
      &lt;uses-sdk
          android:minSdkVersion="22"
          android:targetSdkVersion="22" /&gt;
  
      &lt;application
          android:allowBackup="true"
          android:icon="@drawable/ic_launcher"
          android:label="@string/app_name"
          android:theme="@style/AppTheme" &gt;
          &lt;activity
              android:name=".MainActivity"
              android:label="@string/app_name" &gt;
              &lt;intent-filter&gt;
                  &lt;action android:name="android.intent.action.MAIN" /&gt;
  
                  &lt;category android:name="android.intent.category.LAUNCHER" /&gt;
              &lt;/intent-filter&gt;
          &lt;/activity&gt;
      &lt;/application&gt;
  
  &lt;/manifest&gt;
  </code></pre>