Tag Archives: getResources

Create Custom Notification in Android.

By | January 31, 2016

This demo explains how you can create a Custom Notification in Android old and New versions. The notification appears expanded in Versions > 16. Let’s jump into the code… Below is the MainActivity that creates the notification. [java] package com.example.android.customnotifications; import android.app.Activity; import android.app.Notification; import android.app.NotificationManager; import android.app.PendingIntent; import android.content.Intent; import android.os.Build; import android.os.Bundle; import android.support.v4.app.NotificationCompat; import android.view.View;… Read More »

Switch Images in ANDROID.

By | April 7, 2012

Hi all …….. Ofter we have trouble with loading continous images in ANDROID from our application directory. The reason is that all resources have a unique resource ID which we need to get to load these resources. The following example shows how to get these unique identifier from the “path” of the resource. For example Here I have… Read More »

Image transition animation in Android

By | December 29, 2011

Hello all… I have shown a lot of examples of animations in android. Today I will show you how to show an image transition animation between two images. For that you have to create an xml named “expand_collapse.xml” inside the res/drawable folder. The contents of “expand_collapse.xml” are [xml] <transition xmlns:android="http://schemas.android.com/apk/res/android"> <item android:drawable="@drawable/android_1" /> <item android:drawable="@drawable/android_2" /> </transition> [/xml]… Read More »

How to drag and drop in ANDROID?

By | September 18, 2010

The following code helps you to do a drag and drop in ANDROID. [java] package com.pack; import android.app.Activity; import android.content.Context; import android.graphics.Canvas; import android.os.Bundle; import android.view.MotionEvent; import android.widget.AbsoluteLayout; import android.widget.Button; import android.widget.ImageView; public class Touch extends Activity { /** Called when the activity is first created. */ @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); MyView tx = new… Read More »