请教大家,在service中调用activity中handler对象?

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了请教大家,在service中调用activity中handler对象?相关的知识,希望对你有一定的参考价值。

现在想在service中调用某个activity中的handler对象,请教大家如何更高效、节能的调用?谢谢大家注:handler不能设为静态的

教你个最简单的办法,只需要在service中做一个activity的集合 再做一个addActivity的方法和findActivity的方法 将你需要调用handler的activity通过addActivity方法放到service的activity集合中 需要用的时候用findActivity从activity把那个对象取出来即可 参考技术A 最好的办法 在service中弄一个activiity的集合 然后写一个往集合中添加activity的方法 在一个activity的onCreate()方法中调用这个方法 把activity放到这个集合中 再在service中写一个查找activity的方法 查找到该activity 然后调用它的方法即可 参考技术B handler是针对线程的概念,与activity不是一类东西,activity都是在主线程中的,即UI线程,有方法直接获取的。。。 参考技术C 每次activity的启动时,都通过aidl接口通知service这个activity启动起来了,handler应该换一换了,并且把handler传过去。

向大家请教几个CS问题!!

1.什么是CS脚本?有什么用?怎么使用?讲解具体点!
2.在CS里什么叫FPS,好像有很多含义,请大家解释一下!
我年龄比较小,还请大家解释的时候尽量详细点!谢谢!!
我QQ:315291663

脚本(script)是使用一种特定的描述性语言,依据一定的格式编写的可执行文件,又称作宏或批处理文件。脚本通常可以由应用程序临时调用并执行。各类脚本目前被广泛地应用于网页设计中,因为脚本不仅可以减小网页的规模和提高网页浏览速度,而且可以丰富网页的表现,如动画、声音等。举个最常见的例子,当我们点击网页上的E-mail地址时能自动调用Outlook Express或Foxmail这类邮件软件,就是通过脚本功能来实现的。又如某些网页的英文新闻内容旁会有一个三角符号,点击它就可以听到英文诵读,这也是脚本在起作用。也正因为脚本的这些特点,往往被一些别有用心的人所利用。例如在脚本中加入一些破坏计算机系统的命令,这样当用户浏览网页时,一旦调用这类脚本,便会使用户的系统受到攻击。所以用户应根据对所访问网页的信任程度选择安全等级,特别是对于那些本身内容就非法的网页,更不要轻易允许使用脚本。通过“安全设置”对话框,选择“脚本”选项下的各种设置就可以轻松实现对脚本的禁用和启用。

脚本(Script)实际上就是程序,一般都是有应用程序提供的编程语言。应用程序包括浏览器(javascript、VBScript)、多媒体创作工具,应用程序的宏和创作系统的批处理语言也可以归入脚本之类。脚本同我们平时使用的VB、C语言的区别主要是:脚本语法比较简单,比较容易掌握;脚本与应用程序密切相关,所以包括相对应用程序自身的功能;脚本一般不具备通用性,所能处理的问题范围有限。脚本就是源程序,就是代码程序。

脚本(Script)是批处理文件的延伸,是一种纯文本保存的程序,一般来说的计算机脚本程序是确定的一系列控制计算机进行运算操作动作的组合,在其中可以实现一定的逻辑分支等。脚本程序相对一般程序开发来说比较接近自然语言,可以不经编译而是解释执行,利于快速开发或一些轻量的控制。
现在的脚本语言是比较多的,一般的脚本语言的执行只同具体的解释执行器有关,所以只要系统上有相应语言的解释程序就可以做到跨平台。
脚本(Script),就是含有bind和alias等命令的集合,你可以把这个集合存为一个独立的文件然后在需要的时候执行,这样就可以方便你在CS中的使用。
脚本可以存为后缀名为.cfg的文件放在cstrike文件夹下,执行时在控制台输入:exec (脚本文件名).cfg 即可。比如将一个脚本存为buys.cfg文件,则在控制台中输入:exec buys.cfg则可以实现我们所需要的功能。要实现一个命令只要把这一过程定义(alias)好,并且分配一个键位给这个命令,以后只要按分配好的键位,就可以实现这一过程。所有的脚本都是通过这一方法实现的。

FPS first person shoting 第一人称射击类游戏。

参考资料:http://zhidao.baidu.com/question/36524342.html?si=1

参考技术A 1.
CS脚本 说简单点...就是CSTRICK目录下面得CONFIG USERCONFIG着两个文件 也就是你自己得设置还有参数 怎么使用..用记事本打开
具体点.... 点右键 打开方式 用记事本
里面都是参数啊...参数很多啊 怎么跟你说呢...好像有点多..我把我得复制给你吧.
CONFIG:

bind "TAB" "+showscores"
bind "ENTER" "exec csmate.cfg"
bind "ESCAPE" "cancelselect"
bind "SPACE" "+jump"
bind "'" "+moveup"
bind "+" "sizeup"
bind "," "buyammo1"
bind "-" "shopmenu"
bind "." "buyammo2"
bind "/" "+movedown"
bind "0" "slot10"
bind "1" "slot1"
bind "2" "slot2"
bind "3" "slot3"
bind "4" "slot4"
bind "5" "slot5"
bind "6" "slot6"
bind "7" "slot7"
bind "8" "slot8"
bind "9" "slot9"
bind ";" "+mlook"
bind "=" "shopmenu2"
bind "[" "invprev"
bind "\" "bot_kill"
bind "]" "invnext"
bind "`" "toggleconsole"
bind "a" "+moveleft"
bind "b" "buy"
bind "c" "radio3"
bind "d" "+moveright"
bind "e" "+use"
bind "f" "impulse 100"
bind "g" "drop"
bind "h" "+commandmenu"
bind "i" "skillsinfo"
bind "j" "say menu"
bind "k" "+voicerecord"
bind "l" "showbriefing"
bind "m" "chooseteam"
bind "n" "changerace"
bind "o" "buyequip"
bind "p" "ability"
bind "q" "lastinv"
bind "r" "+reload"
bind "s" "+back"
bind "t" "impulse 201"
bind "u" "messagemode2"
bind "v" "weapon_flashbang"
bind "w" "+forward"
bind "x" "radio2"
bind "y" "messagemode"
bind "z" "radio1"
bind "~" "toggleconsole"
bind "UPARROW" "+forward"
bind "DOWNARROW" "+back"
bind "LEFTARROW" "+left"
bind "RIGHTARROW" "+right"
bind "ALT" "ultimate"
bind "CTRL" "+duck"
bind "SHIFT" "+speed"
bind "F1" "ak47;m4a1;primammo;"
bind "F2" "vesthelm"
bind "F3" "flash"
bind "F4" "hegren"
bind "F5" "sgren"
bind "F6" "awp;buyammo1;"
bind "F7" "timeleft"
bind "F10" "lc_fun"
bind "F11" "lc_me"
bind "F12" "quit"
bind "INS" "+klook"
bind "DEL" "cl_righthand 0"
bind "PGDN" "+lookdown"
bind "PGUP" "+lookup"
bind "END" "centerview"
bind "KP_PGUP" "deagle;secammo;"
bind "KP_INS" "buyammo1"
bind "KP_DEL" "buyammo2"
bind "KP_SLASH" "bot_kick"
bind "KP_PLUS" "flash;"
bind "CAPSLOCK" "weapon_smokegrenade"
bind "MWHEELDOWN" "+jump"
bind "MWHEELUP" "+duck"
bind "MOUSE1" "+attack"
bind "MOUSE2" "+attack2"
bind "MOUSE4" "+voicerecord"
bind "MOUSE5" "defuser"
bind "PAUSE" "pause"
_cl_autowepswitch "0"
_snd_mixahead "0.1"
ati_npatch "1.0"
ati_subdiv "2.0"
bgmvolume "1.000000"
bottomcolor "6"
brightness "1"
cl_allowdownload "1"
cl_allowupload "1"
cl_backspeed "999"
cl_cmdbackup "40"
cl_cmdrate "101"
cl_corpsestay "180.000000"
cl_crosshair_color "50 250 50"
cl_crosshair_size "small"
cl_crosshair_translucent "1"
cl_dlmax "80"
cl_download_ingame "1"
cl_dynamiccrosshair "1"
cl_forwardspeed "400"
cl_himodels "0"
cl_idealpitchscale "0.8"
cl_lc "1"
cl_logocolor "#Valve_Blue"
cl_logofile "splatt"
cl_lw "1"
cl_minmodels "0"
cl_radartype "1"
cl_righthand "0"
cl_shadows "1"
cl_timeout "35"
cl_updaterate "101"
cl_vsmoothing "0.05"
cl_weather "0"
con_color "250 250 250"
console "1"
crosshair "1"
fastsprites "0"
fps_max "100"
fps_modem "0"
gamma "3"
gl_dither "1"
gl_flipmatrix "0"
gl_fog "1"
gl_monolights "0"
gl_overbright "0"
gl_polyoffset "0.1"
hisound "1"
hpk_maxsize "4"
hud_capturemouse "1"
hud_centerid "0"
hud_draw "1"
hud_fastswitch "1"
hud_saytext_internal "1"
hud_takesshots "0"
joystick "0"
lookspring "0.000000"
lookstrafe "0.000000"
m_filter "0"
m_forward "1"
m_pitch "0.022"
m_side "0.8"
m_yaw "0.022"
model "arctic"
MP3FadeTime "2.0"
MP3Volume "1"
mp_decals "300.000000"
name "Ju4a1 '' c(.'''.)d"
net_graph "0"
net_graphpos "1"
net_scale "5"
r_bmodelhighfrac "5.0"
r_detailtextures "0"
s_a3d "0"
s_automax_distance "30"
s_automin_distance "2"
s_bloat "2.0"
s_distance "60"
s_doppler "0.0"
s_eax "0"
s_leafnum "0"
s_max_distance "1000"
s_min_distance "8"
s_numpolys "200"
s_polykeep "1000000000"
s_polysize "10000000"
s_refdelay "4"
s_refgain "0.4"
s_rolloff "1.0"
s_verbwet "0.25"
sensitivity "1.400000"
skin ""
spec_autodirector_internal "1"
spec_drawcone_internal "1"
spec_drawnames_internal "1"
spec_drawstatus_internal "1"
spec_mode_internal "2"
spec_pip "0"
suitvolume "0.250000"
sv_aim "0"
sv_voiceenable "1"
team ""
topcolor "30"
viewsize "120.000000"
voice_enable "1"
voice_forcemicrecord "1"
voice_modenable "0"
voice_scale "1"
volume "2"
setinfo "_ah" "1"
setinfo "lang" "cn"
setinfo "_vgui_menus" "0"
+mlook
exec userconfig.cfg

