Aplicaciones de Android

Post on 17-Aug-2015

23 views 1 download

Transcript of Aplicaciones de Android

ES

CR

IBIR

NO

MB

RE

INDICE1. Hola Mundo

2. WalPaper3. Acelerometro

4. Galeria5. Calculadora

6. Camara7. CheckBox8. Radio Button

9. Giroscopio10. Sonidos animales

11. Widget12. Notificacion13. Navegador

14. Progress Bar15. ToggleButton

16. PhoneGap17. List View

18. Navegador19 VideoView

20. BD insertar21. BD eliminar22. BD modificar23. BD consultar

ES

CR

IBIR

NO

MB

RE

ES

CR

IBIR

NO

MB

RE

ES

CR

IBIR

NO

MB

RE

ES

CR

IBIR

NO

MB

RE

ES

CR

IBIR

NO

MB

RE

ES

CR

IBIR

NO

MB

RE

ES

CR

IBIR

NO

MB

RE

ES

CR

IBIR

NO

MB

RE

ES

CR

IBIR

NO

MB

RE

ES

CR

IBIR

NO

MB

RE

ES

CR

IBIR

NO

MB

RE

ES

CR

IBIR

NO

MB

RE

ES

CR

IBIR

NO

MB

RE

ES

CR

IBIR

NO

MB

RE

ES

CR

IBIR

NO

MB

RE

CODIGO XML

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" android:background="#FFCCFF" android:orientation="vertical" tools:context=".MainActivity" >

< ImageView android:id="@+id/image" android:layout_width="match_parent" android:layout_height="200dp" android:src="@drawable/image" />

<LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:orientation="horizontal" >

< ImageView android:id="@+id/image1" android:layout_width="100sp" android:layout_height="100sp" android:src="@drawable/image1" />

< ImageView android:id="@+id/image2" android:layout_width="100sp" android:layout_height="100sp" android:src="@drawable/image2" />

< ImageView android:id="@+id/image3" android:layout_width="100sp" android:layout_height="100sp" android:src="@drawable/image3" />

< ImageView android:id="@+id/image4" android:layout_width="100sp" android:layout_height="100sp" android:src="@drawable/image4" />

< ImageView android:id="@+id/image5" android:layout_width="100sp" android:layout_height="100sp" android:src="@drawable/image5" />

< ImageView android:id="@+id/image6" android:layout_width="100sp" android:layout_height="100sp" android:src="@drawable/image6" />

< ImageView android:id="@+id/image7" android:layout_width="100sp" android:layout_height="100sp" android:src="@drawable/image7" />

ES

CR

IBIR

NO

MB

RE

< ImageView android:id="@+id/image8" android:layout_width="100sp" android:layout_height="100sp" android:src="@drawable/image8" />

< ImageView android:id="@+id/image9" android:layout_width="100sp" android:layout_height="100sp" android:src="@drawable/image9" />

< ImageView android:id="@+id/image10" android:layout_width="100sp" android:layout_height="100sp" android:src="@drawable/image10" /> </LinearLayout><Button android:id="@+id/cambiar" android:layout_width="200sp" android:layout_marginLeft="55sp" android:layout_height="70sp" android:layout_marginTop="20sp" android:background="#FF6699" android:text = "Cambiar fondo de pantalla" /></LinearLayout>

CODIGO JAVA

package tania.wallpaper;

import android.app.Activity;import android.app.WallpaperManager;import android.os.Bundle;import android.view.View;import android.view.View.OnClickListener;import android.widget.*;

public class MainActivity extends Activity implements OnClickListener {ImageView image, image1, image2, image3, image4, image5, image6, image7,

image8, image9, image10;Button btn;int fondo;

@Overrideprotected void onCreate(Bundle savedInstanceState) {

super.onCreate(savedInstanceState);setContentView(R.layout.activity_main);image = (ImageView) findViewById(R.id.image);image1 = (ImageView) findViewById(R.id.image1);image2 = (ImageView) findViewById(R.id.image2);image3 = (ImageView) findViewById(R.id.image3);image4 = (ImageView) findViewById(R.id.image4);image5 = (ImageView) findViewById(R.id.image5);image6 = (ImageView) findViewById(R.id.image6);image7 = (ImageView) findViewById(R.id.image7);image8 = (ImageView) findViewById(R.id.image8);image9 = (ImageView) findViewById(R.id.image9);image10 = (ImageView) findViewById(R.id.image10);btn = (Button) findViewById(R.id.cambiar);image.setOnClickListener(this);image1.setOnClickListener(this);

ES

CR

IBIR

NO

MB

RE

image2.setOnClickListener(this);image3.setOnClickListener(this);image4.setOnClickListener(this);image5.setOnClickListener(this);image6.setOnClickListener(this);image7.setOnClickListener(this);image8.setOnClickListener(this);image9.setOnClickListener(this);image10.setOnClickListener(this);btn.setOnClickListener(this);

}

public void onClick(View v) {switch (v.getId()) {case R.id.image1:

image.setImageResource(R.drawable.image1);fondo = R.drawable.image1;break;

case R.id.image2:image.setImageResource(R.drawable.image2);fondo = R.drawable.image2;break;

case R.id.image3:image.setImageResource(R.drawable.image3);fondo = R.drawable.image3;break;

case R.id.image4:image.setImageResource(R.drawable.image4);fondo = R.drawable.image4;break;

case R.id.image5:image.setImageResource(R.drawable.image5);fondo = R.drawable.image5;break;

case R.id.image6:image.setImageResource(R.drawable.image6);fondo = R.drawable.image6;break;

case R.id.image7:image.setImageResource(R.drawable.image7);fondo = R.drawable.image7;break;

case R.id.image8:image.setImageResource(R.drawable.image8);fondo = R.drawable.image8;break;

case R.id.image9:image.setImageResource(R.drawable.image9);fondo = R.drawable.image9;break;

case R.id.image10:image.setImageResource(R.drawable.image10);fondo = R.drawable.image10;break;

case R.id.cambiar:WallpaperManager mywp = WallpaperManager

.getInstance(getApplicationContext());try {

mywp.setResource(fondo);} catch (Exception e) {

e.printStackTrace();}Toast.makeText(this, "Se ha cambiado tu fondo de pantalla",

Toast.LENGTH_LONG).show();

ES

CR

IBIR

NO

MB

RE

break; } } }

ACELEROMETRO

ES

CR

IBIR

NO

MB

RE

ES

CR

IBIR

NO

MB

RE

ES

CR

IBIR

NO

MB

RE

ES

CR

IBIR

NO

MB

RE

El primer texview es para

X

El segundo texview es para

Y

El tercer texview es para Z

Aplicamos un Protected void

onResume

Protected onCreate

Implementamos los metodos

Librerias

ES

CR

IBIR

NO

MB

RE

Nuestro resultado final es este

CODIGO XML

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical">

<TextView android:id="@+id/textView1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginTop="30dp" android:text = "Eje de las X" />

<TextView android:id="@+id/textView2" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginTop="60dp" android:text = "Eje de las Y" />

<TextView android:id="@+id/textView3" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginTop="90dp" android:text = "Eje de las Z" />

</RelativeLayout>

CODIGO JAVA

package tania.acelerometro;

import java.util.List;import android.hardware.Sensor;

ES

CR

IBIR

NO

MB

RE

import android.hardware.SensorEvent;import android.hardware.SensorEventListener;import android.hardware.SensorManager;import android.os.Bundle;import android.app.Activity;import android.content.pm.ActivityInfo;import android.view.Menu;import android.widget.TextView;

public class MainActivity extends Activity implements SensorEventListener {TextView x, y, z;private Sensor mAccelerometer;

@Overrideprotected void onCreate(Bundle savedInstanceState) {

super.onCreate(savedInstanceState);setContentView(R.layout.activity_main);x = (TextView) findViewById(R.id.textView1);y = (TextView) findViewById(R.id.textView2);z = (TextView) findViewById(R.id.textView3);

this.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);}

protected void onResume() {super.onResume();SensorManager sm = (SensorManager) getSystemService(SENSOR_SERVICE);List<Sensor> sensors = sm.getSensorList(Sensor.TYPE_ACCELEROMETER);if (sensors.size() > 0) {

sm.registerListener(this, sensors.get(0),SensorManager.SENSOR_DELAY_GAME);

}}

protected void onPause() {SensorManager mSensorManager = (SensorManager)

getSystemService(SENSOR_SERVICE);mSensorManager.unregisterListener(this, mAccelerometer);super.onPause();

}

protected void onStop() {SensorManager mSensorManager = (SensorManager)

getSystemService(SENSOR_SERVICE);mSensorManager.unregisterListener(this, mAccelerometer);super.onStop();

}

@Overridepublic void onAccuracyChanged(Sensor arg0, int arg1) {}

