Skip to main content

Android Internship Task-2 Android | Running your first Android app

Android | Running your first Android app

After successfully Setting up an Android project, all of the default files are created with default code in them. Let us look at this default code and files and try to run the default app created.

  • The panel on the left side of the android studio window has all the files that the app includes. Under the java folder, observe the first folder containing the java file of your project.
    android 7
    For every activity, a “.java” file and a “.xml” file is created. In this case for MainActivity, “MainActivity.java” and “activity_main.xml” are created.

    The above java file shows us the default code that is present when an app is created. An activity is created that extends AppCompactActivity class.

    The “res” folder contains “layout” subfolder, which includes the xml files of the projects.

    android8



    You can find the activity_main.xml file under the layout folder. This the XML file corresponding to the MainActivity. There is an onCreate function that overrides a function of AppCompactActivity class. onCreate(Bundle) is where you initialize your activity. When the activity is first started, then both onCreate() methods are called. But after the first start of Activity, the onCreate() of application will not be called for subsequent runs.

  • Now, consider the activity_main.xml file, it contains various tags similar to HTML. The first tag ensures the version. The second tag is usually the Layout tag. There are various types of Layouts but for now, let us go with the default RelativeLayout. This is a layout that places the widgets relative to screen size.

    There is a TextView widget by default. This “TextView” is basically the Text field that displays the text specified. It has various attributes. For now, consider the default attributes present. The layout_width and layout_height are the width and height of the widget occupied in the screen. The attribute “wrap_content” refers to width or height being restricted to the content of the text.

    The text attribute takes a string in quotations ( i.e., “ ” ). The content within this is displayed on the screen.

    android 9

    Now, click the “Run” option at the Toolbar at the top. You can observe the option being highlighted in the image below.

  • You would get a pop-up as in the image below.
    android 10
  • You can either choose the emulator or you can connect your phone and find them listed under Connected Devices but for this you must enable the developer options in your phone and set the USB debugging mode on.
    android 11
    Once done, click on OK.
  • Usually, the emulator consumes a lot of RAM. The more RAM size you have, the faster your emulator will work. Generally, 4GB is the descent RAM size. Size more than that would increase the performance of your emulator.

    The image below shows the working of the first app, My Application. You can find all the basic functionalities that your phone has, on the emulator, like Home button, back button, power, etc.
    android 12

Comments

Popular posts from this blog

IOT Projects souce code

IOT  Projects souce code What is IoT? The Internet of Things (IoT) is a network where everyday objects like devices, vehicles, and appliances have sensors and internet connectivity. It lets them gather and share data, work together, and perform tasks without human control. This helps boost automation and efficiency across different areas. You can learn IoT to understand its core components and get further knowledge of its functionalities. 20 IoT Projects with Source Code When it comes to IoT, there are many interesting ideas to explore, from making your home smarter to making an autonomous drone. No matter if you’re just starting or have experience, here are 20 Internet of things projects for beginners and advanced professionals. Simple IoT Project Ideas for Beginners For beginner-level, you can start with simple and fun IoT project ideas that involve basic components like sensors, actuators, and microcontrollers. Below are a few of them: 1. Smart Home Automation Smart home automat...

Connecting R to MySql in English #Training Trains

software design institute training

  ONLINE-OFFLINE IN-PLANT/INTERNSHIP With Certificate Training For B.E(ECE,EEE,CSE,IT,AI,ML,DataScience,Cyper Security),MCA, B.Sc,M.E,M.Tech. @ TrainingTrains.Online Classes Available 100 % Job placement Training Full Stack Developer | Placement Training In-plant Training/Internship Training with Project supports the various Engineering and Non-Engineering, Arts Students to develop their Skills on the IT Companies/Corporate Expectations. DURATION OF IN-PLANT TRAINING: 1 week and Above.DURATION OF INTERNSHIP: 1 Month and Above Internship-inplant training For All Departments students, Internship- inplant Training Python | Java | Full Stack Development | UI & UX | C& C++ | Php | Web Designing - HTML, CSS, Java Script, Bootstrap | MEAN Stack | MERN Stack | MEARNStack | Android | Kotlin | Flutter | Database - Oracle, Mongo DB, MySQL, MS SQL Serer | Visual Studio Code | Objective C | Swift | Go Lang | Frame work - Laravel, Django, Vue JS | Machine Learning | React JS | ...