1
I’m getting the object through Activity's using putExtra and returning on the other screen with the getSerializableExtra.
I’ve already created the fk id_usuario in the product table for the field id_user of the user table.
My question now is:
How do I insert my product into the products table linked with the user id of the user table?
How am I going to insert this product? Where do I pass the ID of the user I picked up in Activity to be inserted in it? Use in contentValues? In the insert repository method? If you have an example it would help a lot!
public ContentValues contentValues(Reporte reporte) {
    ContentValues values = new ContentValues();
    values.put("id_user", reporte.getIdUsuario());
    values.put("tipo", reporte.getTipoReporte());
    values.put("descricao", reporte.getDescricaoReporte());
    values.put("status", reporte.getStatusReporte());
    values.put("data", reporte.getDataAbertura());
    values.put("hora", reporte.getHoraAbertura());
    values.put("latitude", reporte.getLatitude());
    values.put("longitude", reporte.getLongitude());
    values.put("endereco", reporte.getEndereco());
    return values;
}
public long insertReporte(Reporte novoReporte) {
    long id = 0;
    try {
        ContentValues values = contentValues(novoReporte);
        id = db.insert("reportes", null, values);
    } catch (Exception e) {
        Log.e("Erro: ", e.getMessage());
    }
    return id;
}