Example : How to Create a New Project/Android Apps First Time in Android Studio(version Koala 2024.1.1)?
				
					Open a well set and properly configured Android Studio - Choose 'Projects' - Choose 'New Project' - Choose 'Phone and Tablet' templates - Choose 'Empty Views Activity' templates - Next - Put the Project/Application Name (by default My Application) - choose 'Save Location' to save the project - choose Language 'Java or Kotlin' - chosse minimum versions of SDK or Android os from where we want to applied this app. - Finish - Android Application opens with two major files, one for design purpose (main_activity.xml) and other for coding operations (MainActivity.java).
				
			
Example : How to change the Font and Font Size in an Android application?
				
					Open Android Application/Project
File menu - Settings - Editor option - Font - Set the Font and Size - Ok.
				
			
Example : How to change the Theme in an Android application?
				
					Open Android Application/Project.
File menu - Settings - Editor option - Color Scheme - Scheme - choose the desired theme from the list - Ok.
				
			
Example : How to Add a New Android Emulator/Virtual Device to an existing Android application/Project to see the Output/Result?
				
					Open an Android Application first - click 'Tools' menu - click on 'Device Manager' 
click 'add a new device' - choose 'Create Virtual Device'
choose a phone name from 'Phone' list' as Android Emulator to see the result - click 'Next' - choose the 'API' list - Next - Finish (certain downloads and installation will continue).
The selected phone emulator appeared in the 'Device Manager' list and is ready for displaying the result.
				
			
Example : How do we add a Physical device/Smartphone to an existing Android application/project to see the output/result?
				
					Open an Android Application first - click 'Tools' menu - click on 'Device Manager' 
click 'Pair Devices Using Wi-Fi' from the appeared list as Wi-Fi symbol
choose anyone 'Pair using QR Code'/ 'Pair using pairing code' option
Now scan the appeared QR code when we choose 'Pair using QR Code' option through your mobile/smartphone ( for this your smartphone should be with Android OS 10/11 or above and with 'Wireless debugging' mode enabled)

-----------------------------------------------
NB: 

To enable 'Wireless debugging' in your mobile/smartphone - goto 'Settings' in your mobile
Tap 'About phone' or 'About device' or 'My Phone' option
Tap 'Software information',if present otherwise Tap 'Build number' option 7 times continuously
Enter your pattern, PIN, or password if any, to enable the 'Developer options' menu
Use 'Back' option and tap 'System' menu to see the appeared "Developer options" in your menu list 
Now Tap the 'Developer options' - search the list and Tap 'Wireless debugging' option
Now ON/enabled your 'Wi-Fi' network of your smartphone
Again tap 'Wireless debugging' option and tap 'Pair device with QR code' or 'Pair using pairing code' option 
Now scan the QR code appeared in the Android Application - wait few moment, your mobile/smartphone will be connected to your Android Application
After successfully connected, choose it during the running of your Android Application and see the result on your phone/smartphone.

-----------------------------------------------

To Disable the Developer option for Security purpose After the completion of your work:-

Settings - System - click on 'Developer options' - Turn off the slider button of 'Use Developer options'- Restart you phone.
Developer options Disabled.



				
			
Example : How to Run an Android application of an existing Project?
				
					Open an Android Application - 'Run'  menu - click 'Run app' option (Shift+F10).

                        OR

Click on 'Run app' Play button on the standard toolbar.

NB: Android app data is automatically saved during Run process.
				
			
Example : How do we Create/Add different types of String Messages for use in an existing Android Application?
				
					Path : click 'app' option in the left pane/side window in an open android application - Open/click 'res' (Resource) folder - click 'Values' folder - Open 'Strings.xml'file - Add different Strings messages with proper syntax as below- 

<resources>
    <string name="app_name">My Application</string>
    <string name="msg1">Hello India</string>
    <string name="msg2">Enter a Value</string>
    <string name="omsg">The Output is</string>
</resources>

-------------------------------------------------------

NB : We can also create Array form of String which is used in drop-down list or combo box as list contents in String.xml file as -

<resources>
    <string-array name="Gender">
        <item>Male</item>
        <item>Female</item>
        <item>Other</item>
    </string-array>
</resources>


				
			
Example : How do we Create/Add different types of Colors for use in an existing Android application?
				
					Path : click 'app' option in the left pane/side window in an open android application - Open/click 'res' (Resource) folder - click 'Values' folder - Open/click 'Colors.xml'file - Add different Colors with proper syntax as below - 

<resources>
    <color name="black">#FF000000</color>
    <color name="white">#FFFFFFFF</color>
    <color name="red">#ff0000</color>
    <color name="green">#00FF00</color>
</resources>


				
			
Example : How do we Create/Add a new Activity page to an existing Android application?
				
					Open an existing android application in which we want to add new activity page 
click on 'app' option - click 'java' option - click 'com. ... android project name' option
Right click on 'com. ... android project name' option - click 'New' - click 'Activity' - click 'Empty Views Activity'
Now, both the newly created files 'MainActivity2.java'(app - java - com. ... android project name ) and 'activity_main2.xml'(app - res - layout) files /appeared at respected place.

				
			
Example : How do we Delete/Remove an Activity page from an existing Android application?
				
					Right click on that files say 'MainActivity2.java' or 'activity_main2.xml' file.
Select and click 'Delete' button - ok.
				
			
Example : How do we Run a selected/desired/chosen Activity Page from multiple MainActivity pages (say here, MainActivity2.xml) in an existing Android application/Project?
				
					To run any desired 'MainActivity.java' file from created multiple 'MainActivity2/3/4/5.java' files (say MainActivity2/3/4/5.java), put/set that particular activity page in the Top order of say here 'MainActivity2.java' file in 'manifests file' as below -

------------------------------------------------------

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools">
    
    <application android:allowbackup="true" android:dataextractionrules="@xml/data_extraction_rules" android:fullbackupcontent="@xml/backup_rules" android:icon="@mipmap/ic_launcher" android:label="@string/app_name" android:roundicon="@mipmap/ic_launcher_round" android:supportsrtl="true" android:theme="@style/Theme.MyApplication" tools:targetapi="31">
    
    
        <activity android:name=".MainActivity2" android:exported="true">
            <intent-filter>
                <action android:name="android.intent.action.MAIN"></action>
    
                <category android:name="android.intent.category.LAUNCHER"></category>
            </intent-filter>
        </activity>
            
            
            
        <activity android:name=".MainActivity3" android:exported="true">
            <intent-filter>
                <action android:name="android.intent.action.MAIN"></action>
    
                <category android:name="android.intent.category.LAUNCHER"></category>
            </intent-filter>
        </activity>
        
        
        
        <activity android:name=".MainActivity" android:exported="true">
            <intent-filter>
                <action android:name="android.intent.action.MAIN"></action>
    
                <category android:name="android.intent.category.LAUNCHER"></category>
            </intent-filter>
        </activity>
            
            
    </application>

</manifest>


NB: Here, 'MainActivity2.jave' file with activity_main2.xml file will be executed first because of it is set in top order of 'manifests file' as above.
				
			
Categories: Android

0 Comments

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.