APP DATE BY TRYING TO CONSULT DATA ON ANDROID SQLITE

When I try to perform the View function in my book registration application, it closes, but the Admission and Cleansing function works normally. HELP ME S & P, PLEASE …

CLASS BOOKS:
`public class Books {
int id;
Year of string;
Chain title;
String Editor
Chain author;

public books ()
{

}


public books (int id, channel title, string editor, string year, string author)
{
this.id = id;
this.title = title;
this.editora = publisher;
this.ano = year;
this.autor = author;
}

public int getid ()
{
return id;
}

public void setid (int id)
{
this.id = id;
}

public String getTitle ()
{
title of return;
}

public void setTitle (channel title)
{
this.title = title;
}

public String getEditora ()
{
return editor;
}

public String getAno () {
year of return;
}

public void setAno (Year of the channel) {
this.ano = year;
}

public void setEditora (string editor) {
this.editora = publisher;
}

public String getAutor () {
return author;
}

public void setAutor (Channel author) {
this.autor = author;
}

} `

DATA BANK CLASS WITH METHODS:

import android.content.Context;

import android.content.ContentValues;
import android.database.Cursor;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;

Public class DatabaseData extends SQLiteOpenHelper {
private static final int VERSAO_BANCO_DADOS = 1; // to create constants: private static final, can not change.
private static final String NAME_BANCO_DADOS = "managementLivros";
private final static String TABELA_LIVROS = "libros";
private static final String CAMPO_ID = "id";
private static final String FIELD_TITLE = "name";
private static final String FIELD_INSTATE = "editor";
private static final String CAMPO_ANO = "ano";
private static final String FIELD_AUTOR = "author";

public context context {
super (context, BANK_NAME, NULL, VERSION_BANK_DATA);
}

@Override
public void onCreate (SQLiteDatabase database) {
String CREATE TABLOOK = "CREATE TABLE" + TABELA_LIVROS + "(" + FIELD_ID + "INTEGER PRIMARY KEY," +
FIELD_TITLE + "TEXT," + FIELD_FIELDER + "TEXT" + FIELD_FIELD + "TEXT" + FIELD_AUTOR + ")";
bank.execSQL (CreateTableLooks);
}

@Override
public void onUpgrade (SQLiteDatabase database, int i, int i1) // update the database
{
// "bench" creates an object at the beginning of the SQLiteDataBase class
DROP TABLE IF EXISTS + DROP TABLE IF EXISTS // DROP TABLE SI
onCreate (bank);
}

public void inserBook (Books books) {
Database SQLiteDatabase = this.getWritableDatabase (); // is what will give permission to write and read. the information is not recorded directly
ContentValues ​​values ​​= new ContentValues ​​(); // information limbo. the class has several methods, such as put
values.put (CAMPO_ID, books.getid ());
values.put (FILE_TITLE, books.getTitle ()) // union of two worlds
values.put (FIELD_CREAT, books.getEditora ()) // where you want to place. what will be placed
values.put (CAMPO_ANO, libros.getAno ());
values.put (FIELD_AUTOR, books.getAutor ());
bank.insert (TABELA_LIVROS, null, values); // method inserted. now he will actually write the data in the table
bank.close (); // close the write channel and prevent the database from being corrupted
}

public books queryBook (int id) // get method
{
Books books = new books ();
Database SQLiteDatabase = this.getReadableDatabase (); // readable only. and the recording channel will be protected. security problem
Cursor cursor = banco.query (TABELA_LIVROS, new string)[]{FIELD_ID, FIELD_TITLE, FIELD_FORCE, FIELD_FIELD, FIELD_AUTOR}, // the cursor class, provides methods for navigating the database.
CAMPO_ID + "=?", New channel[]{String.valueOf (id)}, null, null, null, null);
if (cursor! = null) {
cursor.moveToFirst ();
if (cursor.getCount ()> 0) {
books.setid (cursor.getInt (0));
books.setTitle (cursor.getString (1));
books.setEditora (cursor.getString (2));
books.setAno (cursor.getString (3));
books.setAutor (cursor.getString (4));
} else {
return null;
}
}
bank.close ();
return books;
}
public int queryQuantityContacts () // indicates the number of contacts
{
String countQuery = "SELECT * FROM" + TABELA_LIVROS; // select all fields in the contact table.
Database SQLiteDatabase = this.getReadableDatabase ();
Cursor cursor = banco.rawQuery (countQuery, null); // rawQuery has the countQuery method to perform this count.
cursor.close ();
return cursor.getCount ();
}

}

THE MAIN ACTIVITY CLASS THAT WILL EXECUTE THESE METHODS:

import android.content.Context;

import android.content.DialogInterface;
import android.support.v7.app.AlertDialog;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.EditText;
import android.widget.TextView;
import android.widget.Toast;

import java.util.List;

Public class MainActivity extends AppCompatActivity {
EditText id1, title1, publisher1, year1, author1, query1;
TextView showsCount;
String text = "";

@Override
Protected void onCreate (Bundle savedInstanceState) {
super.onCreate (savedInstanceState);
showSummary = (TextView) findViewById (SampleID);
setContentView (R.layout.activity_main);
id1 = (EditText) findViewById (R.id.campoId);
titulo1 = (EditText) findViewById (R.id.campoTitulo);
editora1 = (EditText) findViewById (R.id.campoEditora);
ano1 = (EditText) findViewById (R.id.campoAno);
author1 = (EditText) findViewById (R.id.campoAutor);
query1 = (EditText) findViewById (FieldID);
BancoDados banco = new BancoDados (this);
}

public void insert (Display v) {
if (this.id1.length ()! = 0 && this.titulo1.length ()! = 0) {
Integer id = Integer.parseInt (this.id1.getText (). ToString ());
Title of the string = this.titulo1.getText (). ToString ();
String Editor = this.editora1.getText (). ToString ();
String year = this.ano1.getText (). ToString ();
String author = this.autor1.getText (). ToString ();
BancoDados banco = new BancoDados (this);
id1.setText ("");
titulo1.setText ("");
editora1.setText ("");
year1.setText ("");
author1.setText ("");
banco.insereLivro (new books (identifier, title, publisher, year, author));
Toast.makeText (this, "Data entered successfully", Toast.LENGTH_LONG) .show ();
} else {
Toast.makeText (this, "Enter an identifier,"., Toast.LENGTH_LONG) .show ();

}

}

public void clear (View v) {
id1.setText ("");
titulo1.setText ("");
editora1.setText ("");
year1.setText ("");
author1.setText ("");
Toast.makeText (this, "The text fields have been cleaned up", Toast.LENGTH_LONG) .show ();
}

public void See (See v) {
BancoDados banco = new BancoDados (this);
int BookID = Integer.parseInt (query1.getText (). toString ());
Books book = banco.consultaLivro (LivroID);
showCount.setText (book.toString ());

}

}