Related Topics

What is Mobile Computing in Hindi?

Brief history of mobile technology in Hindi

Mobile Phone Generations in Hindi

The Mobile Ecosystem in Hindi

Types of Mobile Applications in Hindi

Mobile Information Architecture in Hindi

Android Versions in Hindi

Features of Android in Hindi

Android Architecture in Hindi

Installing Android SDK Tools in Hindi

Configuring Android in Eclipse IDE in Hindi

Android Development Tools (ADT) in Hindi

Creating Android Virtual Devices (AVD) in Hindi

Creating First Android Application in Hindi

Anatomy of Android Application in Hindi

Deploying Android App on USB Connected Android Device in Hindi

Android Application Components in Hindi

Android Activities in Hindi

Exploring Intent Objects in Hindi

Linking Activities Using Intents in Hindi

Android Fragment Lifecycle in Hindi

Android UI Layouts in Hindi

Adapting to Display Orientation in Android in Hindi

Action Bar in Android in Hindi

Android Alarm Manager in Hindi

Displaying Analog & Digital Clocks in Android in Hindi

Event Handling in Android in Hindi

Android Menus in Hindi

Data Storage Options in Android in Hindi

External Storage in Android in Hindi

Content Providers in Android in Hindi

Views in Android in Hindi

Button in Android in Hindi

Toast in Android in Hindi

ToggleButton in Android in Hindi

CheckBox in Android in Hindi

RadioButton in Android in Hindi

Spinner in Android in Hindi

WebView in Android in Hindi

EditText in Android in Hindi

DatePicker in Android in Hindi

TimePicker in Android in Hindi

ListView in Android in Hindi

ProgressBar in Android in Hindi

Handling UI Events in Android in Hindi

ListFragment in Android in Hindi

DialogFragment in Android in Hindi

Context in Android in Hindi

Popup in Android in Hindi

ImageView in Android in Hindi

ImageSwitcher in Android in Hindi

AlertDialog in Android in Hindi

AlarmManager in Android in Hindi

SMS in Android in Hindi

E-mail in Android in Hindi

MediaPlayer in Android in Hindi

Using Camera in Android in Hindi

Video Recording in Android in Hindi

Telephony Manager in Android in Hindi

Android SQLite Database in Hindi

SQLite database operations in Hindi

Publishing Android Applications in Hindi

Deploying APK Files in Android in Hindi

Related Subjects

Android Activity Life Cycle in Hindi

RGPV University / DIPLOMA_CSE / MOBILE COMPUTING

Android Activity Life Cycle in Hindi

Android Activity Life Cycle Android application development ka ek important concept hai. Jab aap ek Android app banate hain, toh aapko Activity ke life cycle ko samajhna zaruri hota hai, kyunki isse app ka behavior aur performance control hota hai. Activity ka life cycle aapko ye samjhata hai ki app ke different states kaise kaam karte hain aur user ka interaction kaise manage hota hai. Is blog mein hum activity life cycle ke baare mein detail mein janenge, jaise ki har state aur methods jo us state ko handle karte hain.

Android Activity Life Cycle in Hindi

Android Activity Life Cycle ek important concept hai jo har Android developer ko samajhna zaruri hota hai. Jab bhi hum kisi Android application ko develop karte hain, tab Activity ke different states ko handle karna padta hai. Activity ek aisi unit hoti hai jo user interface ko represent karti hai, aur uske life cycle ko samajhkar hum apne application ko optimize kar sakte hain. Iske madhyam se hum yeh samajh paate hain ki application kab start hoti hai, kab pause hoti hai, aur kab finish hoti hai, jisse user ka experience behtar ho sakta hai.

Activity Life Cycle ke Stages

