Menu

Related Topics

HTML CSS JavaScript PHP Node.js React.js C C++ Go Rust Swift Python Java Excel MS Word PowerPoint
Search

First Android Sample Application (Hello World App)

अगर आप Android Development सीखना चाहते हैं, तो सबसे पहला कदम एक Basic Android Application बनाना होता है। यहां हम Hello World App बनाएंगे, जो Android Studio में आसानी से run हो सके।

1. Prerequisites (जरूरी चीजें)

इस app को बनाने के लिए आपके पास निम्नलिखित चीजें होनी चाहिए:

2. नया Android Project बनाना

Android Studio खोलें और "New Project" पर क्लिक करें।

Empty Activity टेम्पलेट चुनें और Next पर क्लिक करें।

नीचे दी गई जानकारी भरें:

Finish पर क्लिक करें।

3. MainActivity.java (App का Main Code)

यह कोड MainActivity.java फाइल में होता है, जो ऐप का मुख्य भाग है।

package com.example.helloworld;

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

public class MainActivity extends AppCompatActivity {
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);

        // TextView को अपडेट करना
        TextView textView = findViewById(R.id.textView);
        textView.setText("Hello, World!");
    }
}

4. Layout File (activity_main.xml)

यह फाइल res/layout/activity_main.xml में होती है और UI को define करती है।

<?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:gravity="center"
    android:padding="16dp">

    <TextView
        android:id="@+id/textView"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="Welcome!"
        android:textSize="24sp"
        android:textStyle="bold"
        android:textColor="#000000"/>

</LinearLayout>

5. Manifest File (AndroidManifest.xml)

यह फाइल ऐप की configuration को define करती है।

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.example.helloworld">

    <application
        android:allowBackup="true"
        android:icon="@mipmap/ic_launcher"
        android:label="Hello World App"
        android:theme="@style/Theme.AppCompat">

        <activity android:name=".MainActivity">
            <intent-filter>
                <action android:name="android.intent.action.MAIN"/>
                <category android:name="android.intent.category.LAUNCHER"/>
            </intent-filter>
        </activity>

    </application>

</manifest>

6. App को Run करना

Android Emulator चलाएं (या USB Debugging ऑन करके फोन connect करें)।

Run App Button ( ) दबाएं।

App खुलेगा और screen पर "Hello, World!" दिखाई देगा।



Page Views
0
Visit ID
Not tracked yet
Visit Time
-
Time on Page
0 seconds

Request


Leave a Comment


INITIALIZING...


INITIALIZING...


Quizzes in Hindi

GK Online Quiz in Hindi 10 pages
HTML Online Quiz in Hindi 10 pages
CSS Online Quiz in Hindi 10 pages
JavaScript Online Quiz in Hindi 10 pages
CCC Online Quiz in Hindi 10 pages
History Online Quiz in Hindi 10 pages



Comments Total: 0 comments

📰 Latest Articles

Total: 0 Articles

Featured Products

0 Products 0 Loaded 0 Remaining

All Products Loaded!

You've reached the end of our collection.

Contact Us Form