Search in sources :

Example 1 with CustomAdapter_Prestamos

use of layout.CustomAdapter_Prestamos in project AdMoney by ErnestoGonAr.

the class Reporte_Prestamos method onCreate.

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_reporte__prestamos);
    bd = new BDHandlerAM(this);
    RecyclerView rv = (RecyclerView) findViewById(R.id.recycler_prestamos);
    try {
        String[][] dataSet = bd.obtenerPrestamos();
        LinearLayoutManager ln = new LinearLayoutManager(this);
        ln.setOrientation(LinearLayoutManager.VERTICAL);
        CustomAdapter_Prestamos adapter = new CustomAdapter_Prestamos(dataSet);
        rv.setLayoutManager(ln);
        rv.setAdapter(adapter);
    } catch (ArrayIndexOutOfBoundsException e) {
        Toast toast = Toast.makeText(this, "No hay prestamos", Toast.LENGTH_SHORT);
        toast.setGravity(Gravity.CENTER_VERTICAL, 0, 0);
        toast.show();
        return;
    }
}
Also used : CustomAdapter_Prestamos(layout.CustomAdapter_Prestamos) Toast(android.widget.Toast) RecyclerView(android.support.v7.widget.RecyclerView) LinearLayoutManager(android.support.v7.widget.LinearLayoutManager)

Aggregations

LinearLayoutManager (android.support.v7.widget.LinearLayoutManager)1 RecyclerView (android.support.v7.widget.RecyclerView)1 Toast (android.widget.Toast)1 CustomAdapter_Prestamos (layout.CustomAdapter_Prestamos)1