下面是USERCONFIG

//网络通讯质量
ex_interp "0.1"

cl_rate "20000"

rate "25000"

fps_max "100"

cl_updaterate "101"

cl_cmdrate "101"

cl_cmdbackup "40"

cl_showfps "1"

//高品质声效
hisound "1"

voice_enable "1"

voice_forcemicrecord "1"

sv_voiceenable "1"

s_distance "60"

s_automin_distance "2"

s_automax_distance "30"

s_min_distance "8"

s_max_distance "1000"

s_refgain "0.4"

s_refdelay "4"

s_occfactor "0.25"

s_verbwet "0.25"

s_distance "60"

//跳蹲脚本
alias +sjump "+jump;+duck;+speed"
alias -sjump "-jump;-duck;-speed"

//开关持久语音通讯项
alias voice_key voice_on
alias voice_on "+voicerecord; alias voice_key voice_off"
alias voice_off "-voicerecord; alias voice_key voice_on"

//开关持久无声步项
alias speed_key speed_on
alias speed_on "+speed; alias speed_key speed_off"
alias speed_off "-speed; alias speed_key speed_on"

//开关持久蹲下
alias duck_key duck_on
alias duck_on "+duck; alias duck_key duck_off"
alias duck_off "-duck; alias duck_key duck_on"

//左右手持枪方式开关
alias hand_left "cl_righthand 0; alias hand_key hand_right"
alias hand_right "cl_righthand 1; alias hand_key hand_left"
alias hand_key hand_left