@Overridepublic void onSensorChanged(SensorEvent event) {

this.x.setText("X=" + event.values[SensorManager.DATA_X]);this.y.setText("X=" + event.values[SensorManager.DATA_Y]);this.z.setText("X=" + event.values[SensorManager.DATA_Z]);

}}

ES

CR

IBIR

NO

MB

RE

GALLERY

ES

CR

IBIR

NO

MB

RE

ES

CR

IBIR

NO

MB

RE

ES

CR

IBIR

NO

MB

RE

ES

CR

IBIR

NO

MB

RE

ES

CR

IBIR

NO

MB

RE

RESULTADO FINAL DE LA APP

ES

CR

IBIR

NO

MB

RE

CODIGO XML

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" tools:context="${relativePackage}.${activityClass}" android:orientation="vertical" android:background = "#000000" >

<Gallery android:id="@+id/gallery1" android:layout_width="fill_parent" android:layout_height="wrap_content" />

< ImageView android:id="@+id/image1" android:layout_width="match_parent" android:layout_height="match_parent" android:layout_gravity="center_horizontal" android:background="#000000" android:paddingTop="5dp" android:paddingBottom="5dp" android:paddingLeft="10dp" android:paddingRight="10dp" android:src="@drawable/pic7" />

</LinearLayout>

CODIGO DE JAVA

package androidinterview.com.androidgalleryview;import android.app.Activity;import android.content.Context;import android.content.res.TypedArray;import android.os.Bundle;import android.view.View;import android.view.ViewGroup;import android.widget.AdapterView;import android.widget.AdapterView.OnItemClickListener;import android.widget.BaseAdapter;import android.widget.Gallery;import android.widget.ImageView;import android.widget.Toast;@SuppressWarnings("deprecation")public class MainActivity extends Activity {

Integer[] imageIDs = { R.drawable.pic1, R.drawable.pic2, R.drawable.pic3,

R.drawable.pic4, R.drawable.pic5, R.drawable.pic6, R.drawable.pic7 };

@Overrideprotected void onCreate(Bundle savedInstanceState) {

super.onCreate(savedInstanceState);setContentView(R.layout.activity_main);Gallery gallery = (Gallery) findViewById(R.id.gallery1);gallery.setAdapter(new ImageAdapter(this));

ES

CR

IBIR

NO

MB

RE

gallery.setOnItemClickListener(new OnItemClickListener() {public void onItemClick(AdapterView<?> parent, View v,int position, long

id) {switch(position){case 1:

Toast.makeText(getBaseContext(),"DBZ Magin Boo Mr Satan Absorbido" + (position) + " seleccionada",Toast.LENGTH_SHORT).show();

break;case 2:

Toast.makeText(getBaseContext(),"DBZ Magin Boo Vegito Absorbido" + (position) + " seleccionada",Toast.LENGTH_SHORT).show();

break;case 3:

Toast.makeText(getBaseContext(),"Mi Pequeña La Adoro" + (position) + " seleccionada",Toast.LENGTH_SHORT).show();

break;case 4:

Toast.makeText(getBaseContext(),"Uniforme Paris Saint-Germain" + (position) + " seleccionada",Toast.LENGTH_SHORT).show();

break;case 5:

Toast.makeText(getBaseContext(),"DBZ Magin Boo Hecho Cosita" + (position) + " seleccionada",Toast.LENGTH_SHORT).show();

break;case 6:

Toast.makeText(getBaseContext(),"Cosita" + (position) + " seleccionada",Toast.LENGTH_SHORT).show();

break;case 7:

Toast.makeText(getBaseContext(),"Hecho Cosita" + (position) + " seleccionada",Toast.LENGTH_SHORT).show();

break;case 8:

Toast.makeText(getBaseContext(),"Hola" + (position) + " seleccionada",Toast.LENGTH_SHORT).show();

break;case 9:

Toast.makeText(getBaseContext(),"XD" + (position) + " seleccionada",Toast.LENGTH_SHORT).show();

break;case 10:

Toast.makeText(getBaseContext(),"Descupcion" + (position) + " seleccionada",Toast.LENGTH_SHORT).show();

break;}ImageView imageView = (ImageView) findViewById(R.id.image1);imageView.setImageResource(imageIDs[position]);

}});

}public class ImageAdapter extends BaseAdapter {

private Context context;private int itemBackground;public ImageAdapter(Context c) {

context = c;TypedArray a =

obtainStyledAttributes(R.styleable.MyGallery);itemBackground = a.getResourceId(

R.styleable.MyGallery_android_galleryItemBackground, 0);a.recycle();

}public int getCount() {

return imageIDs.length;}

ES

CR

IBIR

NO

MB

RE

public Object getItem(int position) {return position;

}public long getItemId(int position) {

return position;}public View getView(int position, View convertView, ViewGroup parent)

{ImageView imageView = new ImageView(context);imageView.setImageResource(imageIDs[position]);imageView.setLayoutParams(new Gallery.LayoutParams(100, 100));imageView.setBackgroundResource(itemBackground);return imageView;

}}

}

ES

CR

IBIR

NO

MB

RE

CALCULADORA

ES

CR

IBIR

NO

MB

RE

ES

CR

IBIR

NO

MB

RE

ES

CR

IBIR

NO

MB

RE

ES

CR

IBIR

NO

MB

RE

ES

CR

IBIR

NO

MB

RE

ES

CR

IBIR

NO

MB

RE

ES

CR

IBIR

NO

MB

RE

ES

CR

IBIR

NO

MB

RE

ES

CR

IBIR

NO

MB

RE

ES

CR

IBIR

NO

MB

RE

ESULTADO FINAL

CODIGO XML

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" android:layout_margin="15dp" android:orientation="vertical" >

<LinearLayout android:layout_width="match_parent" android:layout_height="match_parent" android:layout_weight="1" android:orientation="horizontal" >

<LinearLayout android:layout_width="match_parent" android:layout_height="match_parent" android:layout_weight = "1" android:orientation="vertical" >

<TextView android:id="@+id/resultado" android:layout_width="match_parent" android:layout_height="match_parent" android:layout_weight = "1" android:background="@drawable/fondo" android:gravity="right" android:textColor="#FFFFFF" android:textSize = "25dp" />

<TextView android:id="@+id/display" android:layout_width="match_parent" android:layout_height="match_parent"

ES

CR

IBIR

NO

MB

RE

android:layout_weight="1" android:background="@drawable/fondo" android:gravity="right" android:textColor="#FFFFFF" android:textSize = "30dp" /> </LinearLayout>

<Button android:id="@+id/borraruno" android:layout_width="150dp" android:layout_height="match_parent" android:layout_weight="1" android:background="@drawable/imagess" android:text = "DEL" android:textColor="#FFFFFF" /> </LinearLayout>

<LinearLayout android:layout_width="match_parent" android:layout_height="match_parent" android:layout_weight="1" android:orientation="horizontal" >

< Button android:id="@+id/siete" android:layout_width="match_parent" android:layout_height="match_parent" android:layout_weight = "1" android:background="@drawable/imagen" android:text = "7" android:textColor="#FFFFFF" android:textSize = "40dp" />

< Button android:id="@+id/ocho" android:layout_width="match_parent" android:layout_height="match_parent" android:layout_weight="1" android:background="@drawable/imagen" android:text = "8" android:textColor="#FFFFFF" android:textSize = "40dp" />

< Button android:id="@+id/nueve" android:layout_width="match_parent" android:layout_height="match_parent" android:layout_weight="1" android:background="@drawable/imagen" android:text = "9" android:textColor="#FFFFFF" android:textSize = "40dp" />

< Button android:id="@+id/borrartodo" android:layout_width="match_parent" android:layout_height="match_parent" android:layout_weight="1" android:background="@drawable/imagess" android:text = "AC" android:textColor="#FFFFFF" /> </LinearLayout>

<LinearLayout

ES

CR

IBIR

NO

MB

RE

android:layout_width="match_parent" android:layout_height="match_parent" android:layout_weight="1" android:orientation="horizontal" >

< Button android:id="@+id/cuatro" android:layout_width="match_parent" android:layout_height="match_parent" android:layout_weight = "1" android:background="@drawable/imagen" android:text = "4" android:textColor="#FFFFFF" android:textSize = "40dp" />

< Button android:id="@+id/cinco" android:layout_width="match_parent" android:layout_height="match_parent" android:layout_weight="1" android:background="@drawable/imagen" android:text = "5" android:textColor="#FFFFFF" android:textSize = "40dp" />

< Button android:id="@+id/seis" android:layout_width="match_parent" android:layout_height="match_parent" android:layout_weight="1" android:background="@drawable/imagen" android:text = "6" android:textColor="#FFFFFF" android:textSize = "40dp" />

