Академический Документы
Профессиональный Документы
Культура Документы
UNIN
FILIAL JULIACA
Facultad de Ingeniera y
Arquitectura
E.A.P. de Ingeniera de Sistemas
2014
Intel
Universidad Peruana Unin Filial Juliaca
01/01/2014
NDICE
1.
INTRODUCCIN .....................................................................................................................................2
2.
2.1.
2.2.
2.3.
Configuracin .....................................................................................................................................4
2.4.
3.
3.1.
4.
4.1.
4.2.
SQLiteOpenHelper ...........................................................................................................................13
4.3.
4.4.
5.
5.1.
5.2.
JSON .................................................................................................................................................36
5.3.
CONTENIDO
1. INTRODUCCIN
En el presente documento se presenta un pequeo manual de configuracin de herramientas y el
desarrollo de aplicaciones para dispositivos con sistema operativo android (Celulares y Tablets).
Muestra los pasos bsicos a seguir en la configuracin del IDE, generacin de APK y un ejemplo de
control de gastos personales, finalmente un ejemplo de consumo de Web Service a travs de SOAP
usando JSON.
2.3. Configuracin
Configurar el Emulador de Android:
Para crear y ejecutar el emulador Android pulsaremos en el botn "Android Virtual Device
Manager" - "Dentro del IDE de desarrollo Eclipse
Se iniciar la aplicacin "Android Virtual Device Manager", pulsaremos "Create" para crear un
nuevo dispositivo virtual emulado:
3. INTENT Y SERVICIOS
3.1. Intent y Servicios
Pasar parmetros de una vista otra vista.
Intent inten=new Intent();
inten.putExtra("nombre", txtNombre.getText().toString());
inten.setClass(this, RegistroDatos.class);
startActivity(inten);
Cuadro N 0X: Forma de enviar parmetro con Intent.
Recuperando Parmetros enviados.
Bundle bun=getIntent().getExtras();
String nombre=bun.getString("nombre");
Cuadro N 0X: Forma de recuperar parmetros enviados.
Forma Simple de pasar de una vista a otra sin parmetros de envo:
startActivity(new Intent(this, RegistroDatos.class));
Equivalente SQLite
INTEGER
TEXT
NONE
REAL
NUMERIC
4.2. SQLiteOpenHelper
SQLiteOpenHelper es la librera que se usar para generar nuestra base de datos para SQLite.
Aqu va toda la
lgica de negocio,
dentro de archivos
.java
En esta carpeta se
colocan las libreras
externas a utilizar
dentro del proyecto.
En Esta carpeta se
encuentra todos los
recursos de la parte
visual o vista del
proyecto.
En estas carpetas se
encuentran todas
las imgenes segn
el tamao.
En esta carpeta se deben
disear los formularios o
pantallas de forma visual
o grfica
El AndroidManifest.xml: es el archivo
principal de configuracin de todo el
proyecto.
Dentro de cada values, segn cada idioma deben existir los tres archivos que se muestran en la figura.
<item name="android:typeface">monospace</item>
<item name="android:textSize">12sp</item>
<item name="android:background">#616161</item>
</style>
<style name="xcopy">
<item name="android:textColor">#505050</item>
<item name="android:textSize">10sp</item>
</style>
<style name="xbtn">
<item name="android:textColor">#FFC100</item>
<item name="android:textSize">16sp</item>
</style>
<style name="xbg">
<item name="android:background">#b0e8f3</item>
</style>
<style name="xbgIntermedio">
<item name="android:background">#616161</item>
</style>
<style name="xbgFondo">
<item name="android:background">#03515e</item>
</style>
<style name="xbtnAdd">
<item name="android:src">@drawable/icoadd</item>
</style>
</resources>
android:title="@string/menu_report"
app:showAsAction="never"
android:icon="@drawable/report"/>
<item
android:id="@+id/menuConfi"
android:orderInCategory="100"
android:title="@string/menu_conf"
app:showAsAction="never"
android:icon="@drawable/conf"/>
<item
android:id="@+id/menuSalir"
android:orderInCategory="100"
android:title="@string/menu_salir"
app:showAsAction="never"
android:icon="@drawable/salir"/>
</TableRow>
</TableLayout>
<TableLayout
android:id="@+id/tableLayoutMenu1"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_margin="20dp">
<TableRow android:id="@+id/tableRowMenu" android:layout_width="fill_parent">
<TableLayout android:onClick="onAdd">
<TableRow android:padding="5dp" android:layout_width="fill_parent">
<ImageView android:src="@drawable/movimiento"/>
<TextView android:id="@+id/btn_text_add" android:text="@string/menu_add"
style="@style/xbtn"/>
</TableRow>
</TableLayout>
<TableLayout android:onClick="onReport">
<TableRow android:padding="5dp" android:layout_width="fill_parent">
<ImageView android:src="@drawable/report"/>
<TextView android:id="@+id/btn_text_report" android:text="@string/menu_report"
style="@style/xbtn"/>
</TableRow>
</TableLayout>
<TableLayout android:onClick="onConf">
<TableRow android:padding="5dp" android:layout_width="fill_parent">
<ImageView android:src="@drawable/conf"/>
<TextView android:id="@+id/btn_text_conf" android:text="@string/menu_conf"
style="@style/xbtn"/>
</TableRow>
</TableLayout>
</TableRow>
</TableLayout>
<TableLayout
android:id="@+id/tableLayoutMenu2"
android:layout_width="wrap_content"
android:layout_height="wrap_content">
<Button
android:layout_marginLeft="50dp"
android:background="@drawable/salir"
android:onClick="onFinish"
android:text="@string/menu_salir"
android:textStyle="bold"
android:width="0dp" />
</TableLayout>
<TableLayout
style="@style/xbgFondo"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:padding="10dp" >
<TableRow android:layout_width="fill_parent" android:layout_height="wrap_content">
<TextView android:text="@string/help" android:width="250dp"
android:layout_width="fill_parent" style="@style/xtext"/>
</TableRow>
</TableLayout>
<TableLayout
style="@style/xbg"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:onClick="onConf"
android:padding="10dp" >
<TableRow android:layout_width="fill_parent">
<TextView android:text="@string/app_name"/>
</TableRow>
<TableRow android:padding="10dp" android:layout_width="fill_parent" >
<ImageView android:src="@drawable/logo6"/>
<ImageView android:src="@drawable/logoupeu2"/>
</TableRow>
<TableRow android:layout_width="fill_parent">
<TextView android:text=""/>
<TextView android:text="@string/copy" style="@style/xcopy"/>
</TableRow>
</TableLayout>
</LinearLayout>
Archivo formulariocaja.xml:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:focusableInTouchMode="true"
style="@style/xbgFondo"
android:orientation="vertical">
<TableLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<TableRow
android:id="@+id/tableRow1"
android:layout_width="fill_parent"
android:layout_height="wrap_content" >
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="horizontal" >
<TextView
android:id="@+id/textView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
style="@style/xlabelform"
android:text="@string/form_Lb1" />
<EditText
android:id="@+id/formEtex1"
style="@style/xtexte"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:ems="10"
android:height="30dp" >
<requestFocus />
</EditText>
</LinearLayout>
</TableRow>
<TableRow
android:id="@+id/tableRow2"
android:layout_width="fill_parent"
android:layout_height="wrap_content" >
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal" >
<TextView
android:id="@+id/textView2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
style="@style/xlabelform"
android:text="@string/form_Lb2" />
<RadioGroup
android:id="@+id/radTipoForm"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal" >
<RadioButton
android:id="@+id/radTipo1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:checked="true"
android:text="Ingreso" />
<RadioButton
android:id="@+id/radTipo2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Egreso" />
</RadioGroup>
</LinearLayout>
</TableRow>
<TableRow
android:id="@+id/tableRow3"
android:layout_width="fill_parent"
android:layout_height="wrap_content" >
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="horizontal" >
<TextView
android:id="@+id/textView3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
style="@style/xlabelform"
android:text="@string/form_Lb3" />
<Spinner
android:id="@+id/selCuentaForm"
style="@style/xlabelform"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1" />
</LinearLayout>
</TableRow>
<TableRow
android:id="@+id/tableRow4"
android:layout_width="fill_parent"
android:layout_height="wrap_content" >
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="horizontal" >
<TextView
android:id="@+id/textView4"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
style="@style/xlabelform"
android:text="@string/form_Lb4" />
<EditText
android:id="@+id/formEtex2"
style="@style/xtexte"
android:layout_width="match_parent"
android:layout_height="31dp"
android:height="30dp"
android:inputType="numberDecimal" >
</EditText>
</LinearLayout>
</TableRow>
<TableRow
android:id="@+id/tableRow5"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_gravity="center" >
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="horizontal" >
<Button
android:id="@+id/btnform1"
style="@style/xbtnAdd"
android:layout_width="154dp"
android:layout_height="wrap_content"
android:background="@android:drawable/btn_default_small"
android:onClick="onAgregar"
android:text="@string/menu_add" />
<Button
android:id="@+id/btnform2"
android:layout_width="154dp"
android:layout_height="wrap_content"
android:background="@android:drawable/btn_default_small"
android:text="@string/menu_cancelar"
android:onClick="onRegresar"/>
</LinearLayout>
</TableRow>
</TableLayout>
</LinearLayout>
Archivo reportecaja.xml:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<TableLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_margin="5dp">
<TableRow android:layout_width="fill_parent">
<TextView android:id="@+id/cajaReportTitle" android:text="Reporte..." style="@style/xtitle"/>
</TableRow>
<TableRow android:layout_width="fill_parent">
<RadioGroup
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:id="@+id/RadioGroupReporteTipo">
<RadioButton android:checked="true" android:onClick="onClickRB"
android:id="@+id/RBOptionReportAll" android:text="Simple"/>
<RadioButton android:checked="false" android:onClick="onClickRB"
android:id="@+id/RBOptionReportOrder" android:text="Agrupado"/>
</RadioGroup>
</TableRow>
</TableLayout>
<TableLayout
android:id="@+id/tableLayoutCajaReport"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_margin="2dp">
</TableLayout>
</LinearLayout>
Archivo DAOdataUtils.java:
public class DAOdataUtils extends SQLiteAssetHelper {
Context ctx;
SQLiteDatabase db;
Cursor rs;
String sql;
private static final String DATABASE_NAME = "dbcheckitsaedmp.db";
private static final int DATABASE_VERSION = 1;
public DAOdataUtils(Context context) {
super(context, DATABASE_NAME, null, DATABASE_VERSION);
// TODO Auto-generated constructor stub
}
}
return rs;
}
public Cursor getListaCuentas() {
data=new DBCheckItsaeSQLite(ctx);
db=data.getReadableDatabase();
sql="select _id, nombre from cuenta;";
rs=db.rawQuery(sql, null);
return rs;
}
public Cursor listaSimpleCaja(){
data=new DBCheckItsaeSQLite(ctx);
db=data.getReadableDatabase();
sql="select _id, idCuenta, strftime('%d %H:%M', fecha) as fecha, detalle, tipo, (case when tipo=='Ingreso' then
importe else 0 end) as ingreso, (case when tipo=='Egreso' then importe else 0 end) as egreso from caja WHERE fecha >=
datetime('"+(getFecha("yyyy-MM")+"-01 00:00:00")+"') ORDER BY _id ASC;";
rs=db.rawQuery(sql, null);
return rs;
}
public Cursor listaGrupoCaja(){
data=new DBCheckItsaeSQLite(ctx);
db=data.getReadableDatabase();
sql="select c._id, c.idCuenta, strftime('%d %H:%M', c.fecha) as fecha, cu.nombre, c.tipo, (case when
c.tipo=='Ingreso' then c.importe else 0 end) as ingreso, (case when c.tipo=='Egreso' then c.importe else 0 end) as egreso
from caja as c, cuenta cu WHERE c.idCuenta=cu._id and fecha >= datetime('"+(getFecha("yyyy-MM")+"-01 00:00:00")+"') ORDER
BY c.idCuenta, c._id ASC;";
rs=db.rawQuery(sql, null);
return rs;
}
public void toInsert(int idCuenta, String detalle, String tipo, double importe){
data=new DBCheckItsaeSQLite(ctx);
db=data.getWritableDatabase();
sql="INSERT INTO caja (idCuenta, fecha, detalle, tipo,importe) VALUES("+idCuenta+", "
+ "datetime('"+getFecha("yyyy-MM-dd HH:mm:ss")+"'),'"+detalle+"', '"+tipo+"', "+importe+");";
db.execSQL(sql);
}
}
public void toStart(){
data=new DBCheckItsaeSQLite(ctx);
db=data.getWritableDatabase();
double presupuesto=getPresupuesto("pmes");
sql="INSERT INTO caja (idCuenta, fecha, detalle, tipo,importe) VALUES(3, datetime('"+getFecha("yyyy-MM-dd
HH:mm:ss")+"'),'Presupuesto', 'Ingreso', "+presupuesto+");";
db.execSQL(sql);
}
public boolean isStarted(){
data=new DBCheckItsaeSQLite(ctx);
db=data.getReadableDatabase();
sql="select count(*) from caja where idCuenta=3 ";
rs=db.rawQuery(sql, null);
if(rs.moveToNext()){
if(rs.getInt(0)==0){
return true;
}else{ return false; }
}else{
return false;
}
}
public String getFecha(String formato){
Date d=new Date();
SimpleDateFormat fmt=new SimpleDateFormat(formato);
return fmt.format(d);
}
}
from caja as c, cuenta cu WHERE c.idCuenta=cu._id and fecha >= datetime('"+(getFecha("yyyy-MM")+"-01 00:00:00")+"') ORDER
BY c.idCuenta, c._id ASC;";
rs=db.rawQuery(sql, null);
return rs;
}
public void toInsert(int idCuenta, String detalle, String tipo, double importe){
db = getReadableDatabase();
sql="INSERT INTO caja (idCuenta, fecha, detalle, tipo,importe) VALUES("+idCuenta+",
datetime('"+getFecha("yyyy-MM-dd HH:mm:ss")+"'),'"+detalle+"', '"+tipo+"', "+importe+");";
db.execSQL(sql);
}
public double getPresupuesto(String tipo){
db = getReadableDatabase();
sql="SELECT "+tipo+" FROM configuracion; ";
rs=db.rawQuery(sql, null);
if(rs.moveToNext()){
return rs.getDouble(0);
}else{
return 0;
}
}
public String getGrupoNm(int _id){
db = getReadableDatabase();
sql="SELECT nombre FROM cuenta WHERE _id="+_id+"; ";
rs=db.rawQuery(sql, null);
if(rs.moveToNext()){
return rs.getString(0);
}else{
return "< Saldo Inicial >";
}
}
Archivo FormCaja.java:
}
public void onRegresar(View v) {
startActivity(new Intent(this, MainActivity.class));
}
}
Archivo ReporteCaja.java:
public class ReporteCaja extends ActionBarActivity {
DAOdataUtils utils;
Cursor rs;
View vv;
@Override
protected void onCreate(Bundle savedInstanceState) {
// TODO Auto-generated method stub
super.onCreate(savedInstanceState);
setContentView(R.layout.reportecaja);
onReport(vv);
}
public void onClickRB(View v){
onReport(v);
}
public void onReport(View v){
RadioButton rb_all=(RadioButton)findViewById(R.id.RBOptionReportAll);
RadioButton rb_group=(RadioButton)findViewById(R.id.RBOptionReportOrder);
if(rb_all.isChecked() == true){
onReportAll(v);
}
if(rb_group.isChecked() == true){
onReportGroup();
}
}
public void onReportAll(View v){
TableLayout reporte=(TableLayout)findViewById(R.id.tableLayoutCajaReport);
reporte.removeAllViews();
TableRow oper;
int c=0; double tt_i=0; double tt_e=0;
TextView fecha; TextView motivo; TextView ingreso; TextView egreso;TextView opcion;
Button btn;
utils=new DAOdataUtils(this);
rs=utils.listaSimpleCaja();
OnClickListener onclik=new OnClickListener() {
@Override
public void onClick(View v) {
Button accion= (Button)v;
Log.v("Operacion", "Si se puede"+accion.getText());
//valorA+=accion.getText();
//txtResultado.setText(valorA);
}
};
while(rs.moveToNext()){
c++;
tt_i+=rs.getDouble(5);
tt_e+=rs.getDouble(6);
if(c==1){
oper=new TableRow(this);
fecha=new TextView(this);
fecha.setText(" Fecha");
fecha.setTextSize(12);
fecha.setTextColor(Color.parseColor("#505050"));
fecha.setBackgroundColor(Color.parseColor("#CEEBFF"));
motivo=new TextView(this);
motivo.setText(" Descripcion");
motivo.setTextSize(12);
motivo.setTextColor(Color.parseColor("#505050"));
motivo.setWidth(100);
motivo.setBackgroundColor(Color.parseColor("#CEEBFF"));
ingreso=new TextView(this);
ingreso.setText(" Ingreso");
ingreso.setTextSize(12);
ingreso.setTextColor(Color.parseColor("#505050"));
ingreso.setWidth(55);
ingreso.setBackgroundColor(Color.parseColor("#CEEBFF"));
egreso=new TextView(this);
egreso.setText(" Egreso");
egreso.setTextSize(12);
egreso.setTextColor(Color.parseColor("#505050"));
egreso.setWidth(55);
egreso.setBackgroundColor(Color.parseColor("#CEEBFF"));
opcion=new TextView(this);
opcion.setText(" Del");
opcion.setTextSize(12);
opcion.setTextColor(Color.parseColor("#505050"));
opcion.setWidth(40);
opcion.setBackgroundColor(Color.parseColor("#CEEBFF"));
oper.addView(fecha);
oper.addView(motivo);
oper.addView(ingreso);
oper.addView(egreso);
oper.addView(opcion);
reporte.addView(oper);
}
oper=new TableRow(this);
fecha=new TextView(this);
fecha.setText(rs.getString(2));
fecha.setTextColor(Color.YELLOW);
fecha.setTextSize(8);
motivo=new TextView(this);
motivo.setText(rs.getString(3));
motivo.setTextSize(12);
motivo.setWidth(100);
ingreso=new TextView(this);
ingreso.setText(""+(rs.getDouble(5)));
ingreso.setTextSize(12);
ingreso.setWidth(50);
egreso=new TextView(this);
egreso.setText(""+(rs.getDouble(6)));
egreso.setTextSize(12);
egreso.setWidth(50);
btn=new Button(this);
btn.setBackgroundColor(1);
btn.setText(""+rs.getDouble(0));
btn.setOnClickListener(onclik);
oper.addView(fecha);
oper.addView(motivo);
oper.addView(ingreso);
oper.addView(egreso);
oper.addView(btn);
reporte.addView(oper);
}
oper=new TableRow(this);
fecha=new TextView(this);
fecha.setText("");
motivo=new TextView(this);
motivo.setText(" TOTALES ");
motivo.setTextSize(12);
ingreso=new TextView(this);
ingreso.setText(""+tt_i);
ingreso.setTextSize(12);
ingreso.setTextColor(Color.parseColor("#505050"));
ingreso.setBackgroundColor(Color.parseColor("#3FFF7D"));
egreso=new TextView(this);
egreso.setText(""+tt_e);
egreso.setTextSize(12);
egreso.setTextColor(Color.parseColor("#505050"));
egreso.setWidth(55);
egreso.setBackgroundColor(Color.parseColor("#FFBCCB"));
opcion=new TextView(this);
opcion.setText(" ");
oper.addView(fecha);
oper.addView(motivo);
oper.addView(ingreso);
oper.addView(egreso);
oper.addView(opcion);
reporte.addView(oper);
oper=new TableRow(this);
fecha=new TextView(this);
fecha.setText("");
motivo=new TextView(this);
motivo.setText("");
motivo.setTextSize(12);
ingreso=new TextView(this);
ingreso.setText("SALDO");
ingreso.setTextSize(12);
ingreso.setTextColor(Color.parseColor("#505050"));
ingreso.setBackgroundColor(Color.parseColor("#3FFF7D"));
egreso=new TextView(this);
egreso.setText(""+(tt_i-tt_e));
egreso.setTextSize(12);
egreso.setTextColor(Color.parseColor("#505050"));
egreso.setWidth(55);
egreso.setBackgroundColor(Color.parseColor("#83EAFF"));
opcion=new TextView(this);
opcion.setText(" ");
oper.addView(fecha);
oper.addView(motivo);
oper.addView(ingreso);
oper.addView(egreso);
oper.addView(opcion);
reporte.addView(oper);
}
public void onReportGroup(){
TableLayout reporte=(TableLayout)findViewById(R.id.tableLayoutCajaReport);
reporte.removeAllViews();
TableRow oper;
int g=-1; double tt_i=0; double tt_e=0;
TextView fecha; TextView detalle; TextView ingreso; TextView egreso;
utils=new DAOdataUtils(this);
rs=utils.listaGrupoCaja();
while(rs.moveToNext()){
tt_i+=rs.getDouble(5);
tt_e+=rs.getDouble(6);
if(g!=rs.getInt(1)){
g=rs.getInt(1);
oper=new TableRow(this);
fecha=new TextView(this);
fecha.setText("");
fecha.setTextSize(12);
fecha.setTextColor(Color.parseColor("#505050"));
fecha.setBackgroundColor(Color.parseColor("#FFE329"));
detalle=new TextView(this);
detalle.setText(utils.getGrupoNm(g));
detalle.setTextSize(12);
detalle.setTextColor(Color.parseColor("#505050"));
detalle.setWidth(100);
detalle.setBackgroundColor(Color.parseColor("#FFE329"));
ingreso=new TextView(this);
ingreso.setText("");
ingreso.setTextSize(12);
ingreso.setTextColor(Color.parseColor("#505050"));
ingreso.setWidth(55);
ingreso.setBackgroundColor(Color.parseColor("#FFE329"));
egreso=new TextView(this);
egreso.setText("");
egreso.setTextSize(12);
egreso.setTextColor(Color.parseColor("#505050"));
egreso.setWidth(55);
egreso.setBackgroundColor(Color.parseColor("#FFE329"));
oper.addView(fecha);
oper.addView(detalle);
oper.addView(ingreso);
oper.addView(egreso);
reporte.addView(oper);
//cabeceras
oper=new TableRow(this);
fecha=new TextView(this);
fecha.setText(" Fecha");
fecha.setTextSize(12);
fecha.setTextColor(Color.parseColor("#505050"));
fecha.setBackgroundColor(Color.parseColor("#CEEBFF"));
detalle=new TextView(this);
detalle.setText(" Descripcion");
detalle.setTextSize(12);
detalle.setTextColor(Color.parseColor("#505050"));
detalle.setWidth(100);
detalle.setBackgroundColor(Color.parseColor("#CEEBFF"));
ingreso=new TextView(this);
ingreso.setText(" Ingreso");
ingreso.setTextSize(12);
ingreso.setTextColor(Color.parseColor("#505050"));
ingreso.setWidth(55);
ingreso.setBackgroundColor(Color.parseColor("#CEEBFF"));
egreso=new TextView(this);
egreso.setText(" Egreso");
egreso.setTextSize(12);
egreso.setTextColor(Color.parseColor("#505050"));
egreso.setWidth(55);
egreso.setBackgroundColor(Color.parseColor("#CEEBFF"));
oper.addView(fecha);
oper.addView(detalle);
oper.addView(ingreso);
oper.addView(egreso);
reporte.addView(oper);
}
oper=new TableRow(this);
fecha=new TextView(this);
fecha.setText(rs.getString(2));
fecha.setTextColor(Color.YELLOW);
fecha.setTextSize(8);
detalle=new TextView(this);
detalle.setText(rs.getString(3));
detalle.setTextSize(12);
detalle.setWidth(100);
ingreso=new TextView(this);
ingreso.setText(""+(rs.getDouble(5)));
ingreso.setTextSize(12);
ingreso.setWidth(50);
egreso=new TextView(this);
egreso.setText(""+(rs.getDouble(6)));
egreso.setTextSize(12);
egreso.setWidth(50);
oper.addView(fecha);
oper.addView(detalle);
oper.addView(ingreso);
oper.addView(egreso);
reporte.addView(oper);
}
oper=new TableRow(this);
fecha=new TextView(this);
fecha.setText("");
detalle=new TextView(this);
detalle.setText(" TOTALES ");
detalle.setTextSize(12);
ingreso=new TextView(this);
ingreso.setText(""+tt_i);
ingreso.setTextSize(12);
ingreso.setTextColor(Color.parseColor("#505050"));
ingreso.setBackgroundColor(Color.parseColor("#3FFF7D"));
egreso=new TextView(this);
egreso.setText(""+tt_e);
egreso.setTextSize(12);
egreso.setTextColor(Color.parseColor("#505050"));
egreso.setWidth(55);
egreso.setBackgroundColor(Color.parseColor("#FFBCCB"));
oper.addView(fecha);
oper.addView(detalle);
oper.addView(ingreso);
oper.addView(egreso);
reporte.addView(oper);
oper=new TableRow(this);
fecha=new TextView(this);
fecha.setText("");
detalle=new TextView(this);
detalle.setText("");
detalle.setTextSize(12);
ingreso=new TextView(this);
ingreso.setText(" SALDO: ");
ingreso.setTextSize(12);
ingreso.setTextColor(Color.parseColor("#505050"));
ingreso.setBackgroundColor(Color.parseColor("#3FFF7D"));
egreso=new TextView(this);
egreso.setText(""+(tt_i-tt_e));
egreso.setTextSize(12);
egreso.setTextColor(Color.parseColor("#505050"));
egreso.setWidth(55);
egreso.setBackgroundColor(Color.parseColor("#FFBCCB"));
oper.addView(fecha);
oper.addView(detalle);
oper.addView(ingreso);
oper.addView(egreso);
reporte.addView(oper);
}
}
Archivo AndroidManifest.xml:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="ec.edu.itsaecheckitsae"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="8"
android:targetSdkVersion="18" />
<application
android:allowBackup="true"
android:icon="@drawable/logo6"
android:label="@string/app_name"
android:theme="@style/AppTheme" >
<activity
android:name="ec.edu.itsae.checkitsae.MainActivity"
android:label="@string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name="ec.edu.itsae.checkitsae.FormCaja" android:label="@string/app_name"></activity>
<activity android:name="ec.edu.itsae.checkitsae.FormConfiguracion" android:label="@string/app_name"></activity>
<activity android:name="ec.edu.itsae.checkitsae.ReporteCaja" android:label="@string/app_name"></activity>
</application>
</manifest>
RESULTADO DE LA APLICACIN: