use of layout.CustomAdapter_CategoriasI in project AdMoney by ErnestoGonAr.
the class CategoriasIngreso method onCreate.
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_categorias_ingreso);
aceptar = (Button) findViewById(R.id.aceptarin);
agregar = (ImageButton) findViewById(R.id.agregar_ci);
bd = new BDHandlerAM(this);
bandera = false;
a = bd.spinneringresos();
RecyclerView rv = (RecyclerView) findViewById(R.id.recycler_ci);
try {
String[][] dataSet = bd.obtenerCategoriasi();
LinearLayoutManager ln = new LinearLayoutManager(this);
ln.setOrientation(LinearLayoutManager.VERTICAL);
CustomAdapter_CategoriasI adapter = new CustomAdapter_CategoriasI(dataSet);
rv.setLayoutManager(ln);
rv.setAdapter(adapter);
} catch (ArrayIndexOutOfBoundsException e) {
Toast toast = Toast.makeText(this, "No hay categorias de Ingresos", Toast.LENGTH_SHORT);
toast.setGravity(Gravity.CENTER_VERTICAL, 0, 0);
toast.show();
return;
}
agregar.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
AlertDialog.Builder mBuilder = new AlertDialog.Builder(CategoriasIngreso.this);
View mView = getLayoutInflater().inflate(R.layout.insertar_categoriase, null);
final EditText insertar = (EditText) mView.findViewById(R.id.insertb);
final Button iguardar = (Button) mView.findViewById(R.id.insertarguardar);
final Button icancelar = (Button) mView.findViewById(R.id.insertarcancelar);
mBuilder.setView(mView);
AlertDialog dialog = mBuilder.create();
dialog.show();
insertar.requestFocus();
InputMethodManager imm = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);
imm.showSoftInput(insertar, InputMethodManager.SHOW_IMPLICIT);
iguardar.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
validartexto = insertar.getText().toString();
insertar();
if (bandera) {
bd.insertarCI(primeroMayuscula(insertar.getText().toString()), 7);
}
onBackPressed2();
}
});
icancelar.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
onBackPressed2();
}
});
}
});
aceptar.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
onBackPressed();
}
});
}
Aggregations