Categories: ANDROID APP

Create a easy enterprise App utilizing SQL Lite Database in Android Studio – for rookies.



This video exhibits the whole steps to create a easy Enterprise App utilizing the SQLite Database in Android Studio. It exhibits easy methods to create the App interface after which write the SQL Question and Insert instructions to play with the database. It takes a quite simple database desk instance to indicate it.

Full supply is accessible at:

We shall be glad to listen to from you concerning any question, ideas or appreciations at: programmerworld1990@gmail.com

Supply code:

/**************************************/

bundle com.instance.mybusinessappyt.mybusinessappyoutube;

import android.content material.ContentValues;
import android.database.Cursor;
import android.database.sqlite.SQLiteDatabase;
import android.assist.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.EditText;
import android.widget.TextView;

public class MainActivity extends AppCompatActivity {

non-public EditText editTextStockName;
non-public EditText editTextQuantity;
non-public TextView textViewDisplay;

non-public myDatabaseHandle dbHandle;
non-public SQLiteDatabase myDB;

@Override
protected void onCreate(Bundle savedInstanceState) {
tremendous.onCreate(savedInstanceState);
setContentView(R.structure.activity_main);

editTextStockName = findViewById(R.id.editTextStockName);
editTextQuantity = findViewById(R.id.editTextQuantity);

textViewDisplay = findViewById(R.id.textViewDisplay);

dbHandle = new myDatabaseHandle(this, “FirstDatabase”, null, 1);

myDB = dbHandle.getWritableDatabase();

strive{
String stringCreateTable = “CREATE TABLE firstTable(StockName TEXT, Amount INTEGER)”;
myDB.execSQL(stringCreateTable);
}catch (Exception e){
e.printStackTrace();
}
}

public void writeButton(View view){
ContentValues contentValues = new ContentValues();

contentValues.put(“StockName”, editTextStockName.getText().toString());
contentValues.put(“Amount”, Integer.parseInt(editTextQuantity.getText().toString()));
myDB.insert(“firstTable”, null, contentValues);
}

public void readButton(View view){

String question = “Choose * FROM firstTable WHERE StockName = ‘”+ editTextStockName.getText().toString()+”‘”;

Cursor myCursor = myDB.rawQuery(question, null);

if (myCursor.moveToFirst()){
myCursor.moveToFirst();
textViewDisplay.setText(myCursor.getString(0) + ” — ” + myCursor.getString(1));
}else{
textViewDisplay.setText(“Information Not Discovered … “);
}

}

}
/*************************************/

/*************************************/

bundle com.instance.mybusinessappyt.mybusinessappyoutube;

import android.content material.Context;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;

public class myDatabaseHandle extends SQLiteOpenHelper {

public myDatabaseHandle(Context context, String identify, SQLiteDatabase.CursorFactory manufacturing unit, int model) {
tremendous(context, identify, manufacturing unit, model);
}

@Override
public void onCreate(SQLiteDatabase db) {

}

@Override
public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {

}
}

/**********************************************/

source

linda

Recent Posts

The Ultimate Guide to YouTube to MP4 Converters

A YouTube to MP4 conversion software is a software or on-the-web tool designed to download…

2 days ago

Unox Equipment: A Chef’s Companion

Cooking is an art, and each artist needs the right equipment to bring their masterpiece…

2 days ago

Comparing Electric Scooters: Features and Performance

Hey there, scooter enthusiast! Whether you're a seasoned rider or just thinking about zipping around…

2 days ago

Discovering Affordable Massage Services throughout Busan

Hey there, massage fans! If you're in Busan and also searching for a way to…

2 days ago

Guide to Aroma Massage Services in Busan

Hey there! If you're planning a trip to Busan, or if you're already here and…

2 days ago

Is Instant Famous Worth It? A Detailed Review of Their Follower Services

Are you looking for ways to get more followers on your social media accounts to…

3 days ago