14.Activity之间的Inter-process沟通
Messenger 实现Activity与Service通讯、进程通讯(一)

信使主要用于进程通讯详见SDKandroid.os.Messenger一、Activity通过Messenger发送信息给Service1、创建项目Messenger 包名:com.Messenger.main2、创建消息结构体MSG.javapackage com.Messenger.main;public class MSG {static final int MSG_ONE = 1;static final int MSG_TWO = 2;static final int MSG_THREE = 3;static final int MSG_FOUR = 4;}3、创建MessengerActivity.java通过ServiceConnection服务通讯控制类接口来获得Service的连接并创建Messenger对象重点:绑定服务器bindService(new Intent(this,MessengerService.class),this.mConnection, Context.BIND_AUTO_CREATE);代码:import android.app.Activity;import ponentName;import android.content.Context;import android.content.Intent;import android.content.ServiceConnection;import android.os.Bundle;import android.os.IBinder;import android.os.Message;import android.os.Messenger;import android.os.RemoteException;import android.view.View;import android.view.View.OnClickListener;import android.widget.Button;public class MessengerActivity extends Activity {private Messenger mServiceSend;private boolean mBound;private Button mButton;/***服务通讯类接口*/private ServiceConnection mConnection = new ServiceConnection() { @Overridepublic void onServiceDisconnected(ComponentName name) {// TODO Auto-generated method stubmServiceSend = null;mBound = false;}public void onServiceConnected(ComponentName name, IBinder service) { // TODO Auto-generated method stub/**Activity通过Service成功连接后返回的IBinder对象构建*之后通过该IBunder与Service实现通讯*/mServiceSend = new Messenger(service);mBound = true;}};public void doService(){/**创建并发送消息给Service*/try {Message msg = Message.obtain(null, MSG.MSG_ONE,0,0); mServiceSend.send(msg);} catch (RemoteException e) {// TODO Auto-generated catch blocke.printStackTrace();}}/** Called when the activity is first created. */public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState);setContentView(yout.main);mButton = (Button)findViewById(R.id.button1);mButton.setOnClickListener(new OnClickListener(){@Overridepublic void onClick(View arg0) {// TODO Auto-generated method stubdoService();}});}@Overrideprotected void onDestroy() {// TODO Auto-generated method stubsuper.onDestroy();//取消绑定if(mBound){unbindService(mConnection);}}@Overrideprotected void onStart() {// TODO Auto-generated method stubsuper.onStart();//绑定到服务器bindService(new Intent(this,MessengerService.class), this.mConnection, Context.BIND_AUTO_CREATE); }}4、让Messenger继承Servicepackage com.Messenger.main;import android.app.Service;import android.content.Intent;import android.os.Handler;import android.os.IBinder;import android.os.Message;import android.os.Messenger;import android.os.RemoteException;import android.util.Log;public class MessengerService extends Service {private final String log = "MessengerService";DataStruct mDataInfo = new DataStruct();/*创建发送/接收消息的IncomingHandler*/final Messenger mMessenger = new Messenger(new IncomingHandler());/*** 来自客户端消息的handler*/class IncomingHandler extends Handler{@Overridepublic void handleMessage(Message msg) {// TODO Auto-generated method stubsuper.handleMessage(msg);switch (msg.what) {case MSG.MSG_ONE:Toast.makeText(getApplicationContext(), "Hello Activity.", Toast.LENGTH_LONG).show(); break;case MSG.MSG_TWO:break;case MSG.MSG_THREE:break;case MSG.MSG_FOUR:break;default:break;}}}/*当绑定服务时,返回一个接口给messenger,为了发送消息给服务器*/@Overridepublic IBinder onBind(Intent intent) {// TODO Auto-generated method stubLog.i(log, "binding.");return mMessenger.getBinder();}@Overridepublic void onStart(Intent intent, int startId) {// TODO Auto-generated method stubLog.i(log, "Service Start.");super.onStart(intent, startId);}主要实现:(main.xml见Messenger 实现Activity与Service通讯、进程通讯(二))Service通过返回Messenger的Binder给绑定它的Activity实现通讯。
Acitvity

Activity(Activity是界面的载体,也可以理解为android应用程序的入口)●课程目标:掌握activity这个android最重要的组件的用法理解性记忆activity的生命周期:OnCreate,OnStart,OnResume,OnPause,OnStop,OnDestroy, OnRestrat;理解activity栈管理方式:先进后出熟悉使用activity与intent配合传递值的方式Activity window view之间的关系●重点难点:Activity生命周期理解性记忆●考核目标:什么是activity:Activity是Android系统中的四大组件之一,可以用于显示View。
Activity 是一个与用户交互的系统模块,几乎所有的Activity都是和用户进行交互的,但是如果这样就能说Activity主要是用来显示View就不太正确了。
请描述一下activity的生命周期Activity生命周期图Activity是什么●课程目标:Activity实际是如何实例化的?:activity通过StartActivity()这个方法实现,而StartActivity()是ContextImpl.java中的类,虚拟机系统服务控制activity启动,Activity的生命周期是如何注册和监控的?:oncreate等的生命周期是在context里定义的,activity只是进行重载@Override;ActivityMonit用于监控Activity,●重点难点:Activity与binder的关系:binder是android跨进程,是进程间通讯的基础;Android的设计activity和service托管在不同的进程,不同进程间的activity,service之间要交换数据属于IPC,Binder就是为了activity通讯而设计的一个轻量级的IPC框架。
activity 整个应用程序的启动过程:一:Launcher通过Binder进程间通信机制通知ActivityManagerService,它要启动一个Activity;二:ActivityManagerService通过Binder进程间通信机制通知Launcher进入Paused状态;三:Launcher通过Binder进程间通信机制通知ActivityManagerService,它已经准备就绪进入Paused状态,于是ActivityManagerService就创建一个新的进程,用来启动一个ActivityThread实例,即将要启动的Activity就是在这个ActivityThread实例中运行;四:ActivityThread通过Binder进程间通信机制将一个ApplicationThread类型的Binder 对象传递给ActivityManagerService,以便以后ActivityManagerService能够通过这个Binder对象和它进行通信;五:ActivityManagerService通过Binder进程间通信机制通知ActivityThread,现在一切准备就绪,它可以真正执行Activity的启动操作了●考核目标:Activity跟binder的关系是什么?Context(上下文)Context既是环境变量,又像Win32的句柄handle,但又确实是上下文??Activity window view之间的关系●课程目标:Activity window view之间的关系:Activity的内部实现,实际上是聚合了一个Window对象,当我们调用Activity的setContentView方法的时候,实际上是调用的Window对象的setContentView方法,所以我们可以看出Activity中关于界面的绘制是交给Window对象来做的。
概论作业答案

Chapter1 P685.Address Contents000201530201 03537. a. b. c.11001101 01100111100110108. a. b. c. d.11009. a. b. c.A0A C7B0BE24.a. b.00110010 001100111011126.a. b. c.1512127.a. b. c.11110111000030.a. b. c.15-121231.a. b. c.00011011110011111111134.a. b. c. 3 又3/4 4 又5/1613/1635.a. b. c.101.111111.1111101.01136.a. b. c. 1 又1/8-1/2-3/1637.a. b. c.111111110100100011101111 Chapter 2 P10634.a. e.i.10100111100101000035.logical operation mask a.OR11110000b.XOR10000000 d.AND1111111038.a. b. c.1101000001111010Chapter 3. Operating Systems1. Which of the following components of an operating system maintains the directory system? A. Device drivers B. File manager C. Memorymanager ANSWER: B2. Which of the following components of an operating system handles the details associated with particular peripheral equipment?A. Device driversB. File managerC. Memory manager A3. Which of the following components of an operating system is not part of the kernel? A. Shell B. File manager C. Scheduler A4. Multitasking in a computer with only one CPU is accomplished by a technique called . A. Bootstrapping B. Batch processing C. Multiprogramming ANSWER: C5. Execution of an operating system is initiated by a program called the . A. Window manager B. Scheduler C. Bootstrap C6. The end of a time slice is indicted by the occurrence of a signal called . A. An interrupt B. A semaphore C. A login A7. A set of instructions that should be executed by only one process at a time is called . A. Utility B. Critical region C. Privileged instruction ANSWER: B8. Which of the following is not an attempt to provide security? A. Passwords B. Privilege instructions C. Multitasking C9. Which of the following events is harmful to an operating system’s performance? A. Deadlock B. Interrupt C. Booting A 10. Which of the following is a technique for controlling access to a critical region? A. Spooling B. Time sharing C. Semaphore D.Booting ANSWER: C11. Which of the following is not involved in a process switch?A. InterruptB. Process tableC. DispatcherD. Shell D12. Which of the following is a task that is not performed by the kernel of an operating system? A. Communicate with the user B. Schedule processes C. Allocate resources D. Avoid deadlock A 13. Which of the following components of an operating system is executed to handle an interrupt signal?A. DispatcherB. Memory managerC. File manager A Fill-in-the-blank/Short-answer Questions1. In contrast to early batch processing techniques, __A__ allows the user to communicate with the computer while the user’s application is being executed. In turn, this type of processing requires that the computer’s responses to its environment be performed in a timely manner, a requirement known as __B__.ANSWER: A. Interactive processing B. Real-time processing2. Fill in the blanks below with the part on the operating system (file manager, memory manager, device drivers, window manager, scheduler, dispatcher) that performs the activity described.A. _____ maintains a record of what is displayed on the computer’s screenB. _____ performs the switching from one process to anotherC. _____ maintains the directory systemD. _____ creates virtualmemory E. ______ places new entries in the process table F. ______ performs the actual communication with I/O unitsANSWER: A. Window manager B. Dispatcher C. File managerD. Memory managerE. SchedulerF. Device drivers3. A ___A___ is a set of instructions. In contrast, a ___B___ is the activity of executing those instructions.ANSWER: A. program B. processChapter 4Networks and the InternetMultiple Choice Questions1. Which of the following is not a way of classifying networks? A. WAN versus LAN B. Closed versus open C. Router versus bridge D. Star versus bus ANSWER: C2. Ethernet is a means of implementing which of the following network topologies? A. Star B. WiFi C. Bus ANSWER: C3. Which of the following connects existing networks to form an internet?A. BridgeB. RouterC. SwitchD. Repeater ANSWER: B4. Which of the following is a protocol for controlling the right to transmit a message in a network?A. UDPB. CSMA/CDC. TCPD. FTP ANSWER: B5. Which of the following is not a means of performing inter-process communication over a network?A. Client/serverB. ICANNC. Peer-to-peer ANSWER: B6. Which of the following provides individual user access to the Internet?A. Tier-1 ISPsB. Tier-2 ISPsC. Access ISPsD. ICANN C7. Which of the following is not an application of the Internet? A. FTPB. EmailC. TelnetD. CERT ANSWER: D8. Which of the following is not designed to enhance the security? A. ICANN B. Firewall C. Encryption D. CERT ANSWER: A 9. Which of the following is used to translate between IP addresses and mnemonic addresses? A. File server B. Mail server C. Name server D. FTP server ANSWER: C 10. Which of the following is not a means of connecting networks? A. Switch B. Server C. Router D. Bridge ANSWER: B11. Which layer of the internet software actually transmits a message?A. ApplicationB. TransportC. NetworkD. Link D12. Which layer of the internet software chops messages into units whose size is compatible with the Internet?A. ApplicationB. TransportC. NetworkD. Link B13. Which layer of the internet software decides the direction in which message segments are transferred across the Internet?A. ApplicationB. TransportC. NetworkD. Link C14. Which layer of the internet software presents incoming messages to the computer user? A. Application B. Transport C. Network D. Link ANSWER: A15. Which of the following identifies the application to which a messagearriving from the Internet should be given?A. ProtocolB. Port numberC. DomainD. Interrupt B Fill-in-the-blank/Short-answer Questions1. List two network topologies: A. _____________ B. _____________ ANSWER: A. star B. bus2. What are two protocols for implementing the transport level in the TCP/IP protocol suite? A. _____________ B. ______________ ANSWER: A. TCP B. UDP3./heroes/superheroes/batpage.html, the directory containing the file being access is A. superheroes , the protocol that should be used when accessing the file is B. htt , and the file name is C.batpage.html4.Accordingtotheemailaddress“****************.org”,the“person”who should receive the message should be A Fido. and the location of the mail server that handles the mail for that person is B . 5. The main purpose of _A.Tier-1_ and _ B.tier-2_ ISPs is to provide a system of high-speed routers as the Internet’s communication backbone, whereas __C.access.__ ISPs concentrate on providing Internet access to the Internet’s users.6. The term A.pig and B.hippopotamu in the following HTML document are linked to other documents. <html> <head><title>This is the title</title> </head> <body> <h1>Favorite Animals</h1> <p>Of all the animals in the world, the <a href=”/pigs.html”>pig</a> is perhaps the most charming.</p><p>However,the<ahref=”/hip po.html”>hippopotamus</a> is also cute.</p> </body> </html>7. Identify two protocols used in networks to determine the right to transmit an original message.A. CSMA/CDB.CSMA/CA8. write the HTML tag that performs the indication function.A.<body>Begins the part that describes what will appear on the computer screenB. </html>Marks the end of the HTML documentC. <p>Marks the beginning of a paragraphD. </a>Marks the end of a term that is linked to another document补第一章To compare the memory facilities including register, main memory and mass storage, answer the following questions:a. Which should be used to hold the data immediately applicable to the operation at hand?registerb. Which should be used to hold the data that will be needed in the near future?main memoryc. Which should be used to hold the data that will not be needed in the immediate future?Mass storage Chapter 5. AlgorithmsMultiple Choice Questions1. Which of the following is an activity?A. AlgorithmB. ProgramC. Process ANSWER: C2. Which of the following is not a means of repeating a block of instructions?A. Pretest loopB. Posttest loopC. RecursionD.Assignment statement ANSWER: D3. When searching within the list:Lewis, Maurice, Nathan, Oliver, Pat, Quincy, Roger, Stan, Tom,which of the following entries will be found most quickly using the sequential search algorithm?A. LewisB. PatC. Tom A4. When searching within the list:Lewis, Maurice, Nathan, Oliver, Pat, Quincy, Roger, Stan, Tom,which of the following entries will be found most quickly using the binary search algorithm?A. LewisB. PatC. Tom ANSWER: B5. If X is integer, which of the following is the termination condition for the following loop?while (X < 5) do ( . . . )A. X < 5B. X > 4C. X < 4 ANSWER: B6. If X is integer, which of the following is the termination condition for the following loop?repeat ( . . . ) until (X < 5)A. X < 5B. X > 4C. X > 5 ANSWER: A7. If N is integer, which of the following is the termination condition in the following recursive procedure?procedure xxx (N)if (N < 5) then (apply the procedure xxx to the value N + 1)else (print the value of N)A. N < 5B. N > 4C. N < 4 ANSWER: B8. Which of the following does not print the same sequence of numbers as the others? CA. X 5B. X 4C. X 5while (X < 6) do while (X < 5) do repeat (print the value of X;(print the value of X; (X X + 1; X X + 1)X X + 1) print the value of X) until (X > 6)9. Which of the following is not a way of representing algorithms?A. Stepwise refinementB. PseudocodeC. FlowchartD. Programming language ANSWER: A 10. Which algorithms would find the name Kelly more quickly in the list: John, Kelly, Lewis, Maurice, Nathan, Oliver, Pat, Quincy, Roger, Stan, Tom?A. sequential searchB. binary search AFill-in-the-blank/Short-answer Questions1. An ordered collection of unambiguous, executable steps that defines a terminating process is called A Algorithm , and the representation of an algorithm is B.Program , The action of executing a program is C Process .2. What sequence of values will be printed when the following instructions are executed?X 5;if (X < 7) then (print the value 6;Y 6)else (print the value 4;Y 4)if (Y < 5) then (print the value 3)else (print the value 2)ANSWER: 6, 23. What sequence of values would be printed if the procedure xxx described below were executed with N = 9?procedure xxx (N)if (N < 4) then (print the value of N;apply the procedure yyy to the value 7)else (apply the procedure yyy to the value 2;print the value of N)procedure yyy (N)if (N < 5) then (print the value of N;apply the procedure zzz to the value 6)else (apply the procedure zzz to the value 5)procedure zzz (N)if (N = 5) then (print the value 7)else (print the value 8) ANSWER: 2, 8, 94. When using binary search algorithm to search for the letter X within the list: R, S, T, U, V, W, Z. How many entries will be checked before discovering that the letter is not in the list? ____________ ANSWER: 35. When using sequential search algorithm to search for the letter X within the list: R, S, T, U, V, W, Z. How many entries will be checked before discovering that the letter is not in the list? ____________ ANSWER: 76. Suppose the binary search algorithm was being used to search for the entry Tom in the list:Nathan, Oliver, Pat, Quincy, Rodger, Stan, TomA. What would be the first entry in the list to be considered?_____________ QuincyB. What would be the second entry in the list to be considered?_____________ Stan7. At most, how many entries in a list of 5000 names will be interrogated when using the sequential search algorithm? ___________ ANSWER: 5000 8. Which of the sequential or binary search algorithms would find the name Roger in the following list more quickly?John, Kelly, Lewis, Maurice, Nathan, Oliver, Pat, Quincy, Roger, Stan, Tom_______________ ANSWER: Binary9. What sequence of numbers would be printed if the following procedure were executed with N = 0?procedure xxx (N)while (N < 4) do(print the value of N;N N + 2;print the value of N) ANSWER: 0, 2, 2, 4 10. What sequence of numbers would be printed if the following procedure were executed with N = 0?procedure xxx (N)print the value of N;if (N < 5) then (apply the procedure xxx to the value N + 2);print the value of N ANSWER: 0, 2, 4, 6, 6, 4, 2, 0 11. What sequence of numbers would be printed if the procedure xxx were executed with N =2?procedure xxx (N) procedure yyy (N)print the value of N; print the value of N;if (N < 3) apply the procedure xxx to the value 5;then (apply procedure yyy print the value of Nto the value 4);print the value of N ANSWER: 2, 4, 5, 5, 4, 2 12. Fill in the blank in the procedure below so that the procedure prints the integers from 0 up to the integer value it was given for N. That is, if the procedure is executed with N = 3, it should print 0, 1, 2, 3.procedure xxx (N)if (_________) then (apply the procedure xxx to the value N - 1);print the value of N) ANSWER: N > 0Chapter 6. Programming LanguagesMultiple Choice Questions1. Most machine languages are based on the ANSWER: AA. Imperative paradigmB. Declarative paradigmC. Functional paradigmD. Object-oriented paradigm2. Which of the following does not require a Boolean structure? CA. If-then-else statementB. While loop statementC. Assignment statementD. For loop statement3. Which of the following is not a control statement? ANSWER: CA. If-then-else statementB. While loop statementC. Assignment statementD. For loop statement4. Which of the following is not a step in the process of translating a program?A. Executing the programB. Parsing the programC. Lexical analysisD. Code generation A5. Which of the following is not associated with object-oriented programming?A. InheritanceB. ResolutionC. EncapsulationD. Polymorphism ANSWER: B6. Positions within arrays are identified by means of numbers calledA. IndicesB. ParametersC. Instance variablesD. Constants ANSWER: A7. Which of the following is ignored by a compiler?A. Control statementsB. Declarations of constantsC. Procedure headersD. Comment statements ANSWER: D8. Which of the following is not a way of referring to a value in a program?A. VariableB. LiteralC. ConstantD. Type ANSWER: D9. Which of the following is the scope of a variable?A. The number of characters in the variable’s nameB. The portion of the program in which the variable can be accessedC. The type associated with the variableD. The structure associated with the variable ANSWER: B10. Which of the following is a means of nullifying conflicts among data types?A. InheritanceB. ParsingC. CoercionD. Code optimization ANSWER: C11. Which of the following is not constructed by a typical compiler?A. Source codeB. Symbol tableC. Parse treeD. Object program ANSWER: A12. Which of the following is a means of defining similar but different classes in an object-oriented program? ANSWER: AA. InheritanceB. ParsingC. CoercionD. Code optimization Fill-in-the-blank/Short-answer Questions1. Indicate how each of the following types of programming languages is classified in terms of generation (first generation, second generation, or third generation).A. High-level languages _____________Third generationB. Machine languages _____________ First generationC. Assembly languages _____________Second generation2. What encoding system is commonly used to encode data of each of the following types?(CAUTION: This question relies on material from chapter 1)A. Integer ___________________________ Two’s complementB. Real __________________________Floating-pointC. Character ___________________________ASCII or Unicode3. A ___________________ array is an array in which all entries are of the same type whereas entries in a ________________ array may be of different types. ANSWER: homogeneous, heterogeneous4. In programming languages that use + to mean concatenation of character strings, the expression “2x” + “3x” will produce what result?ANSWER: “2x3x”5. The following is a program segment and the definition of a procedure named sub.…X 3; procedure sub (Y)sub (X); Y 5;print the value of X;…A. What value will be printed by the program segment if parameters are passed by value?____________3B. What value will be printed by the program segment if parameters are passed by reference?____________56. The following is a program segment and the definition of a procedure named sub.…procedure subX 8; . X 2;apply procedure sub;print the value of X;...A. What value will be printed by the program segment if X is a global variable?____________2B. What value will be printed by the program segment if X is a local variable within the procedure?____________87. In the context of the object-oriented paradigm, _____A_____ are templates from which_____B_______ are constructed. We say that the latter is an instance of the former ANSWER: A. classes, B. objects 8. In the context of the object-oriented paradigm, a __________________ is an imperative program unit that describes how an object should react to a particular stimulus.ANSWER: method (or member function for C++ programmers)。
AIDL详解

AIDL详解AIDL详解1、简介:AIDL是Android中IPC(Inter-Process Communication)⽅式中的⼀种,AIDL是Android Interface definition language的缩写。
其主要作⽤是⽤于进程间的通讯。
在Android系统中,每个进程都运⾏在⼀块独⽴的内存中,在其中完成⾃⼰的各项活动,与其他进程都分隔开来。
可是有时候我们⼜有应⽤间进⾏互动的需求,⽐较传递数据或者任务委托等,AIDL就是为了满⾜这种需求⽽诞⽣的。
通过AIDL,可以在⼀个进程中获取另⼀个进程的数据和调⽤其暴露出来的⽅法,从⽽满⾜进程间通信的需求。
2、特性:⽀持的数据类型:⼋种基本数据类型:byte、char、short、int、long、float、double、boolean String,CharSequence 实现了Parcelable接⼝的数据类型 List 类型。
List承载的数据必须是AIDL⽀持的类型,或者是其它声明的AIDL对象 Map类型。
Map承载的数据必须是AIDL⽀持的类型,或者是其它声明的AIDL对象AIDL⽂件可以分为两类。
⼀类⽤来声明实现了Parcelable接⼝的数据类型,以供其他AIDL⽂件使⽤那些⾮默认⽀持的数据类型。
还有⼀类是⽤来定义接⼝⽅法,声明要暴露哪些接⼝给客户端调⽤,定向Tag就是⽤来标注这些⽅法的参数值。
定向Tag。
定向Tag表⽰在跨进程通信中数据的流向,⽤于标注⽅法的参数值,分为 in、out、inout 三种。
其中 in 表⽰数据只能由客户端流向服务端, out 表⽰数据只能由服务端流向客户端,⽽ inout 则表⽰数据可在服务端与客户端之间双向流通。
此外,如果AIDL⽅法接⼝的参数值类型是:基本数据类型、String、CharSequence或者其他AIDL⽂件定义的⽅法接⼝,那么这些参数值的定向 Tag 默认是且只能是 in,所以除了这些类型外,其他参数值都需要明确标注使⽤哪种定向Tag。
大学英语跨文化复习重点

Chapter 1 CultureI.定义Culture(from intellectual perspective):从知性角度定义文化:作为整体的人类智力成就的艺术和其他表现Culture(from anthropologic perspective):从人类学角度定义文化:文化有清晰和模糊的行为模式构成,这些模式通过符号获得并传播,这些符号有人类群体的特别成就构成,包括具体的人工制品。
文化的基本核心由传统思想和与其相关的价值观构成。
Culture(from psychological perspective) : 从心理学角度定义文化:文化是使一个人类群体成员区别于其他人类群体的思维的总体规划。
Culture(from sociological perspective): 从社会学角度定义文化:文化是一种可习得的,基于群体的认知模式——包括言语与非言语符号,态度,价值观,信仰和非信仰系统以及行为。
Culture(from intercultural communication perspective): 从跨文化交际学角度定义文化:文化是个人和群体在种族发展过程中所获得的知识,经验,信仰,价值观,行为,态度,阶级,宗教,时间观,角色,空间观和艺术品的集合。
Culture Identity: 文化身份:认为自己归属于某一文化或民族群体的感觉。
Subculture亚文化:指存在于主流文化中的文化,其划分通常基于经济地位,社会阶层,民族,种族或地理区域。
Co-culture 共文化——指具有独特的交际特征,感知特点,价值观,信仰和行为,区别于其他群体,社团以及主流文化的群体或社团。
Subgroup 亚群体——相对于亚文化和共文化群体,亚群体通常规模不大,也不一定有文化群体时代相传积累的价值观念和行为模式。
Chapter 2 Communication and Intercultural Communication1. Sender/Source信息发出者/信息源:指传递信息的人2. Message信息:只引起信息接受者反应的任何信号。
跨文化交际教案chapter 4 interculture communication

Chapter IV Intercultural CommunicationⅠTeaching Objectives1.To identify the definitions of intercultural communication, interpersonal communication,intracultural communication, cross-cultural communication, international communication, interethnic communication, interracial communication, interregional communication.2.To understand the four fundamental values of western ethics.3.To understand the different ethics that belongs to the different part of the world.4.To understand the definition and main components of intercultural communication.ⅡLeading inⅢT eaching ProceduresStep 1Have students listen to the lead-in case What is Wrong?Ask students warming-up questions:●What is going wrong in this case?●Have you ever misunderstood someone who came from a different culture?●What is intercultural communication?●What intercultural communication skills do you know? Please list some of them.Step 2Culture and CommunicationThe metaphor of the journey and the map can help us understand the relationship between culture and communication. Cultures are both the maps of a place (the rules and conventions) and the journeys that take place there (actual practices).Intercultural communication definedForms of Intercultural communicationa. Interpersonal Communicationb. Intracultural Communicationc. International Communicationd. Interethnic Communicatione. Interracial Communicationf. interregional Communication4.3.1 Interpersonal communicationInterpersonal communication is a form of communication that involvesboth to adapt their messages specifically for those others and to obtain immediate interpretationsIntracultural communication is defined as communication between and among membersGenerally, people who are of the same race, political persuasion, and religion or who share the same interests communicate intraculturally.4.3.3 International communication4.3.4 Interethnic communication4.3.5 Interracial communicationInterracial communication occurs when the sender and the receiver exchanging messages are from4.3.6 Interregional communicationInterregional Communication refers to the exchange of messages between members of the dominant culture within a country.Intercultural communication ethics4.4.1 Western ethicsBeing free to act consistent with one’ own principles.●Impartiality; giving each person his or her legitimate due or portion of the whole.●Accountability for the consequences of one’s actions, including a failure to act.●Partiality to those who cannot protect themselves and to whom we are in special relationships.4.4.2 African ethicsrights.4.4.3 Buddhist ethicsValue is placed which are to be pursued for the betterment of the person if not in this life, then in the next.4.4.4 Hindu ethicsHinduism strives for the for including individualism, to merge with the absolute.4.4.5 Islamic ethicsTraditional Islamic perspectives on ethics are based on its religious concepts. There are different rules of ethical conduct for women and for men.Step3Raising Intercultural Awareness:采访外国人:教师布置学生就某些特定问题采访一些外国人,并引导学生比较不同的受访者做出的回答,以及他们对采访和采访问题所表现出的态度和反应。
跨文化交际复习资料
跨文化交际复习资料跨文化交际复习资料文稿归稿存档编号:[KKUY-KKIO69-OTM243-OLUI129-G00I-FDQS58-1.monochronic time (M Time) :It schedules one event at a time. Inthese cultures time is perceived as a linear structure just like a r i b b o n s t r e t c h i n g f r o m t h e p a s t i n t o t h e f u t u r e.2.polychronic time (P Time) :schedules several activities at thesame time. In these culture people emphasize the involvement of people more than schedules. They do not see appointments asironclad commitments and often break them.3.intercultural communication :is a face-to-face communicationbetween people from different cultural backgrounds4.host culture is the mainstream culture of anyone particularcountry.5.minority culture is the cultural groups that are smaller innumerical terms in relation to the host culture.6.subculture is a smaller, possibly nonconformist, subgroup withinthe host culture.7.multiculturalism is the official recognition of a country’scultural and ethnic diversity.8.cross-cultural communication is a face-to-face communicationbetween reprentatives of business,government andprofessionalgroups from different cultures.9.high-context culture :a culture in which meaning is notnecessarily contained in words. Information is provided through gestures, the use of space, and even silence.10.low-context culture :a culture in which the majority of theinformation is vested in the explicit code.11.perception: in its simplest sense,perception is ,as Marshallsinger tells us,”the process by which an individual selects,evaluates,and organizes stimuli from the external world” In other words, perception is an internal process whereby we convert the physical energies of the world into meaningful internalexperiences.Non-verbal communicationIt refers to communication through a whole variety of differenttypes f signal come into play, including the way we more, the gestures we employ, the posture we adopt, the facial expression we wear, the direction of our gaze, to the extent to which we touch and the distance we stand from each other.. IndividualismIndividualism refers to the doctrine that the interests of the individual are or ought to be paramount, and that all values, right, and duties originate in individuals. It emphasizes individual initiative, independence,individual expression, and even privacy.13. ParalanguageThe set of nonphonemic properties of speech, such as speaking tempo, vocal pitch, and intonational contours, that canbe used to communicate attitudes or other shades of meaning.12.人际交际interpersonal communication: a small number ofindividuals who are interacting exclusively with one another and who therefore have the ability to adapt their messages specifically for those others and to obtain immediateinterpretaions from them.指少数人之间的交往他们既能根据对方调整自己的信息,又能立即从对方那里获得解释。
《 英汉互译(一)》第1课教案
广西师范学院《英汉互译(一)》课程教案编号: 15-1 开课单位:外语系授课教研室:翻译写作课程名称:《英汉互译(一)》授课教师:唐旭光教材:《新编英汉互译教程》,授课对象:06级英语专业2、3、5班《英汉互译(一)》第一讲翻译简论与主要翻译方法(A Brief Discussion of Translation and Major Translation Approaches)1. IntroductionTranslation studies started along with translation practice. Translation theories developed flourishingly in the 20th century, especially in the second half of the last century.In fact, translation, which is a very complex phenomenon, is related to different disciplines, such as linguistics, psychology, sociology, cultural anthropology, communication theory, literary criticism, aesthetics, and semiotics. As translation study is a cross-discipline and cross-culture subject involving many aspects of human knowledge, the lack of a fully acceptable theory of translation should not come as a surprise. Meanwhile, quite a number of translation approaches and strategies have become universally acceptable and widely applicable. They are, of course, the fruits of many translation theorists and translation practitioners at home and abroad.2.The Origin of TranslationLanguage makes it possible for people to communicate with one another freely so as to complete important tasks in human life. Translation makes it possible for people from different languages to communicate with one another so as to complete important tasks in their life.Theodore Savory points out, “Translation is almost as old as original authorship and has a history as honorable and as complex as that of any other branch of literature”(申雨平, 2002:4).In Zhou Dynasty there were different forms of address for translators in different places. “Translators are called Ji in the east, Xiang in the south, Didi in the west, andYi in the north(东方曰寄,南方曰象,西方曰狄鞮,北方曰译)”(陈福康, 2000:3).3. Function of TranslationIt has helped people to better communicate with one another, and in the mean time it has facilitated the development of culture and civilization of all nations, such as the Sutra translation (佛经翻译)in China and the Bible translation in Western countries.Actually, translation, as a means to bridge different cultures, has been playing a very important role in promoting global economic and cultural development, and China in particular benefits a great deal from translation, which is obvious to all.4. Nature of translationOne school of theorists maintain that any interpretation is translation. Translation thus defined includes intra-lingual rewording(语言内的重新措辞), inter-lingual (语言之间的翻译或语际翻译)translation and inter-semiotic transmutation(符号转换).But most scholars who are interested in translation maintain that translation is a communicative activity which entails a most adequate or identical reproduction in a target language of a written message or text in a source language.5. Definition of translation in our textbook as follows: Translation or translating is a communicative activity or dynamic process in which the translator makes great effort to thoroughly comprehend a written message or text in the source language and works very hard to achieve an adequate or an almost identical reproduction in the target language version of the written source language message or text. In terms of its nature or character, translation is both an art and a science as well, since it calls for a good command of at least two languages, a flexible application of their rules, and some knowledge of at least two cultures, as well as a good grasp of the necessary translation theories.6. Other scholars’ viewpoints about the translation1). The traditional viewpoint about the nature of translation is that translation is an art only. This viewpoint is still maintained by Xu Yuanchong(许渊冲), a well-known professor at Beijing University, and a few other scholars.2). Professor Liu Zhongde vigorously advocates that translation is a science as well as an art mainly because of the following reasons:Firstly, like any other art and science, translation requires a good grasp and a flexible use of the necessary specialized knowledge and skills.Secondly, like any other art and science, translation calls for independent, honest and creative effort.Thirdly, just like any other art and science, translation demands that the translator be very careful about and highly responsible for his or her work.7. Principle for translationThe 13 statements on page 81). A translation must reproduce the words of the SLT(Source Language Text).2). A translation must reproduce the ideas (meaning) of the SLT.3). A translation should read like an original work.4). A translation should read like a translation.5). A translation should reflect the style of the original.6). A translation should possess the style of the translator.7). A translation should retain the historical stylistic dimension of the SLT.8). A translation should read as a contemporary piece of literature.9). A translation may add to or omit from the original.10). A translation may never add to or omit from the original.11). A translation should let the readers of the SLT and the target language text (TLT) have essentially the same response.12). A translation should convey what the SLT author intends to convey.13). A translation should satisfy the need of the client.Evidently, though each of the above statements is right in a certain sense, yet it is not adequate or comprehensive enough to serve as a translation principle. Some of the principles proposed by various translation theorists can find their expression in the statements given above. Interlinear translation is an illustration of the first statement. Yan Fu’s three-character principle can be a combination of statements 2, 3 and 6. Nida’s functional equivalence is best express ed in statement 11.8. Yan Fu’s Considerations for translation?Strictly speaking, a translation theory in its true sense in China originated from Yan Fu(严复). He proposed the famous triple principle for translation, namely, faithfulness(信), expressiveness(达) and elegance(雅).1). His faithfulness means that the translated text should be faithful to the original text, ie, the version should keep the content or ideas of the original.2). His expressiveness means that the translated text should be expressive and coherent without anything awkward. In other words, his expressiveness requires that the version should be fluid, smooth, and easy to read and understand.3). His elegance demands that the translated text should be exquisite and that its style ought to be very graceful.9. Professor Liu Zhongde argues against “elegance” as a principle for translation of the original styleHe argued eloquently against “elegance” as a principle for translation of the original style. We all know that not all works are characterized by the elegant style. Different writers display different styles. For instance, Lenin wrote in a bold style, and Hemingway wrote in a simple, symbolic style. Even the same writer shows different styles on different occasions for different purposes. Naturally, different works demonstrate different styles. Thus, it is impossible & absolutely wrong to achieve the effect of elegance in the translated text if the style of the original is not elegant.10. The compiler of the textbook in favor of “closeness”1). We are in favor of Professor Liu’s triple translation principle. He changed Yan Fu’s “elegance” into “closeness”, which represents his contribution to the translation theory. His “closeness” is central in meaning. It is suitable for translation of all types of texts with different styles.2). If the original text is characterized by the elegant style, the translator should do his utmost to render it into a graceful text in the target language whose style is close to the original elegant style.If the original style is highly technical with a wealth of technical terms, thetranslator ought to employ plenty of corresponding technical terms in the target language and make the translated style as close to the original technical style as possible.3). If the original style is colloquial with a lot of informal words and colloquial sentences, the translator should translate it into a text with an informal style as close as possible to the original one by using many colloquial words and informal sentences.If the original style is ornate, the translator should follow suit and make effort to render the translated style as close to the original as possible.If the original text contains some vulgar words and sentences, the translator is not entitled to replace them with elegant words or sentences, and he should reproduce the original by using some corresponding vulgar words and sentences in the receptor language. Translators are duty-bound to do so, for the simple reason that they are translators.4). As we know, Yan Fu’s triple translation principle is highly concise and well rhymed and quite easy to learn by heart, which is one of the reasons why it is still very popular in China today.Professor Liu’s triple principle is similar to Yan Fu’s in that it is equally concise and easy to remember.Though Professor Liu’s triple principle is n ot rhymed, yet it is very forceful and impressive, for the Chinese character “切” is uttered in the falling tone, carrying the implication that faithfully conveying the original style or rendering the translated style as close to the original as possible is absolutely necessary and worth the translator’s great effort.11. Nida’s principle for translationEugene A. Nida and Taber stated emphatically (1969:12): “Translation consists in reproducing in the receptor language the closest natural equivalence of the source language message, first in terms of meaning and secondly in terms of style”.His dynamic equivalence is defined as a translation principle, according to which the translator seeks to translate the meaning of the original in such a way that the target language text wording will produce the same impact on the target text audience as the original wording does upon the source text audience. Later on, Nida changed “dynamic equivalence” into “functional equivalence”, because it seemed much more satisfactory to use the expression “functional equivalence” in describing the degree of adequacy of a translation.12. The literal translation approachProfessor Liu Zhongde (1994: 172) defines literal translation as follows: “In the process of translation, literal translation treats sentences as basic units and at the same time takes the whole passage into consideration; a translator who attaches great importance to literal translation does his or her best to reproduce the ideas and writing style of the original work, retaining in the version as many rhetorical devices and sentence structures of the original as possible.”ExamplesHe is said to be a rough diamond.人们说他是一块浑金璞玉。
深入理解Activity
OnReStart() 在Acti
OnResume() 在Activity和用户交互之前调用 (快速,持久化) 在系统要激活另一个Activity时 OnPause() 调用(快速) OnStop() 在Activity不再可见时调用 OnDestory() 在Activity被销毁时调用
否
余下的Intent Filter 是否为零
是
匹配成功的Intent Filter按优先级排序
查找失败 抛出异常
返回最高优先级 的Intent Filter
Copyright © 2011
Intent Filter的匹配过程
• 当程序员使用startActivity(intent) 来启动另外一个 Activity 时,如果直接指定 intent 了对象的 Component 属性,那么 Activity Manager 将试图启 动其 Component 属性指定的 Activity。否则 Android 将通过 Intent 的其它属性从安装在系统中 的所有 Activity 中查找与之最匹配的一个启动,如 果没有找到合适的 Activity,应用程序会得到一个 系统抛出的异常。
Copyright © 2011
Activity栈
• Activity栈
失 去 焦 点 活
Activity1(Active状态)
新 激
重
Activity2(Pause/Stop/Kill状态) Activity3(Pause/Stop/Kill状态) Activity4(Pause/Stop/Kill状态)
Copyright © 2011
Activity新实例启动 新实例启动
Paused 状态
activity、intent和用户资源的使用的实验总结 -回复
activity、intent和用户资源的使用的实验总结-回复Activity、Intent和用户资源的使用的实验总结导言在移动应用开发中,Activity、Intent和用户资源的使用是非常重要的概念和技术。
Activity是Android应用程序的基本组件之一,代表了屏幕上的一个窗口,负责与用户进行交互。
Intent是Android中用于传递消息和进行组件之间通信的对象。
而用户资源则是指应用程序中使用到的图片、音频、视频等资源文件。
本文将从实验的角度出发,对Activity、Intent 和用户资源的使用进行详细总结。
1. 实验目的通过本次实验,旨在熟悉和掌握以下内容:- Activity的生命周期和使用方法- Intent的使用方法,包括显式和隐式Intent- 用户资源的使用,包括图片、音频和视频等资源文件的加载和展示2. 实验环境和工具- Android Studio:作为开发工具,提供了丰富的API和模拟器等功能- 模拟器:用于在电脑上模拟Android设备,方便进行调试和测试3. 实验过程3.1 Activity的生命周期和使用方法在Android中,每个Activity都有自己的生命周期,包括创建、启动、暂停、恢复、停止和销毁等阶段。
我们可以通过重写Activity的相关方法来控制其行为。
在本次实验中,我们创建了一个简单的计算器应用,涉及到两个Activity:MainActivity和ResultActivity。
MainActivity是应用程序的入口点,负责接收用户输入的数字,然后通过Intent将数据传递给ResultActivity进行计算。
在MainActivity的代码中,我们重写了onCreate方法来初始化界面,并在用户点击“计算”按钮时,通过Intent将数据传递给ResultActivity。
ResultActivity接收到数据后,进行计算,并将结果返回给MainActivity显示出来。
- 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
- 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
- 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。
14.Activity之间的Inter-process沟通在Android里,一个Package可以含有多个Activity,这些Activity可以在同一个进程(Process)里执行;也可以在不同的进程里执行。
基于Linux的安全限制,以及进程的基本特性(例如,不同进程的地址空间是独立的),Activity-a 与Activity-b在同一个进程里执行时,两者沟通方便也快速。
但是,当Activity-a与Activity-b分别在不同的进程里执行时,两者沟通就属于IPC跨进程沟通了,不如前者方便,也慢些。
例如:/* ===== EX-01 ====== *//* ac01.java */package xom.misoo.pkzz;import android.app.Activity;import android.content.Intent;import android.os.Bundle;import android.view.View;import android.view.View.OnClickListener;import android.widget.Button;import android.widget.LinearLayout;public class ac01 extends Activity implements OnClickListener { private Button btn, btn4;public static ac01 appRef = null;private String feedback_data;@Overridepublic void onCreate(Bundle savedInstanceState) {super.onCreate(savedInstanceState);appRef = this;setContentView(yout.main);this.show_layout_01();}@Overridepublic void onResume(){super.onResume();setTitle(feedback_data);}void show_layout_01(){LinearLayout layout = new LinearLayout(this);layout.setOrientation(LinearLayout.VERTICAL);btn = new Button(this);btn.setBackgroundResource(R.drawable.water);btn.setText("Edit");btn.setOnClickListener(this);youtParams param = newyoutParams(150, 40);param.topMargin = 5;layout.addView(btn, param);btn4 = new Button(this);btn4.setBackgroundResource(R.drawable.face);btn4.setText("Exit");btn4.setOnClickListener(this);layout.addView(btn4, param);setContentView(layout);}public void setData(String x){feedback_data = x;}public void onClick(View v){if (v == btn){Intent intent = new Intent(this, Activity_1.class);this.startActivity(intent);}if(v.equals(btn4))this.finish();}}/* Activity_1.java */package xom.misoo.pkzz;import android.app.Activity;import android.os.Bundle;import android.view.View;import android.view.View.OnClickListener;import android.widget.Button;import android.widget.LinearLayout;public class Activity_1 extends Activity implements OnClickListener { private Button btn;@Overridepublic void onCreate(Bundle icicle) {super.onCreate(icicle);LinearLayout layout = new LinearLayout(this);layout.setOrientation(LinearLayout.VERTICAL);btn = new Button(this);btn.setBackgroundResource(R.drawable.music);btn.setText("Edit");btn.setOnClickListener(this);youtParams param = newyoutParams(150, 40);param.topMargin = 5;layout.addView(btn, param);setContentView(layout);ac01.appRef.setData("feedback from Activity_1.");}public void onClick(View arg0) {finish();}}其中的指令:ac01.appRef.setData("feedback from Activity_1."); 只有ac01与Activity_1两者都在同一个地址空间(即进程)才会有效。
如果将AndroidManifest.xml里的<Activity>叙述修改为:<activity android:name=".Activity_1" android:process=":remote"><intent-filter><action android:name="android.intent.action.VIEW" /> <categoryandroid:name="android.intent.category.DEFAULT" /></intent-filter></activity>其令Activity_1在独立的进行里执行,则上述指令:ac01.appRef.setData("feedback from Activity_1."); 就不对了。
那么,这种跨进程的情形下,该如何沟通呢?使用SharedPreference可以使用:import android.content.SharedPreferences.Editor;于是,可在Activity_1里撰写指令如下:public class Activity_1 extends Activity implements OnClickListener { private Button btn;@Overridepublic void onCreate(Bundle icicle) {super.onCreate(icicle);…………………(省略)Editor passwdfile = getSharedPreferences("ITEM", 0).edit(); passwdfile.putString("ITEM","feedback from Activity_1.");mit();}…………………(省略)}并且,在ac01里撰写指令如下:public class ac01 extends Activity implements OnClickListener { ………………………@Overridepublic void onCreate(Bundle savedInstanceState) {super.onCreate(savedInstanceState);………………………}@Overridepublic void onResume(){super.onResume();SharedPreferences passwdfile = getSharedPreferences("ITEM", 0);String im = passwdfile.getString("ITEM", null);setTitle(im);}…………………………}这样就能Activity_1就能将数据传递给ac01了。
上述的ac01类别还可写为:public class ac01 extends Activity implements OnClickListener { ……………………@Overridepublic void onCreate(Bundle savedInstanceState) {super.onCreate(savedInstanceState);……………………}………………………@Overrideprotected void onActivityResult(int requestCode, int resultCode, Intent data){SharedPreferences passwdfile = getSharedPreferences("ITEM", 0);String im = passwdfile.getString("ITEM", null);setTitle(im);}public void onClick(View v){……………………Intent intent = new Intent(Intent.ACTION_EDIT, null);this.startActivityForResult(intent, 0);……………………}}这两写法一样都能让Activity_1传回数据。