Posts

Android Get IP Address Android application for fetching network IP address of the android device Create new android project and add below code changes on MainActivity.java  Source SVN: Android IP Address  Zipped Source : IPAddressDisplay.zip package com . javaorigin . ipdisplay ; import java . net . InetAddress ; import java . net . NetworkInterface ; import java . util . Enumeration ; import android . app . Activity ; import android . os . Bundle ; import android . util . Log ; import android . widget . TextView ; public class MainActivity extends Activity { @Override protected void onCreate ( Bundle savedInstanceState ) { super . onCreate ( savedInstanceState ); setContentView ( R . layout . activity_main ); try { for ( Enumeration en = NetworkInterface . getNetworkInterfaces (); en . hasMoreElements ();) { NetworkInterface intf = en . nextElement (); for ( Enumeration enumIpAddr = intf . ge
Android Notification LED sample Note : You should lock(screen) the phone before run this project(via android IDE) , because notification LED will be highlighted only when screen is off Source SVN: LEDNotification   Zipped Source : LEDNotification   public class LEDNotification extends Activity { @Override protected void onCreate ( Bundle savedInstanceState ) { super . onCreate ( savedInstanceState ); setContentView ( R . layout . activity_main ); NotificationManager notif = ( NotificationManager ) getSystemService ( Context . NOTIFICATION_SERVICE ); for ( int i = 0 ; i < 8 ; i ++) { notif . cancel ( 1 ); // clear previous notification final Notification notification = new Notification (); if ( i == 0 ){ notification . ledARGB = Color . MAGENTA ; } else if ( i == 1 ){ notification . ledARGB = Color . BLUE ; } else if ( i == 2 ){ notification . ledARGB = Color . CYAN ; } else if (
Blocking Incoming call - Android Step 1: Create Broadcast receiver class for incoming call package com . javaorigin . android . sample ; import java . lang . reflect . Method ; import com . android . internal . telephony . ITelephony ; import android . content . BroadcastReceiver ; import android . content . Context ; import android . content . Intent import android . telephony . TelephonyManager ; import android . util . Log ; public class PhoneCallReceiver extends BroadcastReceiver { Context context = null ; private static final String TAG = "Phone call" ; private ITelephony telephonyService ; @Override public void onReceive ( Context context , Intent intent ) { Log . v ( TAG , "Receving...." ); TelephonyManager telephony = ( TelephonyManager ) context . getSystemService ( Context . TELEPHONY_SERVICE ); try { Class c = Class . forName ( telephony . getClass (). getName ()); Metho
Image
Section Header Listview in android Today we are learning about the section header in android. L istview  are commonly used to display a large set of similar data. But in the section header list we can show the similar data list in the different and separate section of the list view. Here I am using the adapter class for loading the view of list one by one by using get view method. So lets start the coding about the section header. layout/main.xml ? 1 2 3 4 5 6 7 <linearlayout android:layout_height= "fill_parent" android:layout_width= "fill_parent" android:orientation= "vertical" xmlns:android= " http://schemas.android.com/apk/res/android " > <textview android:layout_height= "wrap_content" android:layout_width= "fill_parent" android:text= "@string/hello" >   <listview android:id= "@+id/listView_main" android:layout_height= "wrap_content" andr