- 浏览: 832442 次
- 性别:
- 来自: 北京、四川
文章分类
最新评论
-
sunbeamzheng:
总结的很好,好好看看。 拷贝问题确实很需要注意,特别是影不影响 ...
java深拷贝与浅拷贝 -
xmh8023:
...
获取POST数据的值 -
xmh8023:
我访问别的服务器怎么办?急求
获取POST数据的值 -
xmh8023:
String urlString="http://l ...
获取POST数据的值 -
lv12312:
Tomcat 7的老版本么?有bug的,https://iss ...
JMX问题
可以让其显示一会儿然后消失
也可以隔一段时间不断显示
第一种方式
第二种方式
也可以隔一段时间不断显示
第一种方式
/* * Copyright (C) 2007 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.example.android.apis.app; import com.example.android.apis.R; import android.app.Activity; import android.widget.Button; import android.os.Bundle; import android.view.View; import android.widget.Toast; /** * When you push the button on this Activity, it creates a {@link Toast} object and * using the Toast method. * @see Toast * @see Toast#makeText(android.content.Context,int,int) * @see Toast#makeText(android.content.Context,java.lang.CharSequence,int) * @see Toast#LENGTH_SHORT * @see Toast#LENGTH_LONG */ public class NotifyWithText extends Activity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.notify_with_text); Button button; // short notification button = (Button) findViewById(R.id.short_notify); button.setOnClickListener(new Button.OnClickListener() { public void onClick(View v) { // Note that we create the Toast object and call the show() method // on it all on one line. Most uses look like this, but there // are other methods on Toast that you can call to configure how // it appears. // // Note also that we use the version of makeText that takes a // resource id (R.string.short_notification_text). There is also // a version that takes a CharSequence if you must construct // the text yourself. Toast.makeText(NotifyWithText.this, R.string.short_notification_text, Toast.LENGTH_SHORT).show(); } }); // long notification // The only difference here is that the notification stays up longer. // You might want to use this if there is more text that they're going // to read. button = (Button) findViewById(R.id.long_notify); button.setOnClickListener(new Button.OnClickListener() { public void onClick(View v) { Toast.makeText(NotifyWithText.this, R.string.long_notification_text, Toast.LENGTH_LONG).show(); } }); } }
第二种方式
package com.example.android.apis.app; // Need the following import to get access to the app resources, since this // class is in a sub-package. import com.example.android.apis.R; import android.app.Activity; import android.app.AlarmManager; import android.app.PendingIntent; import android.content.Intent; import android.os.SystemClock; import android.os.Bundle; import android.view.View; import android.view.View.OnClickListener; import android.widget.Button; import android.widget.Toast; import java.util.Calendar; /** * Example of scheduling one-shot and repeating alarms. See * {@link OneShotAlarm} for the code run when the one-shot alarm goes off, and * {@link RepeatingAlarm} for the code run when the repeating alarm goes off. * <h4>Demo</h4> App/Service/Alarm Controller <h4>Source files</h4> <table class="LinkTable"> <tr> <td class="LinkColumn">src/com.example.android.apis/app/AlarmController.java</td> <td class="DescrColumn">The activity that lets you schedule alarms</td> </tr> <tr> <td class="LinkColumn">src/com.example.android.apis/app/OneShotAlarm.java</td> <td class="DescrColumn">This is an intent receiver that executes when the one-shot alarm goes off</td> </tr> <tr> <td class="LinkColumn">src/com.example.android.apis/app/RepeatingAlarm.java</td> <td class="DescrColumn">This is an intent receiver that executes when the repeating alarm goes off</td> </tr> <tr> <td class="LinkColumn">/res/any/layout/alarm_controller.xml</td> <td class="DescrColumn">Defines contents of the screen</td> </tr> </table> */ public class AlarmController extends Activity { Toast mToast; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.alarm_controller); // Watch for button clicks. Button button = (Button)findViewById(R.id.one_shot); button.setOnClickListener(mOneShotListener); button = (Button)findViewById(R.id.start_repeating); button.setOnClickListener(mStartRepeatingListener); button = (Button)findViewById(R.id.stop_repeating); button.setOnClickListener(mStopRepeatingListener); } private OnClickListener mOneShotListener = new OnClickListener() { public void onClick(View v) { // When the alarm goes off, we want to broadcast an Intent to our // BroadcastReceiver. Here we make an Intent with an explicit class // name to have our own receiver (which has been published in // AndroidManifest.xml) instantiated and called, and then create an // IntentSender to have the intent executed as a broadcast. Intent intent = new Intent(AlarmController.this, OneShotAlarm.class); PendingIntent sender = PendingIntent.getBroadcast(AlarmController.this, 0, intent, 0); // We want the alarm to go off 30 seconds from now. Calendar calendar = Calendar.getInstance(); calendar.setTimeInMillis(System.currentTimeMillis()); calendar.add(Calendar.SECOND, 30); // Schedule the alarm! AlarmManager am = (AlarmManager)getSystemService(ALARM_SERVICE); am.set(AlarmManager.RTC_WAKEUP, calendar.getTimeInMillis(), sender); // Tell the user about what we did. if (mToast != null) { mToast.cancel(); } mToast = Toast.makeText(AlarmController.this, R.string.one_shot_scheduled, Toast.LENGTH_LONG); mToast.show(); } }; private OnClickListener mStartRepeatingListener = new OnClickListener() { public void onClick(View v) { // When the alarm goes off, we want to broadcast an Intent to our // BroadcastReceiver. Here we make an Intent with an explicit class // name to have our own receiver (which has been published in // AndroidManifest.xml) instantiated and called, and then create an // IntentSender to have the intent executed as a broadcast. // Note that unlike above, this IntentSender is configured to // allow itself to be sent multiple times. Intent intent = new Intent(AlarmController.this, RepeatingAlarm.class); PendingIntent sender = PendingIntent.getBroadcast(AlarmController.this, 0, intent, 0); // We want the alarm to go off 30 seconds from now. long firstTime = SystemClock.elapsedRealtime(); firstTime += 15*1000; // Schedule the alarm! AlarmManager am = (AlarmManager)getSystemService(ALARM_SERVICE); am.setRepeating(AlarmManager.ELAPSED_REALTIME_WAKEUP, firstTime, 15*1000, sender); // Tell the user about what we did. if (mToast != null) { mToast.cancel(); } mToast = Toast.makeText(AlarmController.this, R.string.repeating_scheduled, Toast.LENGTH_LONG); mToast.show(); } }; private OnClickListener mStopRepeatingListener = new OnClickListener() { public void onClick(View v) { // Create the same intent, and thus a matching IntentSender, for // the one that was scheduled. Intent intent = new Intent(AlarmController.this, RepeatingAlarm.class); PendingIntent sender = PendingIntent.getBroadcast(AlarmController.this, 0, intent, 0); // And cancel the alarm. AlarmManager am = (AlarmManager)getSystemService(ALARM_SERVICE); am.cancel(sender); // Tell the user about what we did. if (mToast != null) { mToast.cancel(); } mToast = Toast.makeText(AlarmController.this, R.string.repeating_unscheduled, Toast.LENGTH_LONG); mToast.show(); } }; }
发表评论
-
AsyncTask
2011-04-10 12:15 1452here is a quick overview of how ... -
BroadcastReceive介绍
2011-04-09 10:03 1716转载:http://blog.csdn.net/Zengyan ... -
android 播放音频和视频
2011-03-31 15:47 1715摘自ApiDemo 1、播放音频 a.第一种方式 ... -
设置属性页面
2011-03-30 18:37 3489设置属性页面有两种方式 1、用xml完全的配置方式 2、完全使 ... -
android设置壁纸
2011-03-30 17:15 3426下面是Android的设置壁纸的一些代码(ApiDemo) ... -
文本中的值的保存与恢复
2011-03-30 16:29 1211这是android提供的ApiDemo里面的关于保存文本中值的 ... -
Intent-filter
2011-03-30 15:25 2041Intent-filter 个人理解就是为处理隐式Intent ... -
Some Standard Activity Actions
2011-03-30 14:25 1633摘自google android document Stand ... -
Intent学习
2011-03-30 14:03 1429参考:http://www.cnblogs.com/f ... -
android中的弹出框提示
2011-03-29 17:06 8485基本步骤如下: 1、继承Activity 2、在需要提示地方s ... -
android基本理解
2011-03-28 22:10 1058很久之前看过android的很多东西,由于工作忙以及其它一些事 ... -
android 中的url操作
2011-03-28 21:46 2821android 中的url操作步骤 1、获取HttpClien ...
相关推荐
codemirror版本:https://codemirror.net/5/doc/releases.html
外国电影演员识别系统源码分享
mf3010 打印扫描一体机驱动管理软件。
2024免费毕业设计成品,包括源码+数据库+往届论文资料 启动教程:https://www.bilibili.com/video/BV11ktveuE2d 讲解视频:https://www.bilibili.com/video/BV1YfkHYwEME 二次开发教程:https://www.bilibili.com/video/BV1Cw2rY1ErC
chrome-headless-shell-linux64-135.0.7004.0 (Canary).zip
DeepSeek大模型介绍与展望.pptx
英特尔的公版原理图和PCB,cadence版本
《单容水箱液位精准调控:模糊控制策略的深度研究与复现》,单容水箱液位随动系统的模糊控制研究 模糊控制lunwen复现 期刊:化工与自动化仪表(2021年) 图1为结构图,图9为原文结构图, 版本不一样,器件略有调整 图7为结果图,图8为原文结果图 ,单容水箱液位;模糊控制;研究;论文复现;期刊;化工与自动化仪表;结构图;结果图;版本差异;器件调整,"模糊控制研究在单容水箱液位随动系统中的应用与复现"
一个windows上使用的搜索小工具
内容: 这份数据集包含了来自国际大洋发现计划(IODP)第342航次站点U1405、U1406、U1407、U1409和U1410的浮游有孔虫碳酸盐团簇同位素、稳定氧和碳同位素,以及沉积物中的GDGT(甘油二烷基甘油四醚)和烯酮数据。这些站点位于北大西洋的新foundland脊(U1407、U1409和U1410)和J-异常脊(U1405和U1406),用于创建覆盖整个新生代的几乎连续但低分辨率(约每92万年一个样本)的数据拼接,并重建了碳酸盐团簇同位素、TEX86和UK'37海表温度。每个样本包含20立方厘米的沉积物,覆盖2厘米的核心深度区间。年龄模型主要基于详细的船上生物-磁性地层学研究(Norris等,2014)。然而,在40.8 Ma至44.8 Ma时间段内,使用了Cappelli等人(2019)更新的U1410站点年龄模型,通过与U1408站点的年龄模型对比来确定。 访问此数据集,请点击这里:"" ()。
厨房用品分割系统源码&数据集分享
.
监控鞋类物品检测系统源码分享
2024免费毕业设计成品,包括源码+数据库+往届论文资料 启动教程:https://www.bilibili.com/video/BV11ktveuE2d 讲解视频:https://www.bilibili.com/video/BV1YfkHYwEME 二次开发教程:https://www.bilibili.com/video/BV1Cw2rY1ErC
曲线图异常波形检测系统源码分享
内容概要:本文介绍了动车组车号自动识别的现状及其存在的问题,提出了基于图像识别技术的新方法。文中详述了传统人工识别与RFID识别方法的不足,重点阐述了一种新的图像识别系统的设计与实施方案,该系统能够实现在多种恶劣环境下高效精确地获取动车组车号,并通过实际案例展示了这套系统的优势以及其在铁路行业的广阔应用前景。 适用人群:从事铁路运输管理、轨道交通系统开发维护的技术人员,尤其是负责动车组调度、监控及维修工作的相关人员。 使用场景及目标:①用于替代现有人工记录与RFID标签方式,提升动车组车号识别精度与效率;②适用于各种天气状况下的户外作业场景;③旨在构建更加智能化、信息化程度更高的铁路运输体系,助力智慧动车段建设。 其他说明:文中还包括具体的实验对比和技术细节分析,如不同的开机触发装置选择、图像采集设备参数设置、补光措施及识别算法的设计,强调了实际应用场景中可能遇到的问题以及相应的解决方案。
基于AnythingLLM框架和Ollama环境本地运行deepseek,并可以通过用户自己的文档来针对性地回答用户问题,用户也可以上传文件来构建模型回复问题所需要的所有参考资料的知识库,使得模型相对于在线模型更加专业地解答用户的问题。同时本地部署保证了隐私性和针对性。
指针式表盘指针关键部位分割系统源码&数据集分享
多策略增强:MWOA鲸鱼优化算法与其他变体及2024年最新算法的实证比较与结果分析——新颖策略实施效果显著且复杂度无增加的研究,多策略改进的鲸鱼优化算法(MWOA),与其他三种变体和几种2024最新算法比较,策略都是很新颖的策略,可以直接写了发文章,并且没有增加复杂度上改进效果 ,MWOA; 变体算法; 最新算法; 策略新颖; 复杂度未增加; 改进效果显著,"多策略改进MWOA算法:与多种变体及2024新算法比较展示优越性"
织物缺陷检测系统源码分享[一条龙教学YOLOV8标注好的数据集一键训练_70+全套改进创新点发刊_Web前端展示]