//调节游戏音量
alias volume0 "volume 0.0; alias volume_up volume1; alias volume_down volume0"
alias volume1 "volume 0.1; alias volume_up volume2; alias volume_down volume0"
alias volume2 "volume 0.2; alias volume_up volume3; alias volume_down volume1"
alias volume3 "volume 0.3; alias volume_up volume4; alias volume_down volume2"
alias volume4 "volume 0.4; alias volume_up volume5; alias volume_down volume3"
alias volume5 "volume 0.5; alias volume_up volume6; alias volume_down volume4"
alias volume6 "volume 0.6; alias volume_up volume7; alias volume_down volume5"
alias volume7 "volume 0.7; alias volume_up volume8; alias volume_down volume6"
alias volume8 "volume 0.8; alias volume_up volume9; alias volume_down volume7"
alias volume9 "volume 0.9; alias volume_up volume10; alias volume_down volume8"
alias volume10 "volume 1.0; alias volume_up volume10; alias volume_down volume9"
alias volume_up "volume8"
alias volume_down "volume6"

//调节mp3音量
alias mp3_volume0 "MP3volume 0.0; alias mp3_volume_up mp3_volume1; alias mp3_volume_down mp3_volume0"
alias mp3_volume1 "MP3volume 0.1; alias mp3_volume_up mp3_volume2; alias mp3_volume_down mp3_volume0"
alias mp3_volume2 "MP3volume 0.2; alias mp3_volume_up mp3_volume3; alias mp3_volume_down mp3_volume1"
alias mp3_volume3 "MP3volume 0.3; alias mp3_volume_up mp3_volume4; alias mp3_volume_down mp3_volume2"
alias mp3_volume4 "MP3volume 0.4; alias mp3_volume_up mp3_volume5; alias mp3_volume_down mp3_volume3"
alias mp3_volume5 "MP3volume 0.5; alias mp3_volume_up mp3_volume6; alias mp3_volume_down mp3_volume4"
alias mp3_volume6 "MP3volume 0.6; alias mp3_volume_up mp3_volume7; alias mp3_volume_down mp3_volume5"
alias mp3_volume7 "MP3volume 0.7; alias mp3_volume_up mp3_volume8; alias mp3_volume_down mp3_volume6"
alias mp3_volume8 "MP3volume 0.8; alias mp3_volume_up mp3_volume9; alias mp3_volume_down mp3_volume7"
alias mp3_volume9 "MP3volume 0.9; alias mp3_volume_up mp3_volume10; alias mp3_volume_down mp3_volume8"
alias mp3_volume10 "MP3volume 1.0; alias mp3_volume_up mp3_volume10; alias mp3_volume_down mp3_volume9"
alias mp3_volume_up "mp3_volume9"
alias mp3_volume_down "mp3_volume7"
//MP3选择
alias mp3_play1 "mp3 play mp3/1.mp3; alias mp3_play_next mp3_play2; alias mp3_play_last mp3_play10"
alias mp3_play2 "mp3 play mp3/2.mp3; alias mp3_play_next mp3_play3; alias mp3_play_last mp3_play1"
alias mp3_play3 "mp3 play mp3/3.mp3; alias mp3_play_next mp3_play4; alias mp3_play_last mp3_play2"
alias mp3_play4 "mp3 play mp3/4.mp3; alias mp3_play_next mp3_play5; alias mp3_play_last mp3_play3"
alias mp3_play5 "mp3 play mp3/5.mp3; alias mp3_play_next mp3_play6; alias mp3_play_last mp3_play4"
alias mp3_play6 "mp3 play mp3/6.mp3; alias mp3_play_next mp3_play7; alias mp3_play_last mp3_play5"
alias mp3_play7 "mp3 play mp3/7.mp3; alias mp3_play_next mp3_play8; alias mp3_play_last mp3_play6"
alias mp3_play8 "mp3 play mp3/8.mp3; alias mp3_play_next mp3_play9; alias mp3_play_last mp3_play7"
alias mp3_play9 "mp3 play mp3/9.mp3; alias mp3_play_next mp3_play10; alias mp3_play_last mp3_play8"
alias mp3_play10 "mp3 play mp3/10.mp3;alias mp3_play_next "mp3_play1"

//DEMO播放

//4X速播放
alias fw2on "host_framerate 0.05;alias fw2 fw2off;developer 1;echo Extreme Fastforward;developer 0"
alias fw2off "host_framerate 0.0;alias fw2 fw2on;developer 1;echo default playback speed;developer 0"
alias fw2 "fw2on"

