Welcome to

w3study.github.io




Activities and activity lifecycle

Activity क्या होती है?

Activity को क्यों Use किया जाता है?

Activity की मुख्य विशेषताएँ

Activity का Basic Example (Code और XML Layout)

Java/Kotlin में Activity (MainActivity.java)

import android.os.Bundle;
import androidx.appcompat.app.AppCompatActivity;
import android.widget.TextView;

public class MainActivity extends AppCompatActivity {
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main); // XML Layout को Set करना

        TextView textView = findViewById(R.id.textView);
        textView.setText("Hello, Android Activity!");
    }
}

Activity का XML Layout (activity_main.xml)

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical"
    android:padding="16dp">

    <TextView
        android:id="@+id/textView"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="Welcome to Activity!"
        android:textSize="20sp"/>
</LinearLayout>

Activity Lifecycle in Hindi

Activity Lifecycle क्या होता है?

Activity Lifecycle वह प्रक्रिया है जो यह निर्धारित करती है कि Android App की एक Activity कब Create, Start, Pause, Resume और Destroy होती है।

हर Activity का एक निश्चित Lifecycle (जीवन चक्र) होता है, जिसे Android System Manage करता है।

Activity Lifecycle के 7 मुख्य चरण (Stages of Activity Lifecycle)

1. onCreate() – Activity का निर्माण (Initialization Stage)

Example: जब हम पहली बार WhatsApp खोलते हैं, तो Home Screen Load होती है।

2. onStart() – Activity Visible होती है

Example: जब हम WhatsApp को Recent Apps से फिर से खोलते हैं।

3. onResume() – Activity User Interaction के लिए तैयार होती है

Example: जब हम WhatsApp में Chats Open करके Scroll करते हैं।

4. onPause() – Activity Background में जाने वाली होती है

Example: जब हम WhatsApp से बाहर जाकर Instagram Open करते हैं।

5. onStop() – Activity पूरी तरह से Background में चली जाती है

Example: जब हम WhatsApp को Minimize करके Home Screen पर आ जाते हैं।

6. onRestart() – Activity दुबारा से Start होती है

Example: जब हम WhatsApp को Recent Apps से दोबारा खोलते हैं।

7. onDestroy() – Activity पूरी तरह से Destroy हो जाती है

जब Activity को पूरी तरह से Memory से हटा दिया जाता है, तो यह Method Call होता है।

यह तब होता है जब:

यहाँ हम सभी Resources (Database, Background Tasks, Threads) को Free कर सकते हैं।

Example: जब हम WhatsApp को Close कर देते हैं या Android System Low Memory के कारण इसे हटा देता है।

  • Permission System in Hindi

  • Development of Android Applications Notes in Hindi


  • Request:

    हैलो दोस्तों! उम्मीद करता हूं आपको हमारा यह content/post पसंद आया होगा। अगर आपको हमारा ये content/post पसंद आई हो तो अपने दोस्तों के पास भी share करे। और अगर आपको कोई problem या कोई specific content हिन्दी में चाहिए है तो आप हमें नीचे दिए गए Email या whatsapp number के जरिए बता सकते है।

    अगर आप CCC/diploma/polytechnic/MCA/BCA etc कर रहे है तो ये website स्पेशली आपके लिए ही है, जो student हिंदी में पढ़ाई करते है।

    Contact Us

    Email: deepanshuranjan8057@gmail.com

    Whatsapp: +91 8057754706



    Follow Us

    Facebook Logo    Instagram Logo