What kind of database to use and how not to create many activities?

Asked

Viewed 64 times

0

I intend to create an application, which will use barcode recognition, this barcode will lead to a screen on the medicine, the part of the database do not know which to use, because I never used, the screen I intend to create and reuse, but, it would have somehow simpler?

  • 1

    Easier than that? No. That’s right. Database inside the device, if you want to have online availability and be always current, no accurate (although a cache is recommended by UX).

  • I intend to connect this bank to the internet, because I need to add names, barcodes, and object information that I must always update.

2 answers

2


What database type to use?

"this bar code will lead to a screen on the medicine"

I recommend creating a API, by easy data editing, security, and avoid occupying unnecessary space on users devices.

To make the API you can use Laravel, Codeigniter, Slimphp among other PHP frameworks, in a vps LAMP. I recommend authenticating to get the API data.

To get the API data, use Volley

If you really want to store on the device, use the android Sqlite. Ex.: Example here

How not to create many activities?

You can use Fragments. Ex.: Example here

Overall, do Activities or Fragments that receive parameters and search for the information in the API.

  • It is always interesting to try to post something significant in the answer, leaving links as a reference/in-depth material. Of all the luck, I believe answer from Julia complements yours on the fragments.

  • The part of LAMP, I do not own linux use windows 7, there is another way as virtual machine, etc?

  • @Pedrohenrique In windows you can use XAMPP or WAMP

1

As for the screen you can use Fragments. It is possible to create an Activity with just one frameLayout as in the example below:

<FrameLayout
            android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:id="@+id/fgmContent"/>

Then you can manipulate Fragments using Fragmentmanager and Fragmenttransaction.

manager = getSupportFragmentManager();
fragmentTransaction = manager.beginTransaction();
fragmentTransaction.add(R.id.fgmContent, new SeuFragment());
fragmentTransaction.commit();

Browser other questions tagged

You are not signed in. Login or sign up in order to post.