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

0

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

    
asked by anonymous 25.12.2018 / 22:22

2 answers

2
  

What type of database to use?

     

"This bar code will lead to a screen on the drug"

I recommend creating a API , for ease of data editing, security, and avoid taking up 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 doing authentication to get the API data.

To get the API data, use Volley

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

  

How not to create many activities?

You can use Fragments . Example: Example here

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

    
26.12.2018 / 19:22
1

As for the screen you can use fragments. You can create an activity with only 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();
    
26.12.2018 / 16:15