久久久久久久av_日韩在线中文_看一级毛片视频_日本精品二区_成人深夜福利视频_武道仙尊动漫在线观看

Android:將文本從 textView 添加到狀態欄

Android: Adding text from textView to status bar(Android:將文本從 textView 添加到狀態欄)
本文介紹了Android:將文本從 textView 添加到狀態欄的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

問題描述

是否可以將從 textView 獲取的字符串添加到狀態欄.我想不斷地顯示文本,從應用程序的主要活動中動態更新為 textView.

Is it possible to add the String taken from textView to Status Bar. I want to show text constantly , dynamically updated as textView from apps main activity.

TextView message = (TextView) findViewById(R.id.textView1);
message.setText("This I want to add to status bar");

推薦答案

可以的

private static void generateNotification(Context context, String message) {
        int icon = R.drawable.ic_status;
        long when = System.currentTimeMillis();
        NotificationManager notificationManager = (NotificationManager) context
                .getSystemService(Context.NOTIFICATION_SERVICE);
        Notification notification = new Notification(icon, message, when);
        String title = context.getString(R.string.app_name); // Here you can pass the value of your TextView
        Intent notificationIntent = new Intent(context, SplashScreen.class);
        notificationIntent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP
                | Intent.FLAG_ACTIVITY_SINGLE_TOP);
        PendingIntent intent = PendingIntent.getActivity(context, 0,
                notificationIntent, 0);
        notification.setLatestEventInfo(context, title, message, intent);
        notification.flags |= Notification.FLAG_AUTO_CANCEL;
        notificationManager.notify(0, notification);
    }

這篇關于Android:將文本從 textView 添加到狀態欄的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!

【網站聲明】本站部分內容來源于互聯網,旨在幫助大家更快的解決問題,如果有圖片或者內容侵犯了您的權益,請聯系我們刪除處理,感謝您的支持!

相關文檔推薦

How to wrap text around components in a JTextPane?(如何在 JTextPane 中的組件周圍環繞文本?)
MyBatis, how to get the auto generated key of an insert? [MySql](MyBatis,如何獲取插入的自動生成密鑰?[MySql])
Inserting to Oracle Nested Table in Java(在 Java 中插入 Oracle 嵌套表)
Java: How to insert CLOB into oracle database(Java:如何將 CLOB 插入 oracle 數據庫)
Why does Spring-data-jdbc not save my Car object?(為什么 Spring-data-jdbc 不保存我的 Car 對象?)
Use threading to process file chunk by chunk(使用線程逐塊處理文件)
主站蜘蛛池模板: 国产精品一区在线 | 欧美久久不卡 | 久久这里只有 | 91资源在线观看 | 精品视频成人 | 久草在线免费资源 | 黄色成人av | 亚洲天堂男人的天堂 | 久久国产精品-国产精品 | 日本手机看片 | 久久中文视频 | 国产不卡一区 | 综合久久99 | 青青草视频网 | 国产一级片91 | 亚洲网站在线观看 | 国产在线中文字幕 | 亚洲高清成人在线 | 免费观看成人鲁鲁鲁鲁鲁视频 | 欧美日韩综合视频 | 精品视频在线免费观看 | 亚洲午夜视频在线观看 | 精品国产乱码久久久久久闺蜜 | 二区在线视频 | 欧美一级www片免费观看 | 久久综合伊人 | 国产精品亚洲一区二区三区在线观看 | 国产精品久久久久久久久久妇女 | 国产精品国产成人国产三级 | 亚洲免费在线视频 | 亚洲精品白浆高清久久久久久 | 欧美视频一区二区三区 | 亚洲精品一区二区网址 | 色视频一区二区 | 久久国产精品无码网站 | 久久中文视频 | 久久黄色网 | 女人夜夜春| 激情在线视频网站 | 中文字幕91 | 一区二区三区国产好 |