Activity Life Cycle mein kuch important states hoti hain jo har Activity ke different stage mein trigger hoti hain. In states ko samajhna important hai kyunki inhi ke through app ki functioning aur performance kaafi influence hoti hai.

  • onCreate(): Jab Activity ka instance create hota hai, tab onCreate method call hota hai. Yeh method initial setup ke liye hota hai jisme UI elements ko set karna, data load karna, aur initializations perform kiye jate hain. Is stage par app ke liye sabse pehle activity ka layout load hota hai.
  • onStart(): Jab Activity visible ho jati hai, tab onStart method call hota hai. Iska matlab hai ki Activity screen par aa gayi hai lekin abhi user ke saath interact nahi kar rahi hoti. Yeh method Activity ke start hone ke baad turant call hota hai.
  • onResume(): Jab Activity user ke saath interact karne ke liye ready hoti hai, tab onResume method call hota hai. Is stage par app user ke interaction ke liye fully ready ho jaata hai. Jab bhi Activity ko foreground me lana hota hai, tab onResume call hota hai.
  • onPause(): Jab Activity kisi aur activity ke saath replace hoti hai ya app background me jata hai, tab onPause method call hota hai. Is stage par aapko apne resources ko release kar dena chahiye jise app ko background me hone par koi unwanted activity na ho.
  • onStop(): Jab Activity background me chali jati hai ya screen se completely disappear ho jaati hai, tab onStop method call hota hai. Is state me app ke resource ko free karna aur unwanted memory use ko minimize karna zaruri hota hai.
  • onRestart(): Jab Activity ko background se dobara foreground me laana hota hai, tab onRestart method call hota hai. Is method mein app ko dobara se resume hone ke liye ready kiya jaata hai, jaise ki data reload karna ya state ko restore karna.
  • onDestroy(): Jab Activity completely finish ho jati hai, tab onDestroy method call hota hai. Yeh last stage hoti hai jahan aap apne resources ko release karte hain aur Activity ko destroy karte hain. Jab user application se exit karta hai, ya Activity ko terminate karte hain, tab yeh method call hota hai.

Activity Life Cycle ke Methods

Android mein Activity Life Cycle ko manage karne ke liye kuch methods diye gaye hain. Yeh methods aapko har stage ke dauran kuch specific tasks perform karne mein madad karte hain. In methods ko samajhkar aap apne app ka behavior efficiently control kar sakte hain.

  • onCreate(): Activity ke initial setup ke liye yeh method call hota hai. Yeh method generally initialization tasks ke liye hota hai, jisme UI components ko set karna, initial data load karna, aur activity ko initialize karna shamil hai.
  • onStart(): Yeh method activity ke visible hone ke baad call hota hai. Is stage par activity user ko dikhti hai, lekin user interaction kaafi limited hota hai. Agar activity ko kisi aur activity se replace kiya gaya hai, to yeh method call hota hai.
  • onResume(): Jab activity completely interactive ho jaati hai, tab yeh method call hota hai. Yeh method typically user interaction ke liye hota hai, jab aapko apni app ko foreground me laake user ko interact karne dena hota hai.
  • onPause(): Jab activity ko temporarily background me bheja jaata hai, tab onPause method execute hota hai. Yeh method important hai kyunki aapko activity ka state save karna hota hai aur resource management ko dhyan mein rakhte hue activity ko pause karna hota hai.
  • onStop(): Jab activity background mein chali jati hai ya screen se completely disappear hoti hai, tab onStop method call hota hai. Is stage mein aapko activity ke memory resources ko free karna hota hai, jisse app performance achha rahe.
  • onRestart(): Jab activity ko dobara foreground mein laana hota hai, tab onRestart method call hota hai. Yeh method activity ko background se dobara start karne ka kaam karta hai.
  • onDestroy(): Jab activity ko terminate karna hota hai, tab onDestroy method call hota hai. Yeh method sabse last stage hota hai, jisme aap activity ke resources ko clean up karte hain aur memory ko free karte hain.

Activity States in Android in Hindi

Activity States Android app development ka ek important concept hai. Jab bhi hum Android app banate hain, Activity ke different states hote hain, jo app ki functioning ko manage karte hain. Har activity apne lifecycle ke dauran alag-alag states mein hoti hai, jaise ki 'started', 'resumed', 'paused', etc. Ye states app ko optimize karne mein madad karti hain, jisse user ka experience bhi behtar ho sake. Aaj hum in states ke baare mein detail mein samjhenge.

Activity States ki Overview