< Button android:id="@+id/mas" android:layout_width="match_parent" android:layout_height="match_parent" android:layout_weight="1" android:background="@drawable/imagess" android:text = "+" android:textColor="#FFFFFF" android:textSize = "40dp" /> </LinearLayout>

<LinearLayout android:layout_width="match_parent" android:layout_height="match_parent" android:layout_weight="1" android:orientation="horizontal" >

< Button android:id="@+id/uno" android:layout_width="match_parent" android:layout_height="match_parent" android:layout_weight = "1" android:background="@drawable/imagen" android:text = "1" android:textColor="#FFFFFF" android:textSize = "40dp" />

< Button android:id="@+id/dos"

ES

CR

IBIR

NO

MB

RE

android:layout_width="match_parent" android:layout_height="match_parent" android:layout_weight="1" android:background="@drawable/imagen" android:text = "2" android:textColor="#FFFFFF" android:textSize = "40dp" />

< Button android:id="@+id/tres" android:layout_width="match_parent" android:layout_height="match_parent" android:layout_weight="1" android:background="@drawable/imagen" android:text = "3" android:textColor="#FFFFFF" android:textSize = "40dp" />

< Button android:id="@+id/menos" android:layout_width="match_parent" android:layout_height="match_parent" android:layout_weight="1" android:background="@drawable/imagess" android:text = "-" android:textColor="#FFFFFF" android:textSize = "40dp" /> </LinearLayout>

<LinearLayout android:layout_width="match_parent" android:layout_height="match_parent" android:layout_weight="1" android:orientation="horizontal" >

< Button android:id="@+id/cero" android:layout_width="match_parent" android:layout_height="match_parent" android:layout_weight = "1" android:background="@drawable/imagen" android:text = "0" android:textColor="#FFFFFF" android:textSize = "40dp" />

< Button android:id="@+id/punto" android:layout_width="match_parent" android:layout_height="match_parent" android:layout_weight="1" android:background="@drawable/imagess" android:text = "." android:textColor="#FFFFFF" android:textSize = "40dp" />

< Button android:id="@+id/igual" android:layout_width="match_parent" android:layout_height="match_parent" android:layout_weight="1" android:background="@drawable/imagess" android:text = "=" android:textColor="#FFFFFF" android:textSize = "40dp" />

ES

CR

IBIR

NO

MB

RE

< Button android:id="@+id/entre" android:layout_width="match_parent" android:layout_height="match_parent" android:layout_weight="1" android:background="@drawable/imagess" android:text = "/" android:textColor="#FFFFFF" android:textSize = "40dp" />

< Button android:id="@+id/por" android:layout_width="match_parent" android:layout_height="match_parent" android:layout_weight="1" android:background="@drawable/imagess" android:text = "*" android:textColor="#FFFFFF" android:textSize = "40dp" /> </LinearLayout>

</LinearLayout>

CODIGO DE JAVA

