Sunteți pe pagina 1din 3

Cuvintul cheie public este un modificator de acces pentru tipuri si membrii tipurilor.

Membrul este accesibil din afara definitiei clasei si a ierarhiei claselor derivate. Modificatorul static se utilizeaza pentru a declara un membru static, care apartine acestui tip si nu a unui obiect concret. Modificatorul static poate fi utilizat cu clase, metode, proprietati, evenimente si constructori, dar nu poate fi utilizat cu indexatori, destructori sau alte tipuri ca clasele Void nu se plaseaza in lista parametrilor unei metode. Void se utilizeaza intr-un context nesecurizat pentru a declara un pointer catre un tip necunoscut. Constructorul este o funcie care face parte din corpul unei clase. Corpul constructorului este format din instruciuni care se execut la crearea unui nou obiect al clasei respective (sau la crearea clasei, n cazul constructorilor cu modificatorul static). pot exista mai muli constructori care se pot diferenia prin lista lor de parametri constructorii nu pot fi motenii dac o clas nu are definit niciun constructor, se va asigna automat constructorul fr parametri al clasei de baz (clasa object, dac nu este precizat clasa de baz)

Instanierea presupune declararea unei variabile de tipul clasei respective i iniializarea acesteia prin apelul constructorului clasei (unul dintre ei, dac sunt definii mai muli) precedat de operatorul new. O interfata defineste un set de metode care vor fi implementate de una sau mai multe clase. O interfata nu implementeaza metode ci doar precizeaza ce anume va contine o clasa care implementeaza interfata. Din punct de vedere sintactic, interfetele sunt similare claselor abstracte. Insa, exista mai multe aspecte care le diferentiaza. Spre exemplu: daca in clasele abstracte unele metode erau implementate iar altele nu, in cazul interfetelor toate metodele nu pot avea corp (nu sunt implementate). O interfata poate contine doar: metode, proprietati, evenimente si indexari. Interfetele nu pot contine variabile, constructori sau destructori. De asemenea, daca o clasa nu poate mosteni decat o clasa, in schimb o clasa poate implementa oricate interfete. De asemenea, o interfata poate fi implementata de oricate clase. Asadar, este posibil ca doua clase sa implementeze aceeasi interfata in moduri diferite. Daca o clasa implementeaza o interfata atunci aceasta trebuie sa implementeze toti membrii interfetei. Prin intermediul interfetelor, limbajul C# permite beneficierea la maximum de aspectul o singura interfata mai multe metode al polimorfismului. An intent is an abstract description of an operation to be performed. It can be used with startActivity to launch an Activity, broadcastIntent to send it to any interested BroadcastReceiver components, and startService(Intent) or bindService(Intent, ServiceConnection, int) to communicate with a background Service. An Intent provides a facility for performing late runtime binding between the code in different applications. Its most significant use is in the launching of activities, where it can be thought of as the glue between activities. It is basically a passive data structure holding an abstract description of an action to be performed. Activities An activity represents a single screen with a user interface. For example, an email application might have one activity that shows a list of new emails, another activity to compose an email, and another activity for reading emails. Although the activities work together to form a cohesive user experience in the email application, each one is independent of the others. As such, a different application can start any one of these activities (if the email application allows it). For example, a camera application can start the activity in the email application that composes new mail, in order for the user to share a picture. An activity is implemented as a subclass of Activity and you can learn more about it in the Activitiesdeveloper guide.

Services A service is a component that runs in the background to perform long-running operations or to perform work for remote processes. A service does not provide a user interface. For example, a service might play music in the background while the user is in a different application, or it might fetch data over the network without blocking user interaction with an activity. Another component, such as an activity, can start the service and let it run or bind to it in order to interact with it. A service is implemented as a subclass of Service and you can learn more about it in the Servicesdeveloper guide. During the life of an activity, the system calls a core set of lifecycle methods in a sequence similar to a step pyramid. That is, each stage of the activity lifecycle is a separate step on the pyramid. As the system creates a new activity instance, each callback method moves the activity state one step toward the top. The top of the pyramid is the point at which the activity is running in the foreground and the user can interact with it. As the user begins to leave the activity, the system calls other methods that move the activity state back down the pyramid in order to dismantle the activity. In some cases, the activity will move only part way down the pyramid and wait (such as when the user switches to another app), from which point the activity can move back to the top (if the user returns to the activity) and resume where the user left off. Figure 1. A simplified illustration of the Activity lifecycle, expressed as a step pyramid. This shows how, for every callback used to take the activity a step toward the Resumed state at the top, there's a callback method that takes the activity a step down. The activity can also return to the resumed state from the Paused and Stopped state. Depending on the complexity of your activity, you probably don't need to implement all the lifecycle methods. However, it's important that you understand each one and implement those that ensure your app behaves the way users expect. Implementing your activity lifecycle methods properly ensures your app behaves well in several ways, including that it:

Does not crash if the user receives a phone call or switches to another app while using your app. Does not consume valuable system resources when the user is not actively using it. Does not lose the user's progress if they leave your app and return to it at a later time. Does not crash or lose the user's progress when the screen rotates between landscape and portrait orientation. As you'll learn in the following lessons, there are several situations in which an activity transitions between different states that are illustrated in figure 1. However, only three of these states can be static. That is, the activity can exist in one of only three states for an extended period of time: Resumed In this state, the activity is in the foreground and the user can interact with it. (Also sometimes referred to as the "running" state.) Paused In this state, the activity is partially obscured by another activitythe other activity that's in the foreground is semi-transparent or doesn't cover the entire screen. The paused activity does not receive user input and cannot execute any code. Stopped In this state, the activity is completely hidden and not visible to the user; it is considered to be in the background. While stopped, the activity instance and all its state information such as member variables is retained, but it cannot execute any code.

The other states (Created and Started) are transient and the system quickly moves from them to the next state by calling the next lifecycle callback method. That is, after the system calls onCreate(), it quickly callsonStart(), which is quickly followed by onResume(). That's it for the basic activity lifecycle. Now you'll start learning about some of the specific lifecycle behaviors.

An activity is a single, focused thing that the user can do. Almost all activities interact with the user, so the Activity class takes care of creating a window for you in which you can place your UI with setContentView(View). While activities are often presented to the user as full-screen windows, they can also be used in other ways: as floating windows (via a theme with windowIsFloating set) or embedded inside of another activity (using ActivityGroup). There are two methods almost all subclasses of Activity will implement:

onStop()

Called when the activity is no longer visible to the user, because another activity has been resumed and is covering this one. This may happen either because a new activity is being started, an existing one is being brought in front of this one, or this one is being destroyed. Followed by either onRestart() if this activity is coming back to interact with the user, oronDestroy() if this activity is going away.

Android Manifest Editor Edit Android manifests with a simple graphical interface. This editor is invoked when you open anAndroidManifest.xml file. Application Programming Interface- Conceptul general de API are dou interpretri principale. Acesta este folosit pentru a desemna att un API server-side pe un server de web, precum i API client-side ntr-un browser web. Server-side: - Un web API pe partea de server este o interfa de programare a unui sistem de mesaj de solicitare-rspuns definit, de obicei, exprimat n JSON sau XML, care este expus, prin intermediul site-cel mai frecvent prin intermediul unui server de web de tip HTTP. Client-side: - Exist o serie de API-uri web client-pri care au fost dezvoltate (viznd mai ales legturile JavaScript standardizate pentru funcionalitatea ntr-un browser web).

S-ar putea să vă placă și