Android Activity ko ek specific order mein states se guzarna padta hai. Har state ka apna role hota hai, aur yeh states app ke behavior ko control karti hain. Activity ka state change karte waqt, kuch methods call hote hain jo us state ko handle karte hain. Inko samajhna zaruri hai, taaki aap apne app ko efficiently manage kar sakein.

  • Active/Running State: Jab Activity user ke saamne hoti hai aur usse interact kiya ja raha hota hai, tab activity active ya running state mein hoti hai. Is state mein activity screen par fully visible hoti hai aur user ke interactions ko process karti hai. Jab activity foreground mein hoti hai, tab onResume method call hota hai aur activity active hoti hai.
  • Paused State: Jab activity visible nahi hoti, lekin abhi bhi memory mein hoti hai, tab activity paused state mein hoti hai. Yeh tab hota hai jab user kisi dusri activity mein jata hai lekin activity ko completely destroy nahi kiya gaya hota. Is state mein onPause method call hota hai. Activity ab bhi memory mein hoti hai, lekin user se interact nahi kar rahi hoti.
  • Stopped State: Jab activity completely background mein chali jati hai, tab activity stopped state mein hoti hai. Is state mein activity screen se completely disappear ho jaati hai aur system resources ko free karna zaruri hota hai. Jab activity stop hoti hai, to onStop method call hota hai. Is state mein activity memory mein hoti hai, lekin user se interaction nahi ho raha hota.
  • Destroyed State: Jab activity completely terminate ho jati hai, tab activity destroyed state mein hoti hai. Yeh state tab hoti hai jab user activity ko close kar deta hai ya system apne resources ko release kar raha hota hai. Is state mein activity ka instance remove kar diya jata hai aur memory release ho jaati hai. Jab activity ko destroy kiya jata hai, tab onDestroy method call hota hai.
  • Background State: Jab activity foreground se background mein jati hai, to yeh state background state kehlati hai. Is state mein activity visible nahi hoti lekin abhi bhi running state mein hoti hai. Agar activity ko resume karna hai, to onRestart method call hota hai. Background state mein app ko background processes perform karne ka time milta hai.

Activity States aur Methods

Activity ki states ko handle karne ke liye Android mein kuch important methods diye gaye hain. Yeh methods har state ke dauran activity ko manage karte hain aur app ke performance ko optimize karte hain. In methods ka use karke hum activity ka behavior efficiently control kar sakte hain. Ab hum in methods ko detail mein samajhte hain.

  • onCreate(): Jab activity create hoti hai, tab onCreate method call hota hai. Is method mein hum initial setup karte hain, jaise ki UI elements ko setup karna aur activity ko initialize karna. Yeh method pehli baar activity ko create karne par call hota hai aur app ke starting phase ko handle karta hai.
  • onStart(): Jab activity screen par visible hoti hai lekin abhi user ke saath interact nahi kar rahi hoti, tab onStart method call hota hai. Yeh method activity ke start hone ke baad trigger hota hai aur activity ko ready karta hai user interaction ke liye.
  • onResume(): Jab activity user ke saath interact karne ke liye ready hoti hai, tab onResume method call hota hai. Yeh method activity ke foreground mein aane par call hota hai aur user ke interaction ke liye activity ko fully ready kar deta hai.
  • onPause(): Jab activity ko temporarily background mein bheja jaata hai, tab onPause method call hota hai. Yeh method us time call hota hai jab user kisi dusri activity mein switch karta hai aur current activity ko pause kar diya jata hai.
  • onStop(): Jab activity completely background mein chali jaati hai, tab onStop method call hota hai. Yeh method app ke memory resources ko free karne aur unnecessary operations ko band karne ke liye important hota hai.
  • onRestart(): Jab activity ko background se dobara foreground mein lana hota hai, tab onRestart method call hota hai. Yeh method activity ko resume karne ke liye use hota hai jab activity ko user dobara active karta hai.
  • onDestroy(): Jab activity ko completely destroy karna hota hai, tab onDestroy method call hota hai. Yeh method sabse last stage hota hai jahan activity apne resources ko release karti hai aur apni memory ko free karti hai.

Methods in Activity Life Cycle in Hindi

Android Activity life cycle ke dauran kuch important methods hote hain jo activity ke state transitions ko handle karte hain. Ye methods app ki activity ko manage karte hain aur ensure karte hain ki app smoothly chal raha ho. Har method ka ek specific role hota hai aur uska use different stages mein hota hai. Aaj hum in methods ko detail mein samjhenge aur dekhenge ki kaise ye methods activity ke state ko efficiently control karte hain.

Methods in Activity Life Cycle