package tania.calculadora;import android.os.Bundle;import android.animation.ValueAnimator;import android.app.Activity;import android.view.Menu;import android.view.View;import android.view.View.OnClickListener;import android.widget.*;public class MainActivity extends Activity implements OnClickListener {

TextView display, anterior;float resultado = 0, num1 = 0, num2 = 0;int o = 0;boolean p = false, igual = false;

Button mas, menos, por, entre;Button DEL, AC;@Overrideprotected void onCreate(Bundle savedInstanceState) {

super.onCreate(savedInstanceState);setContentView(R.layout.activity_main);DEL = (Button) findViewById(R.id.borraruno);AC = (Button) findViewById(R.id.borrartodo);display = (TextView) findViewById(R.id.display);anterior = (TextView) findViewById(R.id.resultado);Button uno = (Button) findViewById(R.id.uno);Button dos = (Button) findViewById(R.id.dos);Button tres = (Button) findViewById(R.id.tres);Button cuatro = (Button) findViewById(R.id.cuatro);Button cinco = (Button) findViewById(R.id.cinco);Button seis = (Button) findViewById(R.id.seis);Button siete = (Button) findViewById(R.id.siete);Button ocho = (Button) findViewById(R.id.ocho);Button nueve = (Button) findViewById(R.id.nueve);Button cero = (Button) findViewById(R.id.cero);Button p = (Button) findViewById(R.id.punto);

ES

CR

IBIR

NO

MB

RE

Button igual = (Button) findViewById(R.id.igual);mas = (Button) findViewById(R.id.mas);menos = (Button) findViewById(R.id.menos);por = (Button) findViewById(R.id.por);entre = (Button) findViewById(R.id.entre);uno.setOnClickListener(this);dos.setOnClickListener(this);tres.setOnClickListener(this);cuatro.setOnClickListener(this);cinco.setOnClickListener(this);seis.setOnClickListener(this);siete.setOnClickListener(this);ocho.setOnClickListener(this);nueve.setOnClickListener(this);cero.setOnClickListener(this);p.setOnClickListener(this);igual.setOnClickListener(this);mas.setOnClickListener(this);menos.setOnClickListener(this);por.setOnClickListener(this);entre.setOnClickListener(this);DEL.setOnClickListener(this);AC.setOnClickListener(this);

}public void deshabilitar(){

mas.setEnabled(false);menos.setEnabled(false);por.setEnabled(false);entre.setEnabled(false);

}public void habilitar(){

mas.setEnabled(true);menos.setEnabled(true);por.setEnabled(true);entre.setEnabled(true);

}public boolean validar(){

if(display.getText().equals("")){Toast.makeText(this, "Falta Introducir

Número",Toast.LENGTH_SHORT).show();return false;

}else{if(o==0){num1=Float.parseFloat(display.getText().toString());}else{num2=Float.parseFloat(display.getText().toString());}return true;

}}public void borrar(){

display.setText("");anterior.setText("");resultado=0;num1=0;num2=0;

}

@Overridepublic void onClick(View v) {

switch(v.getId()){case R.id.mas:

if(validar()==true){if(igual==true)

{resultado=num1;igual=false;}else{resultado=0;}anterior.setText(num1+"+");

ES

CR

IBIR

NO

MB

RE

display.setText("");o=3;p=false;deshabilitar();

}break;

case R.id.menos:if(validar()==true){

if(igual==true){resultado=num1;igual=false;}else{resultado=0;}

anterior.setText(num1+"-");display.setText("");o=4;p=false;deshabilitar();

}break;

case R.id.por:if(validar()==true){

if(igual==true){resultado=num1;igual=false;}else{resultado=0;}

anterior.setText(num1+"*");display.setText("");o=5;p=false;deshabilitar();

}break;

case R.id.entre:if(validar()==true){

if(igual==true){resultado=num1;igual=false;}else{resultado=0;}

anterior.setText(num1+"/");display.setText("");o=6;p=false;deshabilitar();

}break;

case R.id.uno:if(igual==true){borrar(); igual=false;}display.append("1");break;

case R.id.dos:if(igual==true){borrar(); igual=false;}display.append("2");break;

case R.id.tres:if(igual==true){borrar(); igual=false;}display.append("3");break;

case R.id.cuatro:if(igual==true){borrar(); igual=false;}display.append("4");break;

case R.id.cinco:if(igual==true){borrar(); igual=false;}display.append("5");break;

case R.id.seis:if(igual==true){borrar(); igual=false;}display.append("6");break;

case R.id.siete:

ES

CR

IBIR

NO

MB

RE

if(igual==true){borrar(); igual=false;}display.append("7");break;

case R.id.ocho:if(igual==true){borrar(); igual=false;}display.append("8");break;

case R.id.nueve:if(igual==true){borrar(); igual=false;}display.append("9");break;

case R.id.cero:if(igual==true){borrar(); igual=false;}display.append("0");break;

case R.id.punto:if(p==false && igual==false){

display.append(".");p=true;

}else{if(p==false){if(resultado!=0){borrar();}display.append(".");p=true;igual=false;}

}break;

case R.id.borrartodo:borrar();habilitar();break;

case R.id.borraruno:String cad=display.getText().toString();if(!cad.equals("")){

char [] cadena=cad.toCharArray();String f="";for(int i=0;i<=cadena.length-2;i++){

f=f+cadena[i];}display.setText(f);

}else{Toast.makeText(this, "No hay

valores",Toast.LENGTH_SHORT).show();resultado=0;habilitar();

}break;

case R.id.igual:if(validar()==true){

switch(o){case 3: resultado=num1+num2;break;case 4: resultado=num1-num2;break;case 5: resultado=num1*num2;break;case 6: resultado=num1/num2;break;}

}o=0;p=false;num1=resultado;igual=true;habilitar();anterior.append(""+num2);display.setText(""+redondear(resultado));

ES

CR

IBIR

NO

MB

RE

CAMARA

ES

CR

IBIR

NO

MB

RE

ES

CR

IBIR

NO

MB

RE

ES

CR

IBIR

NO

MB

RE

ES

CR

IBIR

NO

MB

RE

RESULTADO FINAL

ES

CR

IBIR

NO

MB

RE

CODIGO XML

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical" tools:context=".MainActivity" >

<Button android:id="@+id/botoncapturar" android:layout_width="92dp" android:layout_height="58dp" android:layout_marginLeft="110sp" android:layout_marginTop="10sp" android:background="@drawable/camara" />

<LinearLayout android:layout_width="match_parent" android:layout_height="match_parent" android:background="@drawable/marco" android:gravity="center_horizontal" android:orientation="vertical" >

< ImageView android:id="@+id/imageviewfoto" android:layout_width="match_parent" android:layout_height="match_parent" android:layout_below = "@+id/botoncapturar" android:layout_margin="35sp" /> </LinearLayout>

</LinearLayout>

CODIGO DE JAVA

package tania.camara;

ES

CR

IBIR

NO

MB

RE

import android.os.Bundle;import android.app.Activity;import android.content.Intent;import android.graphics.Bitmap;import android.view.Menu;import android.view.View;import android.view.View.OnClickListener;import android.widget.Button;import android.widget.ImageView;public class camara extends Activity implements OnClickListener {

ImageView image;@Overrideprotected void onCreate(Bundle savedInstanceState) {

super.onCreate(savedInstanceState);setContentView(R.layout.activity_main);image = (ImageView) findViewById(R.id.action_settings);Button boton = (Button) findViewById(R.id.botoncapturar);boton.setOnClickListener(new OnClickListener() {

@Overridepublic void onClick(View v) {

Intent intent = new Intent(

android.provider.MediaStore.ACTION_IMAGE_CAPTURE);startActivityForResult(intent, 0);

}});

}@Overridepublic void onActivityResult(int requestCode, int resultCode, Intent data)

{super.onActivityResult(requestCode, resultCode, data);Bitmap bitmap = (Bitmap) data.getExtras().get("data");image.setImageBitmap(bitmap);

}@Overridepublic void onClick(View arg0) {

// TODO Auto-generated method stub}

}

ES

CR

IBIR

NO

MB

RE

CHECK BOX

ES

CR

IBIR

NO

MB

RE

ES

CR

IBIR

NO

MB

RE

ES

CR

IBIR

NO

MB

RE

ES

CR

IBIR

NO

MB

RE

ES

CR

IBIR

NO

MB

RE

RESULTADO FINAL

ES

CR

IBIR

NO

MB

RE

CODIGO XML

<?xml version="1.0" encoding="utf-8"?><LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" android:background="#990000" android:gravity="center" android:orientation="vertical" tools:context=".Checkbox" >

<TextView android:layout_width="fill_parent" android:text = "Deportes" android:textColor="#FFFFFF" android:textSize="50sp" />

<TextView android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_marginLeft="10sp" android:text = "¿Que Deporte Te Gusta Mas?" android:textColor="#FFFFFF" android:textSize="25sp" />

<CheckBox android:id="@+id/cereala" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginLeft="15sp" android:text = "Futbol" android:textColor="#FFFFFF" android:textSize="20sp" />

<CheckBox android:id="@+id/cerealb" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginLeft="15sp" android:text = "BasquetBol"

ES

CR

IBIR

NO

MB

RE

android:textColor="#FFFFFF" android:textSize="20sp" />

<CheckBox android:id="@+id/cerealc" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginLeft="15sp" android:text = "Voleibol" android:textColor="#FFFFFF" android:textSize="20sp" />

</LinearLayout>

CODIGO DE JAVA

package tania.checkbox;import android.app.Activity;import android.app.Notification;import android.app.NotificationManager;import android.app.PendingIntent;import android.content.Context;import android.content.Intent;import android.os.Bundle;import android.view.View;import android.view.View.OnClickListener;import android.widget.CheckBox;import android.widget.Toast;public class MainActivity extends Activity implements OnClickListener {

String message = "";private CheckBox a, b, c;@Overridepublic void onCreate(Bundle savedInstanceState) {

super.onCreate(savedInstanceState);setContentView(R.layout.activity_main);a = (CheckBox) findViewById(R.id.cereala);b = (CheckBox) findViewById(R.id.cerealb);c = (CheckBox) findViewById(R.id.cerealc);a.setOnClickListener(new OnClickListener() {

public void onClick(View v) {NotificationManager manager = (NotificationManager)

getSystemService(Context.NOTIFICATION_SERVICE);Notification notificacion = new Notification (

R.drawable. ic_launcher , "Tienes buen gusto" , System . currentTimeMillis ()) ;

Intent intent = new Intent(MainActivity.this,MainActivity.class);

PendingIntent pIntent = PendingIntent.getActivity(MainActivity.this, 0, intent, 0);

notificacion.setLatestEventInfo (MainActivity. this , "CheckBox" , "Seleccionaste una Casilla" , pIntent) ;

manager.notify(0, notificacion);

}});

b.setOnClickListener(new OnClickListener() {

public void onClick(View v) {NotificationManager manager = (NotificationManager)

getSystemService(Context.NOTIFICATION_SERVICE);

ES

CR

IBIR

NO

MB

RE

Notification notificacion = new Notification ( R.drawable. ic_launcher , "Exacto!!!" , System . currentTimeMillis ()) ;

Intent intent = new Intent(MainActivity.this,MainActivity.class);

PendingIntent pIntent = PendingIntent.getActivity(MainActivity.this, 0, intent, 0);

notificacion.setLatestEventInfo (MainActivity. this , "CheckBox" , "Seleccionaste UNa Casilla" , pIntent) ;

manager.notify(0, notificacion);}

});c.setOnClickListener(new OnClickListener() {

public void onClick(View v) {NotificationManager manager = (NotificationManager)

getSystemService(Context.NOTIFICATION_SERVICE);

Notification notificacion = new Notification ( R.drawable. ic_launcher , "Exacto!!!" , System . currentTimeMillis ()) ;

Intent intent = new Intent(MainActivity.this,MainActivity.class);

PendingIntent pIntent = PendingIntent.getActivity(MainActivity.this, 0, intent, 0);

notificacion.setLatestEventInfo (MainActivity. this , "CheckBox" , "Seleccionaste UNa Casilla" , pIntent) ;

manager.notify(0, notificacion);}

});

}

@Overridepublic void onClick(View arg0) {

switch (arg0.getId()) {case R.id.cereala:

message = "Tu respuesta Futbool Es buen gusto";Toast.makeText(this, message, Toast.LENGTH_SHORT).show();

break;case R.id.cerealb:

message = "Tu respuesta Basquetbol Es Super";Toast.makeText(this, message, Toast.LENGTH_SHORT).show();

break;case R.id.cerealc:

message = "Tu respuesta es Voleibol Es Hermoso";Toast.makeText(this, message, Toast.LENGTH_SHORT).show();

break;

}

}

ES

CR

IBIR

NO

MB

RE

RADIO BUTTON

ES

CR

IBIR

NO

MB

RE

ES

CR

IBIR

NO

MB

RE

ES

CR

IBIR

NO

MB

RE

ES

CR

IBIR

NO

MB

RE

ES

CR

IBIR

NO

MB

RE

RESULTADO FINAL

CODIGO XML<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" android:background="#666666" android:orientation="vertical" tools:context=".MainActivity" > <TextView android:id="@+id/textView1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignParentLeft = "true" android:layout_alignParentTop = "true" android:layout_marginLeft="18dp" android:layout_marginTop="18dp" android:text = "¿Qué te gusta comer mas?" android:textColor="#FFFF33" />

<RadioGroup android:id="@+id/radioGroup1" android:layout_width="wrap_content" android:layout_height="wrap_content" >

<RadioButton android:id="@+id/a" android:layout_width="wrap_content" android:layout_height="wrap_content" android:checked="true" android:text = "ENSALADA" />

<RadioButton

ES

CR

IBIR

NO

MB

RE

android:id="@+id/b" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text = "CHATARRA" />

<RadioButton android:id="@+id/c" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text = "LAS DOS" /> </RadioGroup>

<TextView android:id="@+id/textView2" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignLeft = "@+id/textView1" android:layout_below = "@+id/d" android:layout_marginTop="14dp" android:text = "¿Qué te gusta beber mas?" android:textColor="#FFFF33" />

<RadioGroup android:id="@+id/radioGroup2" android:layout_width="wrap_content" android:layout_height="wrap_content" > <RadioButton android:id="@+id/d" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignLeft = "@+id/textView2" android:layout_below = "@+id/a" android:text = "REFRESCO" />

<RadioButton android:id="@+id/e" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignLeft = "@+id/b" android:layout_below = "@+id/textView2" android:text = "AGUA SIMPLE" />

<RadioButton android:id="@+id/f" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignLeft = "@+id/b" android:layout_below = "@+id/b" android:text = "LOS DOS" /> </RadioGroup>

<TextView android:id="@+id/TextView3" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignLeft = "@+id/c" android:layout_below = "@+id/c" android:layout_marginTop="18dp" android:text = "¿Comes a tus horas?" android:textColor="#FFFF33" />

<RadioGroup android:id="@+id/radioGroup3" android:layout_width="wrap_content" android:layout_height="wrap_content" >

<RadioButton

ES

CR

IBIR

NO

MB

RE

android:id="@+id/g" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignLeft = "@+id/textView3" android:layout_below = "@+id/g" android:text = "NO" />

<RadioButton android:id="@+id/h" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignLeft = "@+id/g" android:layout_below = "@+id/h" android:text = "AVECES" />

<RadioButton android:id="@+id/i" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignLeft = "@+id/textView3" android:layout_below = "@+id/textView3" android:text = "SI" /> </RadioGroup>

</LinearLayout>

CODIGO DE JAVA

package skriom.radiobuttin;import android.os.Bundle;import android.app.Activity;import android.view.Menu;import android.view.View;import android.view.View.OnClickListener;import android.widget.RadioButton;import android.widget.Toast;public class MainActivity extends Activity implements OnClickListener {

RadioButton radio1, radio2, radio3, radio4, radio5, radio6, radio7, radio8,radio9;

@Overrideprotected void onCreate(Bundle savedInstanceState) {

super.onCreate(savedInstanceState);setContentView(R.layout.activity_main);radio1 = (RadioButton) findViewById(R.id.a);radio2 = (RadioButton) findViewById(R.id.b);radio3 = (RadioButton) findViewById(R.id.c);radio4 = (RadioButton) findViewById(R.id.d);radio5 = (RadioButton) findViewById(R.id.e);radio6 = (RadioButton) findViewById(R.id.f);radio7 = (RadioButton) findViewById(R.id.g);radio8 = (RadioButton) findViewById(R.id.h);radio9 = (RadioButton) findViewById(R.id.i);radio1.setOnClickListener(this);radio2.setOnClickListener(this);radio3.setOnClickListener(this);radio4.setOnClickListener(this);radio5.setOnClickListener(this);radio6.setOnClickListener(this);radio7.setOnClickListener(this);radio8.setOnClickListener(this);radio9.setOnClickListener(this);

}

ES

CR

IBIR

NO

MB

RE

public void onClick(View arg0) {switch (arg0.getId()) {case R.id.a:

Toast.makeText(this, "Estas Comiendo Saludable Sigue Asi",Toast.LENGTH_SHORT).show();

break;case R.id.b:

Toast.makeText(this, "Deberias Preocuparte Por Tu Salud",Toast.LENGTH_SHORT).show();

break;case R.id.c:

Toast.makeText(this, "Trata De Disminuir La Chatarra",Toast.LENGTH_SHORT).show();

break;case R.id.d:

Toast.makeText(this, "El refresco es malo para tu salud",

Toast.LENGTH_SHORT).show();break;

case R.id.e:Toast.makeText(this, "Sabes lo que te hace bien en el cuerpo",

Toast.LENGTH_SHORT).show();break;

case R.id.f:Toast.makeText(this,

"Disminuye un poco el refresco y bebe mas agua",Toast.LENGTH_SHORT).show();

break;case R.id.g:

Toast.makeText(this, "Debes comer cada tres horas",Toast.LENGTH_SHORT).show();

break;case R.id.h:

Toast.makeText(this, "Debes comer cada tres horas",Toast.LENGTH_SHORT).show();

break;case R.id.i:

Toast.makeText(this, "Perfecto tienes una dieta saludable",Toast.LENGTH_SHORT).show();

break;}

}}

ES

CR

IBIR

NO

MB

RE

RADIO BUTTON

ES

CR

IBIR

NO

MB

RE

ES

CR

IBIR

NO

MB

RE

ES

CR

IBIR

NO

MB

RE

ES

CR

IBIR

NO

MB

RE

ES

CR

IBIR

NO

MB

RE

ES

CR

IBIR

NO

MB

RE

CODIGO XML<?xml version="1.0" encoding="utf-8"?><LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical" > <Button android:layout_width="match_parent" android:layout_height="20px" android:background="#000000"/> <view android:layout_width="fill_parent" android:layout_height="wrap_content" class="com.example.pelota.PelotaDibujar" android:id="@+id/view"/>

</LinearLayout>

CODIGO JAVApackage com.example.pelota;import android.os.Bundle;import android.view.*;import android.app.Activity;import android.content.pm.ActivityInfo;public class Pelota extends Activity { PelotaDibujar dibujo; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); requestWindowFeature(Window.FEATURE_NO_TITLE); getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);

ES

CR

IBIR

NO

MB

RE

setContentView(R.layout.interfaz); setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT); }}package com.example.pelota;import android.content.Context;import android.graphics.*;import android.hardware.*;import android.os.Bundle;import android.util.AttributeSet;import android.util.DisplayMetrics;import android.view.*;import android.widget.Toast;public class PelotaDibujar extends View implements SensorEventListener { Paint pincel = new Paint();

int alto, ancho;int ejeX=0,ejeY=0,ejeZ1=0,ejeZ=0;String X,Y,Z;Context contexto;CharSequence texto="Perdiste";int duracion=Toast.LENGTH_SHORT;public PelotaDibujar(Context interfaz, AttributeSet atributos){

super(interfaz, atributos);SensorManager smAdministrador = (SensorManager)

getContext().getSystemService(Context.SENSOR_SERVICE); Sensor snsRotacion = smAdministrador.getDefaultSensor(Sensor.TYPE_ACCELEROMETER); smAdministrador.registerListener(this, snsRotacion, SensorManager.SENSOR_DELAY_FASTEST); //Se obtienen las medidas de la pantalla Display pantalla = ((WindowManager) getContext() .getSystemService(Context.WINDOW_SERVICE)).getDefaultDisplay(); ancho = pantalla.getWidth () ; alto = pantalla.getHeight () ; setMinimumHeight(alto); setMinimumWidth(ancho); }

@Override public void onSensorChanged(SensorEvent cambio) {

ejeX-=cambio.values[0];X=Float.toString(ejeX);if (ejeX < 20){

ejeX = 20;}else if(ejeX > (ancho-20)){

ejeX = ancho-20;}ejeY+=cambio.values[1];Y=Float.toString(ejeY);if (ejeY < 20){

ejeY = 20;}else if(ejeY > alto-60){

ejeY = alto-60;}if (ejeZ <= 30){

ejeZ = 30;if (ejeZ>=80){

ejeZ=80;if (ejeZ > 150){

ejeZ=150;}

}}

ES

CR

IBIR

NO

MB

RE

} @Override public void onDraw(Canvas lienzo) { lienzo.drawText("Te Quiero", ejeX+10, ejeY+20, pincel); lienzo.drawText("Alma Mariana <3", ejeX*4-(ejeX/10)*3, ejeY/5*6, pincel);

if(ejeX>=29 && ejeX<=31 && ejeY>=29 && ejeY<=31){ejeX=30;ejeY=30;

}pincel.setColor(Color.RED);lienzo.drawText("Eje 'X': "+X, 0, alto-75, pincel);pincel.setColor(Color.GREEN);lienzo.drawText("Eje 'Y': "+Y, 0, alto-60, pincel);if(ejeX!=60 || ejeY!=60){

invalidate();}

} @Override public void onAccuracyChanged(Sensor sensor, int accuracy) { // TODO Auto-generated method stub }}

ES

CR

IBIR

NO

MB

RE

SONIDOS DE ANIMALES

ES

CR

IBIR

NO

MB

RE

ES

CR

IBIR

NO

MB

RE

ES

CR

IBIR

NO

MB

RE

ES

CR

IBIR

NO

MB

RE

ES

CR

IBIR

NO

MB

RE

ES

CR

IBIR

NO

MB

RE

ES

CR

IBIR

NO

MB

RE

RESULTADO FINAL

CODIGO XML

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"

ES

CR

IBIR

NO

MB

RE

xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" android:background="#CC66CC" android:orientation="vertical" tools:context=".MainActivity" >

<LinearLayout android:layout_width="match_parent" android:layout_height="match_parent" android:layout_weight="1" android:gravity="center" android:orientation="horizontal" >

< Button android:id="@+id/a1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_margin = "10px" android:layout_weight = "1" android:background="@drawable/burro" android:gravity="center" > </Button>

< Button android:id="@+id/a2" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_margin = "10px" android:layout_weight="1" android:background="@drawable/caballo" android:gravity="center" > </Button>

< Button android:id="@+id/a3" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_margin = "10px" android:layout_weight="1" android:background="@drawable/cerdo" android:gravity="center" > </Button> </LinearLayout>

<LinearLayout android:layout_width="match_parent" android:layout_height="match_parent" android:layout_weight="1" android:gravity="center" android:orientation="horizontal" >

< Button android:id="@+id/a4" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_margin = "10px" android:layout_weight = "1" android:background="@drawable/gato" android:gravity="center" > </Button>

< Button android:id="@+id/a5"

ES

CR

IBIR

NO

MB

RE

android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_margin = "10px" android:layout_weight="1" android:background="@drawable/obeja" android:gravity="center" > </Button>

< Button android:id="@+id/a6" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_margin = "10px" android:layout_weight="1" android:background="@drawable/oso" android:gravity="center" > </Button> </LinearLayout>

<LinearLayout android:layout_width="match_parent" android:layout_height="match_parent" android:layout_weight="1" android:gravity="center" android:orientation="horizontal" >

< Button android:id="@+id/a7" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_margin = "10px" android:layout_weight = "1" android:background="@drawable/pajaro" android:gravity="center" > </Button>

< Button android:id="@+id/a8" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_margin = "10px" android:layout_weight="1" android:background="@drawable/perro" android:gravity="center" > </Button>

< Button android:id="@+id/a9" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_margin = "10px" android:layout_weight="1" android:background="@drawable/vaca" android:gravity="center" > </Button> </LinearLayout>

<LinearLayout android:layout_width="match_parent" android:layout_height="match_parent" android:layout_weight="1" android:gravity="center" android:orientation="horizontal" >

ES

CR

IBIR

NO

MB

RE

<Button android:id="@+id/a10" android:layout_width="100dp" android:layout_height="100dp" android:layout_margin = "10px" android:background="@drawable/pato" android:gravity="center" > </Button> </LinearLayout>

</LinearLayout>

CODIGO JAVA

package tania.sonidos_animales;

import android.media.AudioManager;import android.media.SoundPool;import android.os.Bundle;import android.app.Activity;import android.view.Menu;import android.view.View;import android.view.View.OnClickListener;import android.widget.Button;

public class MainActivity extends Activity implements OnClickListener {SoundPool sp;Button a1, a2, a3, a4, a5, a6, a7, a8, a9, a10;int b1, b2, b3, b4, b5, b6, b7, b8, b9, b10;

@Overrideprotected void onCreate(Bundle savedInstanceState) {

super.onCreate(savedInstanceState);setContentView(R.layout.activity_main);a1 = (Button) findViewById(R.id.a1);a2 = (Button) findViewById(R.id.a2);a3 = (Button) findViewById(R.id.a3);a4 = (Button) findViewById(R.id.a4);a5 = (Button) findViewById(R.id.a5);a6 = (Button) findViewById(R.id.a6);a7 = (Button) findViewById(R.id.a7);a8 = (Button) findViewById(R.id.a8);a9 = (Button) findViewById(R.id.a9);a10 = (Button) findViewById(R.id.a10);a1.setOnClickListener((OnClickListener) this);a2.setOnClickListener((OnClickListener) this);a3.setOnClickListener((OnClickListener) this);a4.setOnClickListener((OnClickListener) this);a5.setOnClickListener((OnClickListener) this);a6.setOnClickListener((OnClickListener) this);a7.setOnClickListener((OnClickListener) this);a8.setOnClickListener((OnClickListener) this);a9.setOnClickListener((OnClickListener) this);a10.setOnClickListener((OnClickListener) this);sp = new SoundPool(8, AudioManager.STREAM_MUSIC, 0);b1 = sp.load(this, R.raw.burro, 1);b2 = sp.load(this, R.raw.caballo, 1);b3 = sp.load(this, R.raw.cerdo, 1);b4 = sp.load(this, R.raw.gato, 1);b5 = sp.load(this, R.raw.obeja, 1);b6 = sp.load(this, R.raw.oso, 1);b7 = sp.load(this, R.raw.pajaro, 1);

ES

CR

IBIR

NO

MB

RE

b8 = sp.load(this, R.raw.perro, 1);b9 = sp.load(this, R.raw.vaca, 1);b10 = sp.load(this, R.raw.pato, 1);

}

@Overridepublic void onClick(View v) {

// TODO Auto-generated method stubswitch (v.getId()) {case R.id.a1:

sp.play(b1, 1, 1, 1, 0, 1);break;

case R.id.a2:sp.play(b2, 1, 1, 1, 0, 1);break;

case R.id.a3:sp.play(b3, 1, 1, 1, 0, 1);break;

case R.id.a4:sp.play(b4, 1, 1, 1, 0, 1);break;

case R.id.a5:sp.play(b5, 1, 1, 1, 0, 1);break;

case R.id.a6:sp.play(b6, 1, 1, 1, 0, 1);break;

case R.id.a7:sp.play(b7, 1, 1, 1, 0, 1);break;

case R.id.a8:sp.play(b8, 1, 1, 1, 0, 1);break;

case R.id.a9:sp.play(b9, 1, 1, 1, 0, 1);break;

case R.id.a10:sp.play(b10, 1, 1, 1, 0, 1);break;

}

}

}

ES

CR

IBIR

NO

MB

RE

WIDGET

ES

CR

IBIR

NO

MB

RE

ES

CR

IBIR

NO

MB

RE

ES

CR

IBIR

NO

MB

RE

ES

CR

IBIR

NO

MB

RE

ES

CR

IBIR

NO

MB

RE

RESULTADO FINAL

CODIGO XML<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" android:background="#FFFF33" tools:context=".MainActivity" >

<Button android:id="@+id/abrir" android:layout_width="100sp" android:layout_height="100sp" android:layout_alignParentRight="true" android:layout_alignParentTop="true" android:layout_marginRight="92dp" android:layout_marginTop="100dp" android:background="@drawable/ya" />

</RelativeLayout>}

CODIGO JAVA

package tania.widget;

import android.net.Uri;import android.os.Bundle;import android.app.Activity;import android.app.PendingIntent;import android.appwidget.AppWidgetManager;import android.appwidget.AppWidgetProvider;import android.content.Context;

ES

CR

IBIR

NO

MB

RE

import android.content.Intent;import android.view.Menu;import android.widget.RemoteViews;

public class MainActivity extends AppWidgetProvider {

public void onUpdate(Context context, AppWidgetManager appWidgetManager,int[] appWidgetIds) {

super.onUpdate(context, appWidgetManager, appWidgetIds);for (int i = 0; i < appWidgetIds.length; i++) {

int appWidget = appWidgetIds[i];Intent intent = new Intent(Intent.ACTION_VIEW,

Uri.parse("https://www.facebook.com"));PendingIntent padingIntent = PendingIntent.getActivity(context,

0,intent, 0);

RemoteViews vistas = new RemoteViews(context.getPackageName(),R.layout.activity_main);

vistas.setOnClickPendingIntent(R.id.abrir, padingIntent);appWidgetManager.updateAppWidget(appWidgetIds, vistas);

}

}}

ES

CR

IBIR

NO

MB

RE

NOTIFICACIONES

ES

CR

IBIR

NO

MB

RE

ES

CR

IBIR

NO

MB

RE

ES

CR

IBIR

NO

MB

RE

ES

CR

IBIR

NO

MB

RE

ES

CR

IBIR

NO

MB

RE

ES

CR

IBIR

NO

MB

RE

RESULTADO FINAL

CODIGO XML<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" android:background="#99FFFF" tools:context=".MainActivity" >

<TextView android:id="@+id/textView1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_margin="20dp" android:text = "Notificacion" android:textSize = "50dp" />

<Button android:id="@+id/btn" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignLeft="@+id/textView1" android:layout_below="@+id/textView1" android:layout_marginLeft="67dp" android:layout_marginTop="74dp"

ES

CR

IBIR

NO

MB

RE

android:text = "Notificacion" />

</RelativeLayout>

CODIGO DE JAVApackage tania.notificaciones;

import android.os.Bundle;import android.app.Activity;import android.view.Menu;import android.widget.RemoteViews;import android.widget.Button;import android.view.View;import java.util.Timer;import java.util.TimerTask;import android.app.Notification;import android.app.NotificationManager;import android.app.PendingIntent;import android.content.Intent;

public class MainActivity extends Activity {private final int NOTIFICATION_ID = 1010;

private void triggerNotification() {

NotificationManager notificationManager = (NotificationManager) getSystemService(NOTIFICATION_SERVICE);

Notification notification = new Notification (R.drawable. ic_launcher , "¡Nuevo mensaje!" , System. currentTimeMillis ()) ;

RemoteViews contentView = new RemoteViews(getPackageName(),R.layout.activity_main);

contentView.setImageViewResource(R.id.action_settings,R.drawable.ic_launcher);

contentView.setTextViewText(R.id.action_settings,"Ey mundo! Esta es mi notificación personalizada.");

notification.contentView = contentView;

Intent notificationIntent = new Intent();PendingIntent contentIntent = PendingIntent.getActivity(this, 0,

notificationIntent, 0);notification.contentIntent = contentIntent;

notificationManager.notify(NOTIFICATION_ID, notification);}

@Overrideprotected void onCreate(Bundle savedInstanceState) {

super.onCreate(savedInstanceState);setContentView(R.layout.activity_main);Button btn = (Button) findViewById(R.id.btn);

btn.setOnClickListener(new View.OnClickListener() {@Overridepublic void onClick(View v) {

Timer timer = new Timer();TimerTask timerTask = new TimerTask() {

@Overridepublic void run() {

triggerNotification();

ES

CR

IBIR

NO

MB

RE

}};timer.schedule(timerTask, 0);

}});

}

@Overridepublic boolean onCreateOptionsMenu(Menu menu) {

// Inflate the menu; this adds items to the action bar if it is present.

getMenuInflater().inflate(R.menu.main, menu);return true;

}

}

ES

CR

IBIR

NO

MB

RE

NAVEGADOR

ES

CR

IBIR

NO

MB

RE

ES

CR

IBIR

NO

MB

RE

ES

CR

IBIR

NO

MB

RE

ES

CR

IBIR

NO

MB

RE

ES

CR

IBIR

NO

MB

RE

RESULTADO FINAL

ES

CR

IBIR

NO

MB

RE

CODIGO XML<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical" >

<LinearLayout android:layout_width="match_parent" android:layout_height="match_parent" android:layout_margin="5sp" android:layout_weight="3" android:orientation="horizontal" >

<EditText android:id="@+id/Buscador" android:layout_width="match_parent" android:layout_height="match_parent" android:layout_weight = "1" android:hint = "Introduce url" />

<Button android:id="@+id/buscar" style="@android:style/Animation.Toast" android:layout_width="match_parent" android:layout_height="match_parent" android:layout_weight="4" android:background="@drawable/buscar1" /> </LinearLayout>

<LinearLayout android:layout_width="match_parent" android:layout_height="match_parent" android:layout_margin="10sp" android:layout_weight="3" android:orientation="horizontal" >

<Button android:id="@+id/atras" android:layout_width="match_parent" android:layout_height="match_parent" android:layout_weight = "4" android:background="@drawable/atras" />

<Button android:id="@+id/actualizar" android:layout_width="match_parent" android:layout_height="fill_parent" android:layout_weight="4" android:background="@drawable/update" />

<Button android:id="@+id/Siguiente" android:layout_width="match_parent" android:layout_height="50sp" android:layout_weight="4" android:background="@drawable/siguiente" />

<Button android:id="@+id/historial" android:layout_width="match_parent"

ES

CR

IBIR

NO

MB

RE

android:layout_height="fill_parent" android:layout_weight="4" android:background="@drawable/borrar" /> </LinearLayout>

<LinearLayout android:layout_width="match_parent" android:layout_height="match_parent" android:layout_margin="10sp" android:layout_weight="1" android:orientation="horizontal" >

<WebView android:id="@+id/webview" android:layout_width="match_parent" android:layout_height="match_parent" /> </LinearLayout>

</LinearLayout>

CODIGO JAVA

package striker.navegador;import android.os.Bundle;import android.view.View;import android.view.View.OnClickListener;import android.webkit.WebView;import android.widget.*;import android.app.Activity;

public class MainActivity extends Activity implements OnClickListener {

WebView mibuscador;EditText sitio;

@Overrideprotected void onCreate(Bundle savedInstanceState) {

super.onCreate(savedInstanceState);setContentView(R.layout.activity_main);mibuscador = (WebView) findViewById(R.id.webview);String defecto = "https://www.google.com.mx";mibuscador.loadUrl(defecto);Button buscar = (Button) findViewById(R.id.buscar);Button atras = (Button) findViewById(R.id.atras);Button sig = (Button) findViewById(R.id.Siguiente);Button act = (Button) findViewById(R.id.actualizar);Button delete = (Button) findViewById(R.id.historial);sitio = (EditText) findViewById(R.id.Buscador);buscar.setOnClickListener(this);atras.setOnClickListener(this);sig.setOnClickListener(this);act.setOnClickListener(this);delete.setOnClickListener(this);

}

public void onClick(View v) {switch (v.getId()) {case R.id.buscar:

String sitioWeb = sitio.getText().toString();if (!sitioWeb.equals("")) {

ES

CR

IBIR

NO

MB

RE

mibuscador.loadUrl("https://" + sitioWeb);} else {

Toast.makeText(MainActivity.this, "No hay URL",Toast.LENGTH_LONG).show();

}break;

case R.id.atras:if (mibuscador.canGoBack()) {

mibuscador.goBack();}break;

case R.id.Siguiente:if (mibuscador.canGoForward()) {

mibuscador.goForward();}break;

case R.id.actualizar:mibuscador.reload();break;

case R.id.historial:mibuscador.clearHistory();Toast.makeText(MainActivity.this, "Historial Borrado",

Toast.LENGTH_LONG).show();break;

}}

}

ES

CR

IBIR

NO

MB

RE

PROGRESS BAR

ES

CR

IBIR

NO

MB

RE

ES

CR

IBIR

NO

MB

RE

ES

CR

IBIR

NO

MB

RE

ES

CR

IBIR

NO

MB

RE

ES

CR

IBIR

NO

MB

RE

RESULTADO

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" android:gravity="center" android:background="@drawable/ic_launcher" android:orientation="vertical" >

<TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:fontFamily="Arial" android:gravity="center" android:text = "App Realizada Por 403 \n \n \n Descargar Archivo.." />

<Button android:id="@+id/button1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text = "Descargar" />

<VideoView android:id="@+id/videoView1"

ES

CR

IBIR

NO

MB

RE

android:layout_width="match_parent" android:layout_height="wrap_content" />

</LinearLayout>

CODIGO JAVA

package meridame.progresbar;import android.app.Activity;import android.app.ProgressDialog;import android.content.Intent;import android.net.Uri;import android.os.Bundle;import android.os.Handler;import android.view.Menu;import android.view.MenuItem;import android.view.View;import android.widget.Button;import android.widget.MediaController;import android.widget.VideoView;import android.widget.MediaController;

public class MainActivity extends Activity {VideoView video;

Button b1; private ProgressDialog progressBar; private int progressBarStatus = 0; private Handler progressBarbHandler = new Handler(); private long fileSize = 0; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); b1=(Button)findViewById(R.id.button1); video=(VideoView) findViewById(R.id.videoView1); b1.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { progressBar = new ProgressDialog(v.getContext()); progressBar.setCancelable(true); progressBar.setMessage("Descargando..."); progressBar.setProgressStyle(ProgressDialog.STYLE_SPINNER); progressBar.setProgress(0); progressBar.setMax(100); progressBar.show(); progressBarStatus = 0; fileSize = 0; new Thread(new Runnable() { public void run() { while (progressBarStatus < 100) { progressBarStatus = downloadFile();

ES

CR

IBIR

NO

MB

RE

try { Thread.sleep(1000); } catch (InterruptedException e) { e.printStackTrace(); } progressBarbHandler.post(new Runnable() { public void run() { progressBar.setProgress(progressBarStatus); } }); } if (progressBarStatus >= 100) { try { Thread.sleep(2000); reproducir(); } catch (InterruptedException e) { e.printStackTrace(); } progressBar.dismiss(); } } }).start(); } }); } public int downloadFile() { while (fileSize <= 1000000) { fileSize++; if (fileSize == 100000) { return 10; } else if (fileSize == 200000) { return 20; } else if (fileSize == 300000) { return 30; } else if (fileSize == 400000) { return 40; } else if (fileSize == 500000) { return 50; } else if (fileSize == 700000) { return 70; } else if (fileSize == 800000) { return 80; } } return 100;

ES

CR

IBIR

NO

MB

RE

} public void reproducir(){

Uri path= Uri.parse("android.resource://meridane.video/" + R.raw.santaflow); video.setVideoURI(path); video.setMediaController(new MediaController(this)); video.start(); video.requestFocus(); } @Override public boolean onCreateOptionsMenu(Menu menu) { // Inflate the menu; this adds items to the action bar if it is present. getMenuInflater().inflate(R.menu.main, menu); return true; } @Override public boolean onOptionsItemSelected(MenuItem item) { // Handle action bar item clicks here. The action bar will // automatically handle clicks on the Home/Up button, so long // as you specify a parent activity in AndroidManifest.xml. int id = item.getItemId(); //noinspection SimplifiableIfStatement if (id == R.id.action_settings) { return true; } return super.onOptionsItemSelected(item); }

ES

CR

IBIR

NO

MB

RE

}

DB COMPLEMENTOS

ES

CR

IBIR

NO

MB

RE

ES

CR

IBIR

NO

MB

RE

ES

CR

IBIR

NO

MB

RE

ES

CR

IBIR

NO

MB

RE

ES

CR

IBIR

NO

MB

RE

ES

CR

IBIR

NO

MB

RE

ES

CR

IBIR

NO

MB

RE

z

ES

CR

IBIR

NO

MB

RE

ES

CR

IBIR

NO

MB

RE

RESULTADO FINAL

CODOGO XML

CODOGO XML

ES

CR

IBIR

NO

MB

RE

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" android:background="#000000" android:orientation="vertical" >

<EditText android:id="@+id/nombre" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_margin="10sp" android:background="#00CCFF" android:gravity="center" android:hint = "Marca" android:maxLength="20" android:textSize="20sp" />

<EditText android:id="@+id/apellido" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_margin="10sp" android:background="#00CCFF" android:gravity="center" android:hint = "RAM" android:maxLength="20" android:textSize="20sp" />

<EditText android:id="@+id/edad" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_margin="10sp" android:background="#00CCFF" android:gravity="center" android:hint = "Procesador" android:maxLength="20" android:textSize="20sp" />

<LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_weight="0" android:orientation="horizontal" >

<Button android:id="@+id/insertar" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_margin="10sp" android:layout_weight = "1" android:background="#FFFFFF" android:gravity="center" android:maxLength="20" android:onClick="Insertar" android:text = "Insertar" android:textSize="20sp" />

<Button android:id="@+id/ver" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_margin="10sp"

ES

CR

IBIR

NO

MB

RE

android:layout_weight="1" android:background="#FFFFFF" android:onClick="Ver" android:text = "Ver" android:textSize="20sp" /> <Button android:id="@+id/borrar" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_margin="10sp" android:layout_weight="1" android:background="#FFFFFF" android:onClick="Borrar" android:text = "Borrar" android:textSize="20sp" />

</LinearLayout>

<LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_weight="0" android:orientation="horizontal" >

<EditText android:id="@+id/id" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_weight = "1" android:layout_margin="10sp" android:background="#00CCFF" android:gravity="center" android:hint = "ID" android:maxLength="20" android:textSize="20sp" />

<Button android:id="@+id/buscar" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_weight="1" android:layout_margin="10sp" android:background="#FFFFFF" android:onClick="Buscar" android:text = "buscar" android:textSize="20sp" /> <Button android:id="@+id/modificar" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_margin="10sp" android:layout_weight="1" android:background="#FFFFFF" android:onClick="Modificar" android:text = "Modificar" android:textSize="20sp" /> </LinearLayout> <ScrollView android:layout_width="match_parent" android:layout_height="wrap_content" >

ES

CR

IBIR

NO

MB

RE

<TextView android:id="@+id/tver" android:layout_width="match_parent" android:layout_height="wrap_content" android:text = "TextView" android:textColor="#FFFFFF" /> </ScrollView>

</LinearLayout>

CODIGO DE JAVA

package com.Sparda.modificar;

import android.os.Bundle;import android.app.Activity;import android.view.View;import android.widget.Button;import android.widget.EditText;import android.widget.TextView;import android.widget.Toast;

public class Pricipal extends Activity {EditText eNombre, eApellido, eEdad,id;

TextView tVer; Button insertar, ver,buscar,borrar; int idm; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_pricipal); insertar = (Button)findViewById(R.id.insertar); ver = (Button)findViewById(R.id.ver); buscar = (Button)findViewById(R.id.buscar); borrar = (Button)findViewById(R.id.borrar); eNombre = (EditText)findViewById(R.id.nombre); id = (EditText)findViewById(R.id.id); eApellido = (EditText)findViewById(R.id.apellido); eEdad = (EditText)findViewById(R.id.edad); tVer = (TextView)findViewById(R.id.tver); } public void Insertar(View v){

String marca = eNombre.getText().toString(); String ram = eApellido.getText().toString(); String procesador = eEdad.getText().toString(); Compus p = new Compus(Pricipal.this); p.abrirSqlite(); p.insertar(marca, ram, procesador); p.cerrarSqlite();

} public void Ver(View v){ Compus p = new Compus(Pricipal.this); p.abrirSqlite(); String datos=p.ver(); p.cerrarSqlite(); tVer.setText(datos); }

