viernes, 27 de abril de 2012

Construye una pantalla de login en android

Hola buenos dias,

Hoy les voy a dejar un enlace interesante que te detalla como puedes montarte una app que se logue contra un servidor con una base de datos:

http://wowjava.wordpress.com/2011/01/16/login-application-for-android/






Vale mucho la pena este enlace.


Un saludo

jueves, 26 de abril de 2012

Nueva app original en android

Hola buenas tardes,

Hoy nos ha llegado la información de una nueva app que hace poco ha echado a andar en android y se llama briefmate :



Esta app sirve para poder conseguir inspiración cuando necesitas conseguir nueva ideas en momentos de bloqueo mental, también permite hacer rimas facilmente con su generador de rimas. Mas info aqui




jueves, 22 de marzo de 2012

Como construir una alarma con android facilmente

Hola amigos,

Hoy les voy a poner un ejemplo de una activity que establece una alarma en android para que podais crearos vuestras propias alarmas facilmente:

public class AlarmController extends Activity {
Toast mToast;

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);

setContentView(R.layout.alarm_controller);

// Watch for button clicks.
Button button = (Button)findViewById(R.id.one_shot);
button.setOnClickListener(mOneShotListener);
button = (Button)findViewById(R.id.start_repeating);
button.setOnClickListener(mStartRepeatingListener);
button = (Button)findViewById(R.id.stop_repeating);
button.setOnClickListener(mStopRepeatingListener);
}

private OnClickListener mOneShotListener = new OnClickListener() {
public void onClick(View v) {
// When the alarm goes off, we want to broadcast an Intent to our
// BroadcastReceiver. Here we make an Intent with an explicit class
// name to have our own receiver (which has been published in
// AndroidManifest.xml) instantiated and called, and then create an
// IntentSender to have the intent executed as a broadcast.
Intent intent = new Intent(AlarmController.this, OneShotAlarm.class);
PendingIntent sender = PendingIntent.getBroadcast(AlarmController.this,
0, intent, 0);

// We want the alarm to go off 30 seconds from now.
Calendar calendar = Calendar.getInstance();
calendar.setTimeInMillis(System.currentTimeMillis());
calendar.add(Calendar.SECOND, 30);

// Schedule the alarm!
AlarmManager am = (AlarmManager)getSystemService(ALARM_SERVICE);
am.set(AlarmManager.RTC_WAKEUP, calendar.getTimeInMillis(), sender);

// Tell the user about what we did.
if (mToast != null) {
mToast.cancel();
}
mToast = Toast.makeText(AlarmController.this, R.string.one_shot_scheduled,
Toast.LENGTH_LONG);
mToast.show();
}
};

private OnClickListener mStartRepeatingListener = new OnClickListener() {
public void onClick(View v) {
// When the alarm goes off, we want to broadcast an Intent to our
// BroadcastReceiver. Here we make an Intent with an explicit class
// name to have our own receiver (which has been published in
// AndroidManifest.xml) instantiated and called, and then create an
// IntentSender to have the intent executed as a broadcast.
// Note that unlike above, this IntentSender is configured to
// allow itself to be sent multiple times.
Intent intent = new Intent(AlarmController.this, RepeatingAlarm.class);
PendingIntent sender = PendingIntent.getBroadcast(AlarmController.this,
0, intent, 0);

// We want the alarm to go off 30 seconds from now.
long firstTime = SystemClock.elapsedRealtime();
firstTime += 15*1000;

// Schedule the alarm!
AlarmManager am = (AlarmManager)getSystemService(ALARM_SERVICE);
am.setRepeating(AlarmManager.ELAPSED_REALTIME_WAKEUP,
firstTime, 15*1000, sender);

// Tell the user about what we did.
if (mToast != null) {
mToast.cancel();
}
mToast = Toast.makeText(AlarmController.this, R.string.repeating_scheduled,
Toast.LENGTH_LONG);
mToast.show();
}
};

