Android Program – Notification Activity

ANDROID FOR FRESHERS

Android Program of Notification Activity

 

Java Code(NotificationAct)

import android.app.Activity;
import android.app.Notification;
import android.app.NotificationManager;
import android.content.Intent;
import android.support.v4.app.NotificationCompat;
import android.os.Bundle;
import android.view.View;

public class NotificationAct extends Activity
{
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_not);
}
public void next(View v)
{
Notification no=new NotificationCompat.Builder(this)
.setSmallIcon(android.R.drawable.toast_frame)
.setContentTitle(“Message”)
.setContentText(“This is Developed by Sasi”)
.build();
NotificationManager nm=(NotificationManager)getSystemService(NOTIFICATION_SERVICE);
nm.notify(1,no);
}
}

Layout XML Code(NotificationAct)

<?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:orientation=”vertical”
android:paddingBottom=”@dimen/activity_vertical_margin”
android:paddingLeft=”@dimen/activity_horizontal_margin”
android:paddingRight=”@dimen/activity_horizontal_margin”
android:paddingTop=”@dimen/activity_vertical_margin”
tools:context=”com.andro.tech.androidproject.NotificationAct”>

<TextView
android:layout_width=”wrap_content”
android:layout_height=”wrap_content”
android:textSize=”@dimen/textsize”
android:layout_gravity=”center”
android:textStyle=”bold”
android:text=”Notification”
android:layout_marginBottom=”120dp” />

<Button
android:layout_width=”match_parent”
android:layout_height=”wrap_content”
android:text=”CLICK FOR NOTIFICATION”
android:onClick=”next”
android:layout_marginBottom=”150dp”/>

<Button
android:layout_width=”match_parent”
android:layout_height=”wrap_content”
android:text=”@string/sourcecode”
android:background=”@color/bgcolor”
android:textStyle=”bold”
android:textColor=”@color/text”
android:onClick=”view1″/>

</LinearLayout>

Output:

Android notification action bar source code download   Android notification action bar source code download

Android notification action bar source code download

Download Notification Activity Source Code

For More Android Programs –Click Here

 

Follow Us – Never Miss Update

Fb/PageTwitterGoogle+InstagramPinterest 

 

Related Search

Android notification bar java code download, android notification activity bar code download, android notification bar snippet, notification bar activity code download, android notification bar notify snippet code, android notification notify action bar code, android notification action bar source code download, android notify action bar code download

Comments

10 Best Building Games on PC in 2024 Review: Why Buy Lava Blaze Curve 5G? Sale is Live! Review: Why Buy boAt Stone Spinx Pro? New Portable Speaker Xiaomi 14 Series Debuts in India, starting at ₹59,999 Best Wireless TWS Earbuds: Up to 75% Off Deals