public void Borrar(View v){

ES

CR

IBIR

NO

MB

RE

Compus p = new Compus(Pricipal.this); p.abrirSqlite(); p.elimina(idm); p.cerrarSqlite(); Toast.makeText(this,"Registro eliminado id="+idm,

Toast.LENGTH_LONG).show(); limpiar(); }

public void limpiar(){ eApellido.setText("");

eEdad.setText(""); eNombre.setText(""); id.setText(""); tVer.setText(""); } public void Modificar(View v){

String marca = eNombre.getText().toString(); String ram = eApellido.getText().toString(); String procesador = eEdad.getText().toString(); Compus p = new Compus(Pricipal.this); p.abrirSqlite(); p.modificar(idm, marca, ram, procesador); limpiar(); p.cerrarSqlite(); }

public void Buscar(View v){

if(id.length()==0){ Toast.makeText(this,"Introduce ID", Toast.LENGTH_LONG).show();

}else{ Compus p = new Compus(Pricipal.this); int i=Integer.parseInt(id.getText().toString()); p.abrirSqlite(); if(p.consultar(i)==false){ Toast.makeText(this,"Registro no encontrado",

Toast.LENGTH_LONG).show(); } idm=p.getId(); eNombre.setText(""+p.getMarca()); eApellido.setText(""+p.getRam()); eEdad.setText(""+p.getProcesador()); p.cerrarSqlite(); } }

}

