How to make an application with Database on Android? [closed]

0

I'm starting my activities in the mobile world, and I would like to build an application that uses Database for Android platform, an example application so that I can move on, I searched the internet but it was not very clear to me how to implement for this platform. Could someone help me with some indication of how to run this? If possible also, does anyone know of a link in which to clarify how Android handles Database manipulation on your platform?

    
asked by anonymous 11.09.2015 / 14:47

2 answers

1

Example of creating a database on Android using SQLite:

public class FeedReaderDbHelper extends SQLiteOpenHelper {
    // If you change the database schema, you must increment the database version.
    public static final int DATABASE_VERSION = 1;
    public static final String DATABASE_NAME = "FeedReader.db";

    public FeedReaderDbHelper(Context context) {
        super(context, DATABASE_NAME, null, DATABASE_VERSION);
    }
    public void onCreate(SQLiteDatabase db) {
        db.execSQL(SQL_CREATE_ENTRIES);
    }
    public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
        db.execSQL(SQL_DELETE_ENTRIES);
    }
}

Reference: link

In SQL_CREATE_ENTRIES you inform the SQL DML commands for creating tables, fields, changing and removing fields.

The onCreate method will be called when there is an interaction with the SQLite database and the database has not yet been created on the device.

The onUpgrade method will be called when there is an interaction with the SQLite database, the database has already been created on the device, however the application on the device has been updated and the database is in another version.

You can put several% of one% of one underneath the other for the creation of a certain table, change a certain field, as you prefer.

There is also the possibility that Android communicates externally through WebServices with a server that presents a database, such as MySQL, PostgreSQL, MongoDB (NoSQL, document-oriented database) using Java, PHP, or another programming language to perform communication, the REST architecture is usually used and returns JSON to the application.

Other useful links:

link link link link link

    
11.09.2015 / 15:07
0

Good morning. If you want to create a database in an Android Application. This will depend on several factors. First, the application runs in server-client architecture. or there is no communication with server, cloud whatever, and is stored in the database of the mobile phone. Putting it in simple words, you have to know first whether the database is local or remote. then I think the best way, at least the one that would follow, would be to create a MySQL database, or a MongoDB style architecture (NoSQL, so), and create variables in the Java part that link to the database and to allow them to input their data. of course, that you will find numerous repositories of github with numerous database templates for Android, etc. if you want, you can, however, choose to search on sites such as packaging, codecanyon, and other online stores for similar solutions. usually the less you have to reinvent gunpowder, the higher the productivity in the medium term. and there is always the possibility of refining your product in the medium term. as I say, at the beginning, the more you can simplify the implementation of your product, the better.

    
11.09.2015 / 15:00