ContentServer
- 格式:pdf
- 大小:69.82 KB
- 文档页数:3
contentresolver 的call 方法-回复什么是contentresolver 的call 方法?在Android 系统中,ContentResolver 是一个用于与ContentProvider 进行交互的类。
ContentProvider 提供了对应用程序所拥有的数据的标准界面,通过ContentResolver 类,应用程序可以实现对这些数据的增删改查操作。
ContentResolver 提供了多个方法来执行这些操作,其中包括call 方法。
ContentResolver 的call 方法允许应用程序通过对ContentProvider 发送自定义操作来实现更高级的功能。
通过调用call 方法并传递相应的参数,应用程序可以发送一个名为"call" 的特殊操作到ContentProvider 中,ContentProvider 可以根据这个操作名做出相应的处理,并返回一个Bundle 对象作为响应。
下面将逐步介绍contentresolver 的call 方法的使用步骤和常见应用场景。
第一步:获取ContentResolver 实例要使用ContentResolver 的call 方法,首先需要获取ContentResolver 实例。
可以通过调用context 的getContentResolver() 方法来获取:javaContentResolver resolver = context.getContentResolver();第二步:构建call 方法所需的参数ContentProvider 可能对应用程序传递的不同操作名具有不同的处理逻辑,因此在调用call 方法之前,需要构建相应的参数。
通常,参数以键值对的形式传递,并封装在一个Bundle 对象中。
javaBundle args = new Bundle();args.putString("key1", "value1");args.putInt("key2", 2);添加更多的参数在上述示例中,我们使用了两个键值对参数,一个是字符串类型的"key1",值为"value1",一个是整型的"key2",值为2。
ContentProvider的工作原理什么是ContentProviderContentProvider是Android中的一个组件,用于实现数据共享和数据访问的机制。
它允许一个应用程序将其数据暴露给其他应用程序,从而实现不同应用之间的数据共享和交互。
ContentProvider可以提供对结构化数据的访问,例如数据库中的表格,也可以提供对非结构化数据的访问,例如文件系统中的文件。
ContentProvider的作用ContentProvider主要有以下几个作用:1.数据共享:ContentProvider可以将一个应用程序的数据暴露给其他应用程序,从而实现数据的共享和交互。
其他应用程序可以通过ContentProvider访问和操作这些数据,而无需了解数据的具体存储方式和实现细节。
2.数据访问:ContentProvider提供了一种标准的接口,其他应用程序可以通过这个接口来访问和操作数据。
这样可以实现数据的统一管理,避免了重复的数据访问和操作代码。
3.数据保护:ContentProvider可以对数据进行权限控制,只有具有相应权限的应用程序才能访问和操作数据。
这样可以保护数据的安全性和私密性。
ContentProvider的工作原理ContentProvider的工作原理可以分为以下几个步骤:1. 注册ContentProvider在AndroidManifest.xml文件中,需要为ContentProvider注册一个相应的标签。
这个标签中需要指定ContentProvider的类名、权限等信息。
<providerandroid:name=".MyContentProvider"android:authorities="com.example.myapp.provider"android:exported="true" />2. 实现ContentProvider创建一个类来实现ContentProvider,并重写相应的方法。
contentresolver 的call 方法-回复ContentResolver的call方法是Android提供的一种机制,用于执行与Content Provider相关的自定义操作。
在本文中,我们将详细介绍ContentResolver的call方法,包括使用它的步骤和相关概念。
1. Content Provider和Content Resolver的概述在Android中,Content Provider是一种用于与应用程序中的数据进行交互的组件,它提供了一种标准化的接口,允许其他应用程序读取和修改其数据。
而Content Resolver是一个用于与Content Provider进行通信的对象,它可以查询和修改Content Provider中的数据。
2. ContentResolver的基本方法ContentResolver提供了多个方法来执行不同类型的操作,其中最常用的是query、insert、update和delete方法。
这些方法通过URI和可选的参数来指定要操作的数据和要执行的操作类型。
3. 理解call方法的作用call方法是ContentResolver提供的一个额外的操作方法,它允许应用程序使用自定义的操作类型来与Content Provider交互。
call方法通过URI、操作类型和可选的参数来指定要执行的操作。
它的返回值是一个Bundle对象,可以用于传递操作的结果数据。
4. 使用call方法的步骤使用call方法执行操作涉及以下步骤:(1) 获取ContentResolver对象:可以通过Context的getContentResolver方法获取ContentResolver对象。
(2) 构建URI:使用ContentProvider的URI来标识要执行操作的数据。
(3) 创建Bundle参数:如果操作需要参数,可以创建一个Bundle对象,并将参数放入其中。
使用contentprovider 分享数据的步骤使用ContentProvider分享数据的步骤ContentProvider是Android中用于管理与其他应用程序共享数据的组件。
它提供了一种标准化的方式,让应用程序能够安全地发布和获取数据,而无需直接访问底层数据源。
以下是使用ContentProvider分享数据的一般步骤:1.设计数据结构和数据库模式:在开始使用ContentProvider之前,首先需要设计数据结构和确定数据库模式。
这包括确定数据表、字段以及数据表之间的关系。
在设计数据库时,应考虑到需要与其他应用程序共享的数据类型和关联。
2.创建ContentProvider类:创建一个类继承自Android提供的ContentProvider基类。
该类负责管理数据的发布和获取,它必须实现一组标准的CRUD(Create, Read, Update, Delete)方法,以便其他应用程序可以执行数据操作。
3.定义URI:URI(Uniform Resource Identifier)用于标识要操作的数据资源。
在ContentProvider中,URI通常由以下几个部分组成:authority、path和optional ID。
authority是ContentProvider的唯一标识符,path用于指定资源的类型,optional ID是可选的资源ID。
根据具体需求,可以定义多个URI 以满足不同的操作。
4.实现CRUD方法:根据设计的数据结构和数据库模式,实现ContentProvider 中的CRUD方法。
这些方法包括insert、query、update和delete,分别对应数据的插入、查询、更新和删除操作。
可以根据不同的URI来处理不同的数据操作。
5.注册ContentProvider:在AndroidManifest.xml文件中注册ContentProvider。
在<application>标签下添加<provider>标签,并设置ContentProvider的authority属性以及其他属性,如读写权限等。
Advanced Robotics,V ol.21,No.13,pp.1473–1501(2007)©VSP and Robotics Society of Japan2007.Also available online-www.brill.nl/arReview The meaning of action:a review on action recognitionand mappingVOLKER KRÜGER1,∗,DANICA KRAGIC2,ALEŠUDE3and CHRISTOPHER GEIB41Computer Vision and Machine Intelligence Laboratory,Aalborg University,DK-3750Ballerup,Denmark2Computer Vision and Active Perception Laboratory,CSC-KTH,SE-10044Stockholm,Sweden3Jozef Stefan Institute,Department of Automatics,Biocybernetics&Robotics,1000Ljubljana,Slovenia4School of Informatics,University of Edinburgh,Edinburgh,EH89LE UKReceived12December2006;revised2May2007;accepted16May2007Abstract—In this paper,we analyze the different approaches taken to date within the computer vision,robotics and artificial intelligence communities for the representation,recognition,synthesis and understanding of action.We deal with action at different levels of complexity and provide the reader with the necessary related literature references.We put the literature references further into context and outline a possible interpretation of action by taking into account the different aspects of action recognition,action synthesis and task-level planning.Keywords:Action recognition;action representation;action synthesis;action understanding;planning.1.INTRODUCTIONThe recognition and interpretation of human-or robot-induced actions and activities has gained considerable interest in the computer vision,robotics and artificial intelligence communities.This is partially due to increasing computer power that allows large amounts of input data to be stored and processed,but also due the large number of potential applications,e.g.,in visual surveillance,in the entertainment industry,robot learning and control.Depending on the application,starting points and aims in action-related research are different.In this paper,we analyze the different approaches to action representation,recognition and mapping taken to date within the three communities.∗To whom correspondence should be addressed.E-mail:vok@cvmi.aau.dk1474V.Krüger et al.In visual surveillance,many applications are limited to distinguish usual from unusual actions,without any further interpretation of the action in the scene.An application of great potential is in automatic scene understanding systems that include the interpretation of the observed actions such as what actions are executed, where they are executed,who is involved and even a prediction of what the observed individuals’intentions might be given their present behavior.Such a surveillance system has to be non-intrusive and could potentially include a number of different sensors.In the entertainment industry,the interest lies mainly in thefield of motion capture and synthesis.Infilm productions,precise motion capture allows one to replace an actor with a digital avatar(as often done in recent movies).In computer games,game designers are interested in realistically looking digital animations as well as in motion capture technology that allows the gamer to interact with the computer game through body movements,e.g.,as done in the Sony EyeToy games.Ideally,the motion capture should be non-intrusive for both,film and computer games,so that actors and gamers would not need to wear special suits. The computer game needs to be able to interpret the movements of the gamer in a robust and reliable manner to maintain a maximal degree of entertainment. The surveillance and entertainment applications receive strong attention from the computer vision community.Here,action recognition is often treated as a pattern-matching problem with an additional time dimension.Attention is given to improper imaging conditions,noisy input data,and the development of robust approaches for representation and recognition the actions.There is strong neurobiological evidence that human actions and activities are directly connected to the motor control of the human body[1–3].When viewing other agents performing an action,the human visual system seems to relate the visual input to a sequence of motor primitives.The neurobiological representation for visually perceived,learned and recognized actions appears to be the same as the one used to drive the motor control of the body.Thesefindings have gained considerable attention from the robotics community[4–6]where the goal of imitation learning is to develop robot systems that are able to relate perceived actions of another(human)agent to their own embodiment in order to learn and later to recognize and to perform the demonstrated actions.One of the goals for the future is to enable artifical agents to acquire novel behaviors through observation of humans or other agents.The neurobiologicalfindings motivate research to identify a set of action prim-itives that allow(i)representation of the visually perceived action and(ii)motor control for imitation.In addition,this gives rise to the idea of interpreting and recognizing activities in a video scene through a hierarchy of primitives,simple ac-tions and activities.Many researchers in vision and robotics attempt to learn the action or motor primitives by defining a‘suitable’representation and then learn-ing the primitives from demonstrations.The representations used to describe the primitives vary greatly across the literature and are subject to ongoing research.The meaning of action1475 As an example,for imitation learning a teacher might attempt to show a robot how to set up or clean a dinner table.An important aspect is that the setting of the environment might change between the demonstration and the execution time.A robot that has to set up a dinner table may have to plan the order of handling plates, cutlery and glasses in a different way than previously demonstrated by the human teacher.Hence,it is usually not sufficient to just replicate the human movements. Instead,the robot must have the ability to recognize what parts of the whole task can be segmented and considered as subtasks so that it can perform on-line planning for task execution given the current state of the environment.A number of crucial problems arise:(i)How should the robot be instructed that the temporal order of the subtasks mayor may not matter?As an example,the main dish plate should always be under the appetizer plate while the temporal order in which the silverware is placed on the table is not important.(ii)How should the scene,the objects and the changes that can be done to them be represented?For example,when cleaning up the table the representation should allow to pile on the tray wine glasses on top of plates while piling plates on wine glasses might cause a major disaster.(iii)Given a specific scene state,the robot may be unable to perform a particular action.For example,the representation may specify that wine glasses can be piled on top of plates,but the robot may be unable to reach the desired height. (iv)The entire scene may change during the execution phase,and the robot has to be able to react to sudden changes and replan its task.Different aspects of the above problems have been considered in the area of task planning and sequencing with the specific focus on structured collections of actions.Here,different types of reasoning systems have been proposed,including rule-based systems,traditional Bayes nets,context free grammars,etc.,mainly for task planning purposes.Different methods and levels of action representation make the strongest obstacle to integrating the requirements for high-level conceptual state change representations suitable for planning and low-level continuous action execution and imitation for robots.In spite of the differences in the potential applications,most of the scenarios are closely related:all of them use sensory input,all need to capture the movements of an agent at different degrees of precision and all require a certain level of intelligence to understand the meaning of the captured movements.Thus,there is a need to:(i)Recognize the movements and actions of observed agents(recognizing theaction by observing it).(ii)Understand what effects certain actions have on the environment of the actor (recognizing the action by observing its effects on the environment).(iii)Understand how to physically perform a certain action in order to cause a particular change in the environment.1476V.Krüger et al.Figure1.Different levels of action consideration discussed in this paper:Observation and recognition (bottom left,Section3),synthesis and imitation(bottom right,Section4),and task-level planning and recognition(top,Section5).While thefirst two points are commonly shared across members of a society(non-verbal communication),the third point depends heavily on the individual/robot un-der consideration:how to perform an action that causes a particular environmental change may be different between individuals and robots,e.g.,depending on their physical capabilities.In this paper,we analyze the different approaches taken to date for dealing with action at different levels of complexity(see Fig.1)and provide the reader with the necessary related literature references.Different authors use different terms for discussing action primitives and action grammars.In Section2,we mention the most general references and define,to escape the diversity of terms, our own terminology that we will use throughout this paper.In Sections3–5we discuss how the representation and recognition of actions is treated with respect to representation,synthesis and planning.We conclude this paper in Section6.2.NOTATION AND ACTION HIERARCHIESTerms like actions,activities,complex actions,simple actions and behaviors are often used interchangeably by different authors.However,in order to describeThe meaning of action1477 and compare the different publications,we shortly review the different terms used and define a common terminology used throughout the paper.In a pioneering work[7],Nagel suggested to use a hierarchy of change,event,verb,episode, history.An alternative hierarchy(reflecting the computational aspects)is proposed by Bobick[8]who suggests to use movement,activity and action as different levels of abstraction(see also Ref.[9]).Others suggest to also include situations[10]or use a hierarchy of action primitives and parent behaviors[11].In this paper,we adopt the following action hierarchy:action/motor primitives, actions and activities.Action primitives or motor primitives are used for atomic entities out of which actions are built.Actions are,in turn,composed into activities. The granularity of the primitives often depends on the application.For example,in robotics,motor primitives are often understood as sets of motor control commands that are used to generate an action by the robot(see Section3.4).As an example,in tennis,action primitives could be‘forehand’,‘backhand’,‘run left’,‘run right’.The term action is used for a sequence of action primitives needed to return a ball.The choice of a particular action depends on whether a forehand,backhand,lob or volley,etc.,is required in order to be able to return the ball successfully.Most of the research discussed below falls into this category. The activity then is in this example‘playing tennis’.Activities are larger-scale events that typically depend on the context of the environment,objects or interacting humans.Good overviews of activity recognition are given by Aggarwal et al.[9,12],in Refs[13,14],as well as in a more recent one by Moeslund et al.[15].They aim at higher-level understanding of activities,and interactions and discuss different aspect such as level of detail,different human models,recognition approaches and high-level recognition schemes.Veeraraghavan et al.[16]discuss the structure of an action and activity space.2.1.OutlookIn order to investigate the full complexity of systems that deal with action represen-tation,recognition and synthesis we need to consider the following problem areas (see Table1for a summary):(i)How to observe other agents.This concerns the detection,representation,recognition and interpretation of visually perceived actions of observed agents.Problems such as view invariance,use of action grammars,pattern matching over time,representational issues,etc.,need to be investigated.(ii)How to control the physical body of a robot.This concerns learning/estimation of the mapping between the human and the robot kinematic chains.(iii)How a robot can imitate other agents.This concerns how a robot can generalize over a set of observed actions in order to generate novel ones from those observed.Here,issues such as hierarchical organization for sequences and1478V.Krüger et al.Table1.Researach areas,input and issues to investigateProblem Input Issues to investigateRecognition Two-dimensional image data,sen-sor data,MoCap data View variance,variance in execu-tion direction/scale,learning and using grammarsImitation Set of learned actions,object in-formation(position,type,shape,orientation,etc.),robot kinematics,human body model Object-dependent execution of ac-tion,mapping between kinematic chains,generalization over different observations,planningLearning object affordances Agent,scene with known objects Learning statistics between objects,scene state changes and agent’s ac-tions through observation and self-explorationprobabilistic inference and planning for recognition,prediction and decision making are relevant.(iv)Learning objects and their affordances,thus arriving at a set of object–action complexes that take into account the acting agent and the context.2.2.Ego-centric actionIn the robotics community,recognition of human activity has been used extensively for robot task learning through imitation and demonstration[5,17–24].Here, mainly human body model-based approaches(Section3.3)are used.One of the fundamentals of social behaviors of humans is the understanding of each others intentions through perception and recognition of performed actions.This is also underlined by the mirror neurons,motor resonance or mirroring[25–29].The mirror neurons allow the monkey to interpret others’actions by aligning inside its mind the pose of its own(imagined)body to the pose of an observed one and appear to be of major importance for the ability of the monkey(and human)to learn through imitating others.Thus,the mirror neurons are a biological justification for the use of human body model-based approaches to recognizing actions.By internally aligning the own body to an observed one,the mirror neurons move the reference system from the observed agent into the observer’s ego-centric frame of reference.In imitation learning,the action to be learned is executed by the trainer in his/her own coordinate system.In other words,the robot observes the action in the trainers coordinate system and then,when imitating,recognizes and executes the observed action in its own coordinate system.The body model is often represented as a kinematic chain and the recognition is done in the space of possible joint configurations or Cartesian trajectories.This ego-centric approach is in theory a great simplification of the action recog-nition task as one is able to compare and match the body movements of observed agents within a common,ego-centric,representation coordinate system.The meaning of action1479 The problems of the ego-centric approach are often due to the vision problem,i.e. the extraction of the visual data.The quality of the visual data has to be sufficiently good and the tracked agent has to be large enough(in terms of pixels).First experiments[30–32]have been done in aiding the body-tracking approaches with models for the executed action in order to constrain the tracking process.However, the models used so far are very simple and model usually periodic movements like walking.It is an open question and subject of present research how to incorporate more complex models to constrain the tracking process.Another problem stems from the general variability of even the simplest actions. Especially in every-day-like actions,simple movements such as‘reach and grasp an object’can have different directions and reaching distances.To represent such actions,it is not sufficient to store simple trajectories.Instead,special care has to be taken that actions with different parameterizations can be recognized and synthesized, e.g.,for the object grasping example,the action would be parameterized by the position of the object.One solution for parameterizing action from an ego-centric point of view was suggested by Ref.[33].However,in this work only simple actions are modeled and it is not clear how this representation would scale to more complex actions.The work presented in Refs[21,34,35]proposes a general architecture for action (mimicking)and program(gesture)-level visual imitation.The authors present a holistic approach to the problem by facilitating(i)the use of motor information for gesture recognition,(ii)usage of context(e.g.,object affordances)to focus the attention of the recognition system and reduce ambiguities,and(iii)the use of iconic image representations for the hand,as opposed tofitting kinematic models to the video sequence.2.3.Eco-centric actionFor many actions that are meant to lead to a specific change in the environment,the precise way of how a teacher executes an action sometimes does not matter.Often, it cannot even be exactly repeated if,for example,the object at which the action is aimed is located at different positions.Alternatively,a specific action may be carried out without any constraints on how it may be executed.The two examples from Section1on how to set up and clean a dinner table are typical examples in this context:They are meant to cause a specific environmental change while the actual execution is either not particularly constrained or has to be planned on-line,depending on the present state of the environment.An observer can recognize the performed action by interpreting the change of the environment,e.g.,‘the table is set-up’, without considering how the agent’s actions that lead to the environmental change were precisely executed.This viewpoint leads to an eco-centric interpretation of action as it puts the environment into the center of the action interpretation problem.In order to approach this viewpoint one needs to consider two issues:1480V.Krüger et al.(i)How to represent the changes in the environment.(ii)How to physically cause specific changes in the environment.Thefirst issue contains three subproblems.(a)How to visually recognize the changes in the environment is discussed in Sections3.1and3.2.(b)How to interpret the changes is a matter of plan recognition(see Section5).(c)How to combine these two:a few attempts were made to connect the two approaches[36,37].Some of the early approaches in robotics suggest[38]that changes in the environment should be represented as changes in the surface relationships between the scene objects.The second issue is concerned with the execution of meaningful robot movements that are meant to cause a specific change in the environment.Again,this issue has a number of subproblems.(a)How to execute a simple meaningful action.This is a problem beyond simple motor control(Section2.2)as the execution is based on the state of the environment,e.g.,the position of the object to be grasped.(b)How to plan the meaningful action to be executed by the robot.This is a problem which is inversely related to point(b)above.It requires a usually grammatical representation that describes the possible changes of the environment and the physical actions that can cause them[39,40].2.4.Object–action complexesTo formalize the possible changes in the environment,grammatical production rules for objects,object states and object affordances(an affordance changes the state of an object)can be used[41,42],e.g.,a door can have the states{open,closed}and the affordance{close door,open door}.In some cases,the objects and production rules are a priori specified by an expert and the scene state is usually considered to be independent from the presence of the agent itself within the scene,i.e.,the agent affects the scene state only through a set of specified actions.The fact that an agent might physically not be able to execute a particular action,e.g.,because it might not be in the right position or it might be too weak,must be taken into account.The research on motion planning takes this into account,while in most cases it is assumed that the scene(environment)does not change while the agent performs the planned movement.Another problem that arises from a priori definition of object affordances is the problem of taking into account the physical properties of the robot.In order for a robot to interact successfully with an environment,the set of object affordances it takes into account for planning must necessarily reflect its physical abilities. Unless the programmer has a precise model of the physical robot body as well as for the scene objects and the entire scene available,the affordances need to be learned by the robot itself through exploration.This leads us to the concept of object–action complexes.In order to learn how valid and appropriate an action is, the robot needs eventually to try to execute it.This could be interpreted as‘playing’or‘discovering’.Similar to humans,the learning process can be biased through imitation learning as long as there is sufficient similarity between the learning agent and the teacher.The meaning of action1481Figure2.Different types of action recognition approaches presented in Section3.3.INTERPRETATION AND RECOGNITION OF ACTIONThe vision community has mainly the goal of detecting,recognizing and interpret-ing movements of a(possibly non-human)agent based on video camera data.For example,in scene interpretation for surveillance the knowledge is often represented in a statistical manner.It is meant to distinguish‘regular’from‘irregular’activities and it should be independent from the objects causing the activity and thus is usu-ally not meant to distinguish explicitly,e.g.,cars from humans.On the other hand, some action recognition applications focus explicitly on human activities and the interactions between human agents.Here,we follow Aggarwal and Cai[12]and distinguish between the full-body-based approaches that model the human either as a whole,i.e.,without distinguishing between body parts,and the body-part-based approaches that model the human in a detailed manner as a set of body parts.Most full-body approaches attempt to identify information such as gender,identity,or simple actions like walking or running.Researchers using human body-part-based approaches appear often to be interested in more subtle actions or attempt to model actions by looking for action primitives with which the complex actions can be modeled.Body-part-based approaches can also be used in medical applications or in applications from the entertainment industry.In the following,we review some of the recent publications that have their emphasis on action recognition.The pre-sented techniques use video camera data as their primary input source,use mostly well-known tracking and motion capture techniques,and discuss how the results of those techniques can be used for action recognition.For papers on vision-based motion capture and tracking,we refer the reader to Ref.[15].Figure2summarizes the different types of approaches we have mentioned in this section.3.1.Scene interpretationMany approaches consider the camera view as a whole,and attempt to learn and recognize activities by observing the motion of objects without necessarily knowing their identity,i.e.,by identifying the changes in the scene over time.This is1482V.Krüger et al.reasonable in situations where the objects are small enough to be represented as points on a two-dimensional(2-D)plane.Stauffer et al.[43]present a full-scene interpretation system which allows de-tection of unusual situations.The system extracts features such as2-D position and speed,size and binary silhouettes.Vector quantization is applied to generate a codebook of K prototypes.Instead of taking the explicit temporal relationship be-tween the symbols into account,Stauffer and Grimson use co-occurrence statistics. Then,they define a binary tree structure by recursively defining two probability mass functions across the prototypes of the code book that best explain the co-occurrence matrix.The leaf nodes of the binary tree are probability distributions of co-occurrences across the prototypes and at a higher tree depth define simple scene activities like pedestrian and car movement.These can then be used for scene in-terpretation.Boiman and Irani[44]approach the problem of detecting irregularities in a scene as a problem of composing newly observed data using spatio-temporal patches extracted from previously seen visual examples.They extract small image and video patches which are used as local descriptors.In an inference process,they search for patches with similar geometric configuration and appearance properties, while allowing for small local misalignments in their relative geometric arrange-ment.This way,they are able to quickly and efficiently infer subtle but important local changes in behavior.In Refs[45,46]activity trajectories are modeled using non-rigid shapes and a dynamic model that characterizes the variations in the shape structure.Vaswani et al.[46]use Kendall’s statistical shape theory[47].Non-linear dynamical models are used to characterize the shape variation over time.An activity is recognized if it agrees with the learned parameters of the shape and associated dynamics.Chowdhury et al.[45]use a subspace method to model activities as a linear combination of3-D basis shapes.The work is based on the factorization theorem[48].Deviations from the learned normal activity shapes can be used to identify abnormal ones.A similar complex task is approached by Xiang and Gong [49].They present a unified bottom-up and top-down approach to model complex activities of multiple objects in cluttered scenes in order to(i)learn statistical dependencies between the objects,(ii)structure and parameters,(iii)select visual features that represent activities of multiple objects,(iv)infer semantic descriptions of activities from the learned model and(v)discuss how to use the activity model to improve interpretation of individual objects.Their approach is object-independent(it can be body parts,cars,etc.)and they use a dynamically multi-linked hidden Markov models(HMMs)to interlink between multiple temporal processes corresponding to multiple event classes.3.2.Recognizing human actions without using body partsA large number of approaches for recognition are based on the human silhouette as whole silhouettes can often be extracted much easier when singular body parts are difficult to distinguish.This is especially true when the observed agent is far awayfrom the camera.Naturally,the question on what an observed agent is precisely doing can be answered only with a much lesser precision than when singular body parts are extracted.Actions such as walking,running,jumping,etc.,as well as their speed,location in the image and their direction can,however,be extracted with an impressive robustness.All the approaches mentioned in this section attempt to recognize the apparent action based directly on a sequence of2-D image projections,without the interme-diate use,for example,of a3-D human model.The argument is that the use of an explicit human(not necessarily3-D)model is often not feasible in case of noisy and imperfect imaging conditions,and that a direct pattern recognition based on the2-D data is potentially more robust.This argument holds especially when there are only very few pixels on the image of the observed agent.A pioneering work has been presented by Efros et al.[50].They attempt to recognize a set of simple actions(walking,running plus direction and location) of people whose images in the video are only30pixels tall and where the video quality is poor.They use a set of features that are based on blurred opticflow (blurred motion channels).First,the person is tracked so that the image is stabilized in the middle of a tracking window.The blurred motion channels are computed on the residual motion that is due to the motion of the body parts.Spatio-temporal cross-correlation is used for matching with a database.The work of Robertson and Reid[36]extends the work of Efros[50]by proposing an approach where complex actions can be dynamically composed out of the set of simple actions.They attempt to understand actions by building a hierarchical system that is based on reasoning with belief networks and HMMs on the highest level,and on the lowest level with features such as position and velocity as action descriptors.The system is able to output qualitative information such as walking—left-to-right—on the sidewalk.A large number of publications work with space–time volumes,which is a recently proposed representation for the spatio-temporal domain.The3-D contour of a person gives rise to a2-D projection.Considering this projection over time defines the XY T image volume.One of the main ideas here is to use spatio-temporal XT-slices from an image volume XY T[51,52].Articulated motions of a human then show a typical trajectory pattern.Ricquebourg and Bouthemy[51] demonstrate how XT-slices can facilitate tracking and reconstruction of2-D motion trajectories.The reconstructed trajectory allows a simple classification between pedestrians and vehicles.Ritscher et al.[52]discuss the recognition in more detail by a closer investigation of the XT-slices.Quantifying the braided pattern in the slices of the spatio-temporal cube gives rise to a set of features(one for each slice)and their distribution is used to classify the actions.Yilmaz and Shah[53] extract information such as speed,direction and shape by analyzing the differential geometric properties of the XY T volume.They approach action recognition as an object-matching task by interpreting the XY T as rigid3-D objects.Blank et al.[54]also analyze the XY T volume.They generalize techniques for the analysis of 2-D shapes[55]for the use on the XY T volume.Blank et al.argue that the time。
《移动应用开发技术》教学设计课程名称:移动应用开发技术授课年级:授课学期:教师姓名:三、知识巩固1、总结知识点,使用博学谷系统中的随堂练习题巩固本节课所学知识。
2、使用博学谷系统中的测试题给学生布置作业。
第三学时(访问内容提供者、案例——短信备份)一、知识回顾1、对上节课留的作业进行答疑。
2、回顾总结上节课的内容,引出本节课主题老师引导,前两节课讲解了如何使用内容提供者暴露本应用的数据,接下来讲解如何通过另一个应用程序访问内容提供者所暴露的数据。
二、知识讲解1、ContentResolver介绍(PPT13)教师引导,在Android系统中,ContentResolver充当着一个中介的角色。
应用程序通过ContentProvider暴露自己的数据,通过ContentResolver对应用程序暴露的数据进行操作。
由于在使用ContentProvider暴露数据时提供了相应操作的Uri,因此在访问现有的ContentProvider时要指定相应的Uri,然后通过ContentResovler对象来实现数据的操作。
Uri uri = Uri.parse("content://cn.itcast.db.personprovider/person");ContentResolver resolver = context.getContentResolver();Cursor cursor = resolver.query(uri, new String[] { "address", "date", "type", "body" }, null, null, null);while (cursor.moveToNext()) {String address = cursor.getString(0);long date = cursor.getLong(1);int type = cursor.getInt(2);String body = cursor.getString(3);}cursor.close();上述代码用ContentResolver对象的query()方法实现了对其他应用数据的查询功能,需要注意的是,这里的Uri只能提供查询操作,如果使用查询操作的Uri进行更新操作会抛异常。
ContentResolver 是 Android 评台上用于访问应用程序数据的核心类之一,它允许应用程序通过提供统一的接口来访问其他应用程序的数据。
ContentResolver 提供了一种统一的方法来访问不同应用程序的数据,而不需要了解数据存储的细节。
本文将介绍 ContentResolver 的简单使用方法,并通过实例演示如何使用 ContentResolver 来访问其他应用程序的数据。
一、ContentResolver 的基本概念ContentResolver 是 Android 评台上用于访问应用程序数据的核心类之一。
它提供了一种统一的方法来访问不同应用程序的数据,而不需要了解数据存储的细节。
ContentResolver 对外提供了一组对数据操作的接口,并负责与具体的 ContentProvider 进行交互,实现数据的读取、插入、更新和删除等操作。
二、ContentResolver 的基本用法1. 获取 ContentResolver 对象在 Android 应用程序中,可以通过调用 Context 类的getContentResolver() 方法来获取 ContentResolver 对象,示例代码如下:```javaContentResolver contentResolver =context.getContentResolver();```2. 查询数据使用 ContentResolver 对象的 query() 方法可以进行数据的查询操作,示例代码如下:```javaUri uri = Uri.parse("content:/.example.provider/table");String[] projection = {"_id", "name", "age"};String selection = "age > ?";String[] selectionArgs = {"18"};Cursor cursor = contentResolver.query(uri, projection, selection, selectionArgs, null);```上述代码中,首先通过 Uri.parse() 方法解析数据的 Uri,然后指定查询的字段和条件,最后调用 query() 方法进行数据的查询,返回结果为一个 Cursor 对象,可以通过 Cursor 对象获取查询结果。
contentobserver 详解ContentObserver 详解什么是 ContentObserver•ContentObserver 是 Android 系统提供的一种观察者模式的实现,它允许应用程序监听特定 URI 的数据变化。
•通过 ContentObserver,开发者可以在数据发生变化时及时获取通知并进行相应的操作。
ContentObserver 的使用场景•数据库变化的监听:开发者可以使用 ContentObserver 监听指定数据库表中数据的插入、更新、删除等变化。
•文件系统变化的监听:开发者可以使用 ContentObserver 监听指定文件夹中文件的新增、删除、修改等变化。
•ContentProvider 的数据变化监听:开发者可以使用ContentObserver 监听指定 ContentProvider 中数据的变化。
ContentObserver 的基本使用方法1.创建继承自 ContentObserver 的子类,重写其 onChange() 方法。
在 onChange() 方法中定义数据变化时要进行的操作。
2.在需要监听数据变化的地方,使用 ContentResolver 的registerContentObserver() 方法注册 ContentObserver。
3.在合适的时机,调用 ContentResolver 的unregisterContentObserver() 方法取消注册。
ContentObserver 的注意事项•ContentObserver 不支持监听具体某一条数据的变化,只能监听整个数据集的变化。
•使用 ContentObserver 需要进行耗时操作时,应考虑使用线程或异步任务进行处理,避免阻塞主线程。
•对于监听外部应用程序数据变化的情况,需要在文件中申请相应的权限。
ContentObserver 的示例代码// 创建自定义 ContentObserver 子类public class MyContentObserver extends ContentObserver {public MyContentObserver(Handler handler) {super(handler);}@Overridepublic void onChange(boolean selfChange, Uri uri) {(selfChange, uri);// 数据变化时的操作("MyContentObserver", "Data changed: " + ());}}// 注册 ContentObserverContentResolver contentResolver = getContentResolver(); MyContentObserver contentObserver = new MyContentObserve r(new Handler());(uri, true, contentObserver);// 取消注册 ContentObserver(contentObserver);总结通过 ContentObserver,开发者可以方便地监听数据的变化,并在数据变化时进行相应的操作。
contentprovider和contentredolver的实例-回复ContentProvider和ContentResolver是Android中用于实现数据共享和数据访问的重要组件。
ContentProvider提供数据,并且支持对数据的增加、删除、修改和查询操作,而ContentResolver则负责对数据进行访问和操作。
本文将一步一步详细介绍ContentProvider和ContentResolver的使用方法和实例。
一、ContentProvider的使用方法和实例1. 创建ContentProvider要创建一个ContentProvider,需要继承ContentProvider类,并实现以下几个重要方法:onCreate、query、insert、update和delete。
下面是一个简单的示例:javapublic class MyContentProvider extends ContentProvider { private static final String AUTHORITY ="com.example.mycontentprovider";private static final Uri CONTENT_URI = Uri.parse("content:" + AUTHORITY + "/person");在此进行一些初始化操作@Overridepublic boolean onCreate() {return true;}查询数据@Overridepublic Cursor query(Uri uri, String[] projection, String selection, String[] selectionArgs, String sortOrder) {执行查询操作,返回Cursor}插入数据@Overridepublic Uri insert(Uri uri, ContentValues values) {执行插入操作,返回新插入数据的Uri}更新数据@Overridepublic int update(Uri uri, ContentValues values, String selection,String[] selectionArgs) {执行更新操作,返回受影响的行数}删除数据@Overridepublic int delete(Uri uri, String selection, String[] selectionArgs) {执行删除操作,返回受影响的行数}返回ContentProvider的MIME类型@Overridepublic String getType(Uri uri) {根据传入的Uri返回对应的MIME类型}}2. 注册ContentProvider在AndroidManifest.xml文件中注册ContentProvider,需要指定authority和path属性,示例如下:xml<providerandroid:name=".MyContentProvider"android:authorities="com.example.mycontentprovider"android:exported="true"android:readPermission="com.example.permission.READ"android:writePermission="com.example.permission.WRITE"> </provider>3. 使用ContentProvider使用ContentProvider的关键是借助ContentResolver类。
专利名称:CONTENT DELIVERY SYSTEM, CONTENTSERVER AND CONTENT DELIVERY METHOD发明人:SHIGETAKE, Hideki,TSUJI,Keisuke,KOMORIYA, Takahiro申请号:EP02724703.0申请日:20020507公开号:EP1391825A1公开日:20040225专利内容由知识产权出版社提供专利附图:摘要:To provide a contents distribution system, a contents server and a contents distribution method that do not need a layout operation at the time of distribution ofcontents and that enable a check of the content of image data that is hard to browse. When distribution of contents is requested from a contents display terminal to a contents server, a contents distribution server obtains the classification of the contents display terminal, and obtains text data and image letter data corresponding to a font size of terminal information via the contents management server. The contents distribution server couples the obtained image letter data and text data to generate a contents page, and distributes the contents page to the contents display terminal.申请人:Sharp Kabushiki Kaisha地址:22-22, Nagaike-cho, Abeno-ku Osaka-shi, Osaka 545-8522 JP国籍:JP代理机构:Brown, Kenneth Richard更多信息请下载全文后查看。
registercontentobserverasuser的调用registerContentObserver 是Android 中Context 类的一个方法,它允许一个ContentObserver 观察 Uri 指定的数据的变化。
这个方法常用于监听系统设置、联系人、短信等的变化。
registerContentObserver 方法的基本调用格式如下:javacontext.registerContentObserver(uri, observer);其中,uri 是你想要监听的 Uri,observer 是实现了 ContentObserver 接口的对象。
这个接口包含一个 onChange(boolean selfChange) 方法,当 uri 对应的数据发生变化时,这个方法会被调用。
下面是一个简单的例子,演示如何使用 registerContentObserver 来监听系统设置的变化:javapublic class MyApp extends Application {private ContentObserver mSettingsObserver = new ContentObserver(new Handler()) {@Overridepublic void onChange(boolean selfChange) {super.onChange(selfChange);// 更新UI或者执行其他操作}};@Overridepublic void onCreate() {super.onCreate();// 注册观察器观察设置变化Uri settingsUri = Settings.System.getUriFor(Settings.System.SCREEN_BRIGHTNESS);getContentResolver().registerContentObserver(settingsUri, false, mSettingsObserver);}}在这个例子中,我们创建了一个 ContentObserver,并在 onCreate 方法中注册它来观察系统亮度的变化。
contentful 应用场景
Contentful是一个内容管理平台,可以用于各种应用场景,包括但不限于:
1. 网站内容管理,Contentful可以帮助网站管理员轻松管理和更新网站内容,包括文章、图片、视频等多媒体内容,而无需深入了解网站开发技术。
2. 移动应用内容管理,开发移动应用的开发者可以使用Contentful来管理应用中的文本、图片和其他内容,而无需重新发布应用程序。
3. 跨平台内容发布,Contentful支持多种平台,可以用于发布内容到网站、移动应用、社交媒体等多个渠道,帮助用户实现一次发布,多平台展示。
4. 产品信息管理,电子商务网站可以使用Contentful来管理产品信息,包括价格、描述、图片等,以便在网站和移动应用中展示。
5. 多语言内容管理,Contentful支持多语言内容管理,可以帮助用户轻松地管理和发布多语言版本的内容。
6. 内容API,Contentful提供了灵活的内容API,可以与各种前端技术和框架集成,帮助开发者构建各种定制化的内容展示和交互应用。
总的来说,Contentful可以应用于任何需要管理和发布内容的场景,无论是网站、移动应用、电子商务还是其他类型的应用都可以受益于它的内容管理和发布功能。
CHINA CHEMICAL R EPORTER April 26, 200617Fiber MARKET REPORTReview and Prospect of the Spandex Market Revi ew of 20051. Raw mate rial market(1) Price reduction of raw materialsAfter the s us tained drastic price ris ein 2004, the price of Spandex raw m a-terials pure MDI (diphenylmethaned i i s o c y a n a te ) a n d P T M E G(po lytetram ethylene ether glycol) hada short-term increas e at the beginningo f 2005. It started to go down afterApril and co ntinued the reductio ntrend afterwards. T here was a differ-ence o f US$580 per to n between thehighes t average impo rt price o f pureMDI and the lowes t average im po rtprice at the end of 2005. The price re-ductio n o f raw m aterials lifted s om eo f the co s t pres s ure o n s pan dexproducers.Increas ing s upply and s lack de-m and are the m ain reas o ns for thepr ic e do w nt ur n o f s p and ex r awmaterials. T he s us tained price ris e ofMDI in 2004 led to a dras tic co st in-crease in downs tream sectors and a re-m arkable dem and gro wth s lo wdownin 2005. Bo th the capacity and the out-put of MDI in the world had a drasticgro wth during that period and theprice also had a ratio nal reductio n. T hedemand gro wth of PTMEG came down.The reduction of the o perating rate inspandex units in Korea and Japan alsoprom oted the s hift o f PT MEG supplyfrom o vers eas markets to the do mes-tic market and aggravated the marketcompetitio n. The price of PT MEG in thedom estic market therefore made a con-siderable reduction and was als o lo wer than the price in the internatio nal market. (2) Sustained increase of supply The capacity of pure MDI and PTMEG in China had a dras tic expans io n in 2005. Due to the co mpletion o f the 60tho us and t/a PT MEG by B ASF in Shanghai (CCR2005 No.10) and the 160 thous and t/a MDI unit in Ningbo,Z hejiang pro vince by Yantai Wanhua Polyurethane Co m pany at the end o f 2005, the capacity o f PTMEG and MDI reached 135 tho us and t/a and 280thousand t/a. Spandex raw materials in Chin a co uld ther efo r e be s el f-sufficient. Of course, mo st of the out-put fro m the new capacity was no t s upplied to the market in 2005.2. Spande x market (1) Price approaching cost Due to the concentrated s tart of pro -duction fo r mo st of the newly added capacity in 2004, the co m petitio n in the s pandex m arket was fiercer in 2005 and the price co ntinued with the declining trend. The elim inatio n o f ex-port quo tas for textiles at the begin-ning o f 2005 s tim ulat ed a dra s tic growth in the export o f almo st all tex-tiles and the dem and o f s pandex re-co vered rapidly. Due to the high inven-tory and the great wo rry o ver unduly rapid s upply growth caused by the pro-duction of the new capacity, however,on the o ther cast a shadow over the en-tire textile m arket. T he demand o f spandex also had a co nsiderable reduc-tio n and the situation that las ted till the end of 2005. Owing to the production res trictio n, the inventory was effec-tively co ntrolled and mo s t producers m anaged to achieve a balance be-tween pro ductio n and s ales in the fo urth quarter of 2005. T he price reduction m argin reached 30% for 20D spandex and 17% - 20% for 40D spandex in 2005. The price o f 40D spandex was below the production cost for mo st of the tim e in 2005 and the lo w price co nstituted the main reas on fo r the lo ss in producers. T he drastic price drop o f 20D spandex was caus ed by the existence of so me pro fit s pace,the increase in output propo rtion o f 20D spandex and the aggravated co m-petitio n in the market. (2) Suppl y deficit turning into surpl us capacity T he capacity o f s pandex in China reached 216 tho us and t/a in 2005, an increase o f 58.9% o ver 2004. T he new capacity was co ntributed by 5 majo r co ns um ptio n pro v inces incl uding S h a n do n g , J i a ng s u , Z h e ji a n g ,Guangdo ng and Fujian. The dry pro -cess was mo stly used in the spandex pro duction. The melt spinning process was only used in the sm all-scale expan-s io n of individual units. The co ncen-trated start of production fo r the newly added capacity in 2004 was the funda-mental reas on fo r the drastic price re-ductio n of spandex in 2005. The output of spandex in China was 110 500 tons in 2005, an increas e o f 10.5% over 2004. T he average o perating rate was only 51.2%. Main reas ons were as follows : (a) T he newly added capac-ity started to concentrate production atthe end of 2005. (b) The productio n re-strictio n m ade by spandex pro ducersin the s eco nd hal f o f 2005 helpedachieve an o utput co ntrol in the do mes-tic market.The apparent consumption of spa ndexthe price do wnturn appeared a t t h e t i m e o f d e m a n d increase. The oversupply did not change in m id-2005 and the pri ce o f 40D s pan dex started to drop below the co st.So me producers s uffered lo ss and o thers also had a produc-tio n res trictio n afterwards.T he textile trade frictio n be-tween China on o ne side and Europe and the United StatesFiber MARKET REPORTin China was 128 700 tons in 2005, an in-crease of only 0.2% over 2004.(3) Import reductionThe import amount o f spandex in China was 24 400 tons in 2005, a drop of 26. 7% from2004. Main reaso ns were as fo llows: (a) T he capacity in dom es tic producers had a sustained expansion and the supply amount in the domes tic market increased. (b) So me foreign com-panies continued to make local pro duc-tio n in China.The 5 major import sources of spandex in 2005 were the s ame as2004. The am ount imported fro m Korea and Tai-wan Pro vince was ho wever 49% and 36% lo wer than 2004 respectively. B e-sides the local production made by some Korea companies in China, another main reas on was that the capacity expansion of spandex in China caused medium and low-end products imported from abroad losing competitive e dge. The amount im-po rted from Japan, Singapore and the United States had no great changes. It showed that the mark et position of high-grade spandex im po rted from abro ad was still firm.(4) Export increaseThe export amount o f spandex in China was 6 227 to ns in 2005, an increas e of 27.7% over 2004. There were 9 new ex-po rt des tinatio ns fo r spandex in 2005 and the total number reached 53. T he amount exported to most of these coun-tries and regions increased. It s howed that dom estic enterprises s tarted their expansion to overseas m arkets.Prospect for 20061. Improvement ofmarket s ituationT he do wnturn trend in the China's spandex m arket is checked thro ugh pro ductio n res triction, the inventory i s g ra d u a l l y di g e s t e d a nd t h e imbalanced s upply/demand relation-ship is changed. The quality im prove-ment of dom estic spandex has stim u-China. If the operating rate can be wellco ntro lled and the product price can bestabilized, the s ituation in the spandexsector in China will hopefully im pro vein 2006.2. Slowdown of capacity growthT he capacity of spandex in China isexpected to reach aro und 223 tho u-s and t/a in 2006, an increase o f 3.2%o v er 2005and a per io d o f s tab legr o wth wi ll s tar t. T he o ut put o fspandex is expected to reach 125 tho u-s and to ns, an increase of 13.1% o ver2005. High-grade s pandex im po rtedfrom abroad will still maintain a s tablepos ition in the do mes tic m arket, butthe impo rt am ount o f spandex mayhave a s mall m arginal reduction. Do-m es tic enterpris es will actively ex-pand overs eas markets. B oth the priceand the quality of spandex pro ducedin China have already aro used inter-es t in m any dealers. T he export o fspandex therefo re had a sustained in-crease in the seco nd half o f 2005. T heexpo rt amo unt in 2006 is expected tohave reached 12 tho usand to ns with afurther drastic gro wth.T he apparent dem and of spandexin China can reach aro und 128 thou-sand tons in 2006, a drop of 0.5% from2005. T he reas on is that the co st in-creas e in textile pro ductio n and ex-po rt and uncertain facto rs such astrade frictions will inhibit the demandincrease.T he dem and i n Guangdo ng andFujian pro vinces will continue to havea high gro wth. Due to the lim ited ca-p ac i ty i n l o ca l a re a s,do m e s ti cs pandex pro ducers will put greatereffo rts in making s ales in Guangdo ngand Fujian pro vinces and the marketcom petition will be fiercer than otherregions. Due to the co ncentrated ca-pacity and the stable demand gro wth,the m arket in Jiangs u and Z hejiangpro vinces will m aintain a relativelys table.3. Intensified control on costand inventoryDu e to t he f ac to rs i n pr ic e an dcapacity, the co ntrol on co s t and in-vento ry will becom e a m ajo r tas k fo rspandex pro ducers. T he capacity ex-pans io n o f s pandex raw m aterialsPT MEG and pure MDI will prom ote afurther reductio n o f the pro ductio nco st in spandex pro ducers in 2006. Ifthe price can be s tabilized thro ughm arket tactics, the reductio n o f thepro ductio n cos t will increas e pro fitsin pro ducers.T he production res triction launchedby producers them selves will continuein 2006. If m eas u res are ta ken o nsales, s pandex producers can gradu-ally res to re normal o peration throughan effective contro l o f actual s ales co stand a succes sful reflux o f capital.After the s ales o f pro ducts, m o s ts pandex pro ducers let textile enter-pris es them s elves readjus t pro duc-t i o n p r o c e s s e s a c c o r d i n g t opro d ucts. Su ch m ark et m o de withs ellers ho lding the leading po s itio nwill s uffe r great im pact s fro m thes u rpl us ca pac it y i n 2006. T he i n-d u s t r i a l ref o r m a t i o n l a u n c h e dlat ely will lik ely m ake s ubs tant ialpro gres s in 2006. Spandex pro duc-ers with large s cale, lo w co s t anda bu n da nt ca p it al wi l l w in g r ea tm arket s hares.lated a market share increaseand such a trend will continuein 2006. As the product pricehas already approached theco st, the spandex productionin other S outheast Asian coun-tries will s tart to decline andthe o utput will go furtherdo wn. An opportunity for theexpans io n o f overs eas m ar-kets will therefore be providedto s pa nde x p ro d uce rs inn18 CHINA CHEMICAL REPORTER April 26, 2006。