private OnClickListener mStopRepeatingListener = new OnClickListener() {
public void onClick(View v) {
// Create the same intent, and thus a matching IntentSender, for
// the one that was scheduled.
Intent intent = new Intent(AlarmController.this, RepeatingAlarm.class);
PendingIntent sender = PendingIntent.getBroadcast(AlarmController.this,
0, intent, 0);

// And cancel the alarm.
AlarmManager am = (AlarmManager)getSystemService(ALARM_SERVICE);
am.cancel(sender);

// Tell the user about what we did.
if (mToast != null) {
mToast.cancel();
}
mToast = Toast.makeText(AlarmController.this, R.string.repeating_unscheduled,
Toast.LENGTH_LONG);
mToast.show();
}
};
}


Saludos




martes, 20 de marzo de 2012

Que es google Play?

Muchos de vosotros esta semana os habréis preguntado que es exactamente esto de google play, pues en este video google trata de explicar claramente que es:





Para más información http://android-developers.blogspot.com.es/2012/03/introducing-google-play.html

Un buen libro de android

Hola buenas tardes,

Siento mi poca actividad en este blog, he estado unos cuantos meses muyyy ocupado. Pero voy a ir rellenando este blog con entradas interesantes.

Hoy retomamos este blog con este fantastico libro que os recomiendo encarecidamente leer.



Muyy buen libro y sobretodo reciente, pronto pondre el beginner cuatro y os mostrare truquitos en el desarrollo de android.

Buenas tarde y un saludo

domingo, 13 de noviembre de 2011

Como leer y escribir epub files

Hola muyy buenos dias a todos,

Hoy he encontrado un enlace super interesante, acerca de como podemos manipular desde android un fichero epub (formato que se utiliza en los libros electronicos). Con este ejemplo podemos hacer que nuestra aplicaciones puedan mostrar epubs o escribirlos.
 Aqui esta http://www.siegmann.nl/epublib/android

sábado, 29 de octubre de 2011

Android WebDriver , o como testear tus aplicaciones web para android

Hola buenas tardes o casi noches,


Hoy me gustaria hablarles de un herramienta para el testeo de webApp hechas para android utilizando html 5 javascript, CSS 3 . etc Este framework de testteo se llama WebDriver y es de Selenium HQ,  empresa que también tiene otros framework de testeo para aplicaciones J2EE.

Webdriver da un soporte multiplataforma como se puede ver en el siguiente link http://seleniumhq.org/docs/03_webdriver.html

Aqui les muestro lo facil que resulta realizar un test de un webApp hecha para android:



public class SimpleGoogleTest extends ActivityInstrumentationTestCase2
 <SimpleAppActivity> {

    public void testGoogleShouldWork() {
      // Create a WebDriver instance with the activity in 
      //which we want the test to run
      WebDriver driver = new AndroidDriver(getActivity());
      // Let’s open a web page
      driver.get("http://www.google.com");

      // Lookup for the search box by its name
      WebElement searchBox = driver.findElement(By.name("q"));

      // Enter a search query and submit
      searchBox.sendKeys("weather in san francisco");
      searchBox.submit();

      // Making sure that Google shows 11 results
      WebElement resultSection = driver.findElement(By.id("ires"));
      List<WebElement> searchResults = 
       resultSection.findElements(By.tagName("li"));
      assertEquals(11, searchResults.size());

      // Let’s ensure that the first result shown is the weather widget
      WebElement weatherWidget = searchResults.get(0);
      assertTrue(weatherWidget.getText()
      .contains("Weather for San Francisco, CA"));
    }
}
 
WebElement toFlick = driver.findElement(By.id("image"));
// 400 pixels left at normal speed
Action flick = getBuilder(driver)
.flick(toFlick, 0, -400, FlickAction.SPEED_NORMAL)
        .build();
flick.perform();
WebElement secondImage = driver.findElement(“secondImage”);
assertTrue(secondImage.isDisplayed()); 

Como se muestra en el codigo de arriba, solamente hay que crearse un proyecto de test de android, añadirle las librerias correspondientes y empezar a crearse tests cases . Tambien recomiendo ver el siguiente post del blog de google donde se explica http://android-developers.blogspot.com/2011/10/introducing-android-webdriver.html?utm_source=feedburner&utm_medium=feed&utm_campaign=Feed%3A+blogspot%2FhsDu+%28Android+Developers+Blog%29