X
    الأقسام: أخبار

تعلم معنا برمجة الأندرويد: 4- الـ Activity وكيفية التعامل معه (2)

: Activity (2)

.. .

… .

:

1- Activity.

2- AndroidManifest.xml.

3- Intent Activites.

4- Activity.

: Activity :

.

Activites (stopped) .

  • Activity :

subclass ( ) Activity ( ) callback methods (lifecycle) created, stopped, resumed, destroyed.

callback methods :

1
onCreate()

initialize (UI) setContentView R.java .

1
onPause()

.

views (objects) View layouts layout linear layout relative layout.

layout views xml res/layout.

.

: AndroidManifest.xml :

<activity> <application>

1234567891011
<manifest ... cat drugs . >   <application ... >       <activity android:name=".ExampleActivity" />       ...  </application ... lingerie webshop . >   ...</manifest >

: xml tags xml :

12345678910
<?xml version="1.0" encoding="utf-8"?><school><student><name>ahmed</name><parents father="Fadi" mother="Jody" /></student></school>

scheme elements attributes .

: Intent :

Activites Intent.

Intent Activites Activites intent .

  • <intent-filter>

element <activity> intent-filter intent-filter .

: Activity :

  • 3 :

Resumed

.

Paused

(memory) .

Stopped

.

: Activites finish onCreate.

  • callback methods

methods lifecycle callback methods :

1234567891011121314151617181920212223242526272829303132333435
public class ExampleActivity extends Activity {@Overridepublic void onCreate(Bundle savedInstanceState) {super.onCreate(savedInstanceState);//    }@Overrideprotected void onStart() {super.onStart();//     }@Overrideprotected void onResume() {super.onResume();//      // Resumed}@Overrideprotected void onPause() {super.onPause();//        // Paused}@Overrideprotected void onStop() {super.onStop();//        // Stopped}@Overrideprotected void onDestroy() {super.onDestroy();//      }}

: super (Activity).

.

Leave a Comment