//2X速播放
alias fastforwardon "host_framerate 0.015;alias fastforward fastforwardoff;developer 1;echo Fastforward;developer 0"
alias fastforwardoff "host_framerate 0.0;alias fastforward fastforwardon;developer 1;echo default playback speed;developer 0"
alias fastforward "fastforwardon"

//暂停
alias pauseon "host_framerate 0.0000000001;alias pauser pauseoff;developer 1;echo paused;developer 0"
alias pauseoff "host_framerate 0.0;alias pauser pauseon;developer 1;echo unpaused;developer 0"
alias pauser "pauseon"

//2/1速

alias slowmotionon "host_framerate 0.0025;alias slowmotion slowmotionoff;developer 1;echo Slowmotion;developer 0"
alias slowmotionoff "host_framerate 0.0;alias slowmotion slowmotionon;developer 1;echo default playback speed;developer 0"
alias slowmotion "slowmotionon"

//1/4速
alias sw2on "host_framerate 0.0005;alias sw2 sw2off;developer 1;echo Extreme Slowmotion;developer 0"
alias sw2off "host_framerate 0.0;alias sw2 sw2on;developer 1;echo default playback speed;developer 0"
alias sw2 "sw2on"

//录象录制
alias demsl demsl1
alias demsl1 "alias demsl demsl2;slowmotion;say_team demospeed 1/2"
alias demsl2 "alias demsl demsl1;sw2;say_team demospeed 1/4"
alias demft demft1
alias demft1 "alias demft demft2;fastforward;say_team demospeed 2x/1x"
alias demft2 "alias demft demft1;fw2;say_team demospeed 4x/1x"

alias savdem savdem1on
alias savdem1on "alias savdem savdem1of;record 001;say_team start to record demo vol.1 - 001.dem"
alias savdem1of "alias savdem savdem2on;stop;say_team finish demo vol.1 - 001.dem"
alias savdem2on "alias savdem savdem2of;record 002;say_team start to record demo vol.2 - 002.dem"
alias savdem2of "alias savdem savdem3on;stop;say_team finish demo vol.2 - 002.dem"
alias savdem3on "alias savdem savdem3of;record 003;say_team start to record demo vol.3 - 003.dem"
alias savdem3of "alias savdem savdem1on;stop;say_team finish demo vol.3 - 003.dem"

//脚本结束
bind "Enter" "exec csmate.cfg"

2.
FPS 就是你的帧数..说白了就是你屏幕得刷新率.
在CS里面得影响就是 说专业点你的弹道密集程度还有画面得流畅.当然,参数里面也有很多命令可以调整你得画面...越高你得画面也就越清晰弹道野越密集 但是100其实已经是弹道密集得最大制了.机器不一样 还要用点软件来锁你得FPS
现在用得比较多得就是REFORCE NVT

是不是CONFIG看不懂啊...要不你把你QQ留下 我加你..
参考技术B 1 脚本的定义1楼已经解释清楚了,再说就是多余,结论就是cs必须有脚本才能运行,不要相信删掉脚本文件就ok了,其实还是存在,不信的话可以删掉之后再运行cs,结果脚本又"出现"了.其实进入cs已经就是在使用脚本,修改任何非默认的东西-包括改名都是在改动脚本,部分脚本是允许改动的,但涉及到公平性的部分就不允许改动-弹道,帧补偿,后坐力等等.可以在网上搜一个标准脚本(config.cfg)代替原先所有的*.cfg文件.
2 fps有两种意义,frequence per second-刷新率,frame per second-帧每秒.刷新率在crt上一般要求刷100,而在液晶上刷60即可,它是显示效果.帧每秒是计算机的计算结果,对cs弹道影响巨大,比较专业点的玩家都必须让它稳定在100.本回答被提问者采纳
参考技术C 修改设置参数的东西就是CS脚本! 参考技术D .... CS战队之家 有你想要的

以上是关于请教大家,在service中调用activity中handler对象?的主要内容,如果未能解决你的问题,请参考以下文章

怎样在android的service中调用Activity中的getWindow函数

android 怎么调用service里的方法

Android service与activity绑定调用问题

spring中静态类调用非静态对象的方法

android中怎样动态的将数据从service上传递到activity

通知在 Activity 中有效,但在 Service 中无效