Activity life cycle ke dauran kuch essential methods hoti hain jo activity ke har phase ko manage karne ka kaam karti hain. Har method ka specific timing aur use-case hota hai, jisse activity ko control kiya jaata hai. Aapko in methods ko samajhna bahut zaruri hai, kyunki inhi ke zariye activity ko handle kiya jaata hai. In methods ko use karke aap apne app ki performance ko improve kar sakte hain.

  • onCreate(): Jab activity pehli baar create hoti hai, to onCreate method call hota hai. Is method mein hum activity ke UI elements ko setup karte hain aur initial configurations karte hain. Yeh method ek baar hi call hota hai jab activity user ke saamne aati hai. Yeh method initialization ke liye bahut zaroori hota hai, jahan hum activity ki initial settings ko configure karte hain.
  • onStart(): Jab activity screen par visible ho jaati hai, lekin abhi user ke saath interact nahi kar rahi hoti, tab onStart method call hota hai. Yeh method activity ke start hone par trigger hota hai. Is stage mein activity fully visible hoti hai, lekin foreground mein nahi hoti. Jab activity foreground mein nahi hoti, tab onStart method isse background se foreground mein laane mein madad karta hai.
  • onResume(): Jab activity user ke interaction ke liye fully ready ho jaati hai, tab onResume method call hota hai. Is method ka role hai activity ko active banana aur user ke input ke liye ready karna. Jab activity screen par aati hai aur user ke interaction ko accept karti hai, to onResume method trigger hota hai. Yeh method activity ko foreground mein active mode mein dalne ke liye responsible hota hai.
  • onPause(): Jab activity temporarily background mein chali jaati hai, tab onPause method call hota hai. Is method mein hum activity ko pause karte hain aur usse background mein chhupane ke liye prepare karte hain. Jab user kisi dusri activity par switch karta hai, ya app ko minimize karta hai, tab activity ko pause kar diya jaata hai. Yeh method un tasks ko handle karta hai jo activity ke background mein jaane ke baad perform kiye jaate hain, jaise ki unimportant processes ko stop karna.
  • onStop(): Jab activity completely background mein chali jaati hai aur user ke liye invisible ho jaati hai, tab onStop method call hota hai. Is method mein hum activity ko completely stop karte hain aur resources ko free karte hain. Jab user activity ke saath interact nahi kar raha hota, tab onStop method execute hota hai, jisse activity ke unnecessary resources release ho jaate hain. Yeh method memory management ke liye bahut zaroori hota hai.
  • onRestart(): Jab activity background se dobara foreground mein aati hai, tab onRestart method call hota hai. Is method mein hum activity ko resume karte hain aur user ke liye activity ko fir se available bana dete hain. Jab activity ko restart karna hota hai, ya user activity ke saath dobara interact karna chahta hai, to onRestart method execute hota hai. Yeh method activity ko fir se interact karne ke liye ready karne ka kaam karta hai.
  • onDestroy(): Jab activity completely destroy hoti hai aur memory se remove kar di jaati hai, tab onDestroy method call hota hai. Is method ka use activity ke resources ko release karne ke liye hota hai, jaise ki memory allocation ko free karna. Yeh method un processes ko terminate karta hai jo activity ke during running hoti hain. Jab activity ko close karna hota hai, ya user activity ko fully terminate karna chahta hai, tab onDestroy method execute hota hai.

FAQs

onCreate method activity creation ke dauran call hota hai. Yeh method sabse pehle activity ko initialize karta hai, jahan pe hum activity ke UI components ko setup karte hain aur initial configurations ko define karte hain. Yeh method ek baar hi execute hota hai jab activity pehli baar user ke saamne aati hai.
onStart method activity ke screen par visible hone par call hota hai. Yeh method activity ko user ke liye visible banaata hai, lekin uss samay tak activity foreground mein nahi hoti. Is method mein hum activity ko visible banane ke baad user ke liye ready karte hain.
onResume method tab call hota hai jab activity foreground mein fully active ho jaati hai aur user ke saath interact karne ke liye ready hoti hai. Yeh method activity ko foreground mein active banaata hai, taaki user ke inputs ko receive kar sake. Is method ke baad activity user ke liye fully functional ho jaati hai.
onPause method activity ke temporarily background mein jaane par call hota hai. Jab activity kisi doosri activity ko display karti hai ya app minimize hota hai, to onPause method use hota hai. Is method mein hum activity ko pause kar dete hain aur uske unnecessary tasks ko rok dete hain.
onStop method activity ke background mein completely chali jaane par call hota hai. Is method mein hum activity ko completely background mein bhej dete hain aur uske resources ko release karte hain. Jab user activity ke saath interact nahi kar raha hota, tab is method ka use hota hai.
onDestroy method activity ke complete destruction ke dauran call hota hai. Jab activity ko fully terminate karna hota hai, to yeh method execute hota hai. Is method mein hum activity ke resources ko free karte hain aur un processes ko terminate karte hain jo activity ke dauran running thi.

Please Give Us Feedback