package com.Sparda.modificar;

import android.content.ContentValues;import android.content.Context;import android.database.Cursor;import android.database.sqlite.SQLiteDatabase;import android.widget.Toast;

public class Compus {String marca, ram , procesador;

int idn;Context contextoEjecucion;BaseDatos creador;SQLiteDatabase mDatos;

ES

CR

IBIR

NO

MB

RE

public Compus (Context c){contextoEjecucion = c;

}public Compus abrirSqlite(){

creador = new BaseDatos (contextoEjecucion);mDatos = creador.getWritableDatabase();return this;

}public void elimina(int id){

creador = new BaseDatos (contextoEjecucion);mDatos = creador.getReadableDatabase();String sql = ("delete from compus where id="+id);mDatos.execSQL(sql);

}public void insertar(String marca, String ram, String procesador){

creador = new BaseDatos (contextoEjecucion);mDatos = creador.getReadableDatabase();String sql = ("insert into compus(marca,ram,procesador)

values('"+marca+"','"+ram+"','"+procesador+"')");mDatos.execSQL(sql);

}public void modificar(int id,String marca, String ram, String procesador){

creador = new BaseDatos (contextoEjecucion);mDatos = creador.getReadableDatabase();String sql = ("update compus set marca='"+marca+"', ram='"+ram+"',

procesador='"+procesador+"' where id="+id);mDatos.execSQL(sql);

}

public boolean consultar(int id){creador = new BaseDatos (contextoEjecucion);mDatos = creador.getReadableDatabase();String sql = ("Select * from compus where id="+id);Cursor cur = mDatos.rawQuery(sql, null);if(cur.getCount()==0){

return false;}else{

cur.moveToFirst();idn=cur.getInt(0);marca=cur.getString(1);ram=cur.getString(2);procesador=cur.getString(3);

return true;}

}public String getMarca(){

return marca;}public String getRam(){

return ram;}public String getProcesador(){

return procesador;}public int getId(){

return idn;}public String ver(){

String datos="";creador = new BaseDatos (contextoEjecucion);

ES

CR

IBIR

NO

MB

RE

mDatos = creador.getReadableDatabase();String sql = ("Select * from compus");Cursor cur = mDatos.rawQuery(sql, null);cur.moveToFirst();do{

datos+= cur.getString(0) + "\t " + cur.getString(1) + "\t " + cur.getString(2) + " \t" + cur.getString(3) + "\n";

}while (cur.moveToNext());return datos;

}public void cerrarSqlite(){

creador.close();

}}

package com.Sparda.modificar;

import android.content.Context;import android.database.sqlite.SQLiteDatabase;import android.database.sqlite.SQLiteDatabase.CursorFactory;import android.database.sqlite.SQLiteOpenHelper;

public class BaseDatos extends SQLiteOpenHelper {

public BaseDatos(Context context) {super(context, "compu.db", null, 1);

}

@Overridepublic void onCreate(SQLiteDatabase db) {

String sql="Create table compus(id integer primary key autoincrement, marca text, ram text, procesador text);";

db.execSQL(sql);

}

@Override public void onUpgrade(SQLiteDatabase arg0, int arg1, int arg2) {

}

}