展会信息港展会大全

android开发进程 状态栏提示 Notification
来源:互联网   发布日期:2015-10-02 21:42:53   浏览:1995次  

导读:package com.jerry;import android.app.Notification;import android.app.NotificationManager;import android.app.PendingIntent;import android.content.Intent;import android.os.Bundle;import andro......

package com.jerry;

import android.app.Notification;

import android.app.NotificationManager;

import android.app.PendingIntent;

import android.content.Intent;

import android.os.Bundle;

import android.view.View;

import android.widget.Button;

/**

* 状态栏提示

* @author gx_jin

*

*/

public class Jerry_Notification extends JerryActivity

{

Button m_Button;

NotificationManager m_NotificationManager;

Intent m_Intent;

PendingIntent m_PendingIntent;

Notification m_Notification;

NotificationManager m_NotificationManage;

public void onCreate(Bundle bundle)

{

super.onCreate(bundle);

setContentView(R.layout.main);

m_NotificationManager = (NotificationManager) getSystemService(NOTIFICATION_SERVICE);

Intent m_Intent = new Intent(Jerry_Notification.this, Jerry_Toast.class);

m_PendingIntent = PendingIntent.getActivity(Jerry_Notification.this, 0, m_Intent, PendingIntent.FLAG_ONE_SHOT);

m_Notification = new Notification();

Button button01 = (Button) findViewById(R.id.Button01);// 命令按钮不对

button01.setOnClickListener(new Button.OnClickListener()

{

public void onClick(View v)

{

m_Notification.icon = R.drawable.ic_launcher;

m_Notification.tickerText = "Button1通知的内容。。。";

m_Notification.defaults = Notification.DEFAULT_SOUND;

m_Notification.setLatestEventInfo(Jerry_Notification.this, "Button1", "Button1通知", m_PendingIntent);

m_NotificationManager.notify(0, m_Notification);

}

});

}

@Override

public String getName()

{

// TODO Auto-generated method stub

return null;

}

}

赞助本站

人工智能实验室

相关热词: 状态栏提示 Notification

AiLab云推荐
展开

热门栏目HotCates

Copyright © 2010-2024 AiLab Team. 人工智能实验室 版权所有    关于我们 | 联系我们 | 广告服务 | 公司动态 | 免责声明 | 隐私条款 | 工作机会 | 展会港