public void insertarAlumno(View v) { String idExpediente = IDEXPEDIENTE.getText().toString(); String idBitacora = IDBITACORA; String carnetEmpleado = CARNETEMPLEADO; String codCarrera = CODCARRERA; String carnetAlumno = CARNETALUMNO.getText().toString(); String nombreAlumno = NOMBREALUMNO.getText().toString(); String apellidoAlumno = APELLIDOALUMNO.getText().toString(); String sexoAlumno; if (masculino.isChecked() == true) { sexoAlumno = String.valueOf("M"); } else { sexoAlumno = String.valueOf("F"); } String fechaInicioServicio = FECHAINICIOSERVICIO.getText().toString(); String fechaFinServicio = FECHAFINSERVICIO; String estadoExpediente = ESTADOEXPEDIENTE; String telefono = TELEFONO.getText().toString(); String email = EMAIL.getText().toString(); String observaciones = OBSERVACIONES.getText().toString(); float valorServicio = VALORSERVICIO; int horasAcumula = HORASACUMULA; String fechaAcumula = FECHAACUMULA; // Validaciones String regInsertados; AlumnoExpediente alumno = new AlumnoExpediente(); regInsertados = alumno.validaciones( carnetAlumno, nombreAlumno, apellidoAlumno, fechaInicioServicio, telefono, email); if (regInsertados == "") { // Comenzar proceso de insercion alumno.setIdExpediente(idExpediente); alumno.setIdBitacora(idBitacora); alumno.setCarnetEmpleado(carnetEmpleado); alumno.setCodCarrera(codCarrera); alumno.setCarnetAlumno(carnetAlumno); alumno.setNombreAlumno(nombreAlumno); alumno.setApellidoAlumno(apellidoAlumno); alumno.setSexoAlumno(sexoAlumno); alumno.setFechaInicioServicio(fechaInicioServicio); alumno.setFechaFinServicio(fechaFinServicio); alumno.setEstadoExpediente(estadoExpediente); alumno.setTelefono(telefono); alumno.setEmail(email); alumno.setObservaciones(observaciones); alumno.setValorServicio(valorServicio); alumno.setHorasAcumula(horasAcumula); alumno.setFechaAcumula(fechaAcumula); regInsertados = helper.insertar(alumno); Toast.makeText(this, regInsertados, Toast.LENGTH_SHORT).show(); } else { Toast.makeText(this, regInsertados, Toast.LENGTH_LONG).show(); } }
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_autorizar_proyectos); // HACEMOS LA CONSULTA helper = new BDControl(this); helper.consultarProyecto("P", listaProyectos, idproy); // finaliza la consulta llenarlista = (ListView) findViewById(R.id.listProyectosPendientes); // PRUEBA PARA VER SI SE LLENA LA LISTA CON TODOS LOS VALORES AlertDialog alertDialog; alertDialog = new AlertDialog.Builder(this).create(); alertDialog.setTitle("Numero de registros encontradors"); alertDialog.setMessage("Nº:" + listaProyectos.size()); alertDialog.show(); // llenamos el listview ArrayAdapter<String> adaptador = new ArrayAdapter<String>(this, android.R.layout.simple_list_item_1, listaProyectos); llenarlista.setAdapter(adaptador); // Al hacer click en algun elemento realice la accion // ListView Item Click Listener llenarlista.setOnItemClickListener( new OnItemClickListener() { @Override public void onItemClick(AdapterView<?> parent, View view, int position, long id) { // ListView Clicked item index int itemPosition = position; // ListView Clicked item value String itemValue = (String) llenarlista.getItemAtPosition(position); // Show Alert Toast.makeText( getApplicationContext(), "Position :" + itemPosition + " ListItem : " + itemValue, Toast.LENGTH_LONG) .show(); AprobarReprobarProyecto.idproyecto = idproy.get(position); // Abrimos el activity donde se mostrara el proyecto seleccionado Intent AbrirActAproReproP = new Intent(AutorizarProyectos.this, AprobarReprobarProyecto.class); startActivity(AbrirActAproReproP); } }); }