Tag Archives: onClick

DataBinding in Android using Observable Collections

By | January 30, 2017

As I shown in the previous post where we used BaseObservable and ObservableField to update UI when binding object is changed, this post will show you another simple way to achieve this. Do Check my previous posts for better understanding of DataBinding and methods used in DataBinding. http://www.coderzheaven.com/2017/01/15/simple-databinding-in-android-example/ http://www.coderzheaven.com/2017/01/20/data-binding-in-android-using-observables/ http://www.coderzheaven.com/2017/01/25/data-binding-in-android-using-observablefield-to-update-ui-automatically/ Here is another way to do it. In… Read More »

CRUD Operations in SQLite using SQLiteOpenHelper – Android

By | June 26, 2016

We do SQLite operations in Android by extending the SQLiteOpenHelper Class. I will create an Employee table with three fields id name company. I have a model class same as the database table Employee. Employee.java [java] public class Employee { public int id; public String name, company; public void setAll(int id, String name, String company) { this.id =… Read More »

How to stream an audio in Android?

By | August 14, 2012

This is a simple example to how to stream an audio in android. Here is the java code for that. [java] package com.coderzheaven.pack; import android.app.Activity; import android.app.ProgressDialog; import android.media.AudioManager; import android.media.MediaPlayer; import android.media.MediaPlayer.OnCompletionListener; import android.media.MediaPlayer.OnErrorListener; import android.media.MediaPlayer.OnPreparedListener; import android.os.Bundle; import android.util.Log; import android.view.View; import android.view.View.OnClickListener; import android.widget.Button; import android.widget.Toast; public class StreamAudioDemo extends Activity implements OnClickListener, OnPreparedListener, OnErrorListener,… Read More »

Changing the style or theme of default alertDialog in Android.

By | February 3, 2012

Hello everyone, Here is a simple example showing how to change the theme of default AlertDialog in android. Check this post before for understanding how to use styles. http://www.coderzheaven.com/2012/04/17/inherit-styles-extend-styles-android/ To start first create a fresh project named AlertTest. In the AlertTestDemo.java file copy this code [java] package com.coderzheaven.pack; import android.app.Activity; import android.app.AlertDialog; import android.content.DialogInterface; import android.content.DialogInterface.OnClickListener; import android.os.Bundle;… Read More »