Android Studio通知

本文详细解析Android Studio的通知系统,包括何时以及如何显示通知,如何处理用户交互,以及优化用户体验的策略。通过学习,开发者将能更好地管理和利用这些通知来提升开发效率。
摘要由CSDN通过智能技术生成
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    tools:context=".MainActivity">

<Button
    android:id="@+id/bt"
    android:text="发送信息"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"></Button>
    <Button
        android:id="@+id/bt2"
        android:text="分组"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"></Button>
    <Button
        android:id="@+id/bt3"
        android:text="很多"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"></Button>
    <Button
        android:id="@+id/bt4"
        android:text="交互信息"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"></Button>

    <Button
        android:id="@+id/bt5"
        android:text="更新信息"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"></Button>

</LinearLayout>
package com.example.day3;

import androidx.appcompat.app.AppCompatActivity;

import android.app.Notification;
import android.app.NotificationManager;
import android.app.PendingIntent;
import android.content.Intent;
import android.graphics.BitmapFactory;
import android.os.Bundle;
import android.view.KeyEvent;
import android.view.View;
import android.widget.Button;
import android.widget.PopupWindow;
import android.widget.Toast;

public class MainActivity extends AppCompatActivity {
   
    private Button bt1,bt2,bt3,bt4,bt5;
 private long time=0;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
   
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        bt1=findViewById(R.id.bt);
        bt2=findViewById(R.id.bt2);
        bt3=findViewById(R.id.bt3);
        bt4=findViewById(R.id.bt4);
        bt5=findViewById(R.id.bt5);
        bt1<
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值