Git Product home page Git Product logo

roll_it's Introduction

Tutorial on Introduction to Native Android Development

Notes

  • We work on two different types of files - kotlin files and XML files
  • We create and arrange all the UI elements (views) in XML file.
  • Views are arranged using layouts, in this app we have used constraint layout.
  • Once the views are created and arranged properly in XML file, we move to Kotlin (.kt) file where we write the all the programs which determine the interaction with those views.
  • As the views are created in XML file but the functionality of those views is generated by the programs in kotlin file. So, we need reference of views in kotlin file. We use findViewById for that.
  • findViewById creates the reference of the views in kotlin file by the help of id defined in XML file for respective views.
  • We then created a function roll() which simply returns a random int between 1 to 6.
  • image
  • After that we used when statement to get the corresponding image resource to use in the imageView everytime user press Roll button and the image needs to be updated.
  • image
  • Finally we set the resource using setImageResource method.
  • We also displayed a Toast - which is nothing but a message that is displayed on the screen stating what number you have got.

Screenshots of the app

How to clone the app

  • Please star the repo first. (So that I can know that you are doing the task)
  • image
  • In android studio go to File > New > Project from version control
  • image
  • On the repo click on code and then copy the HTTPS from there
  • image
  • Copy this HTTPS in android studio
  • image
  • Just click on clone and now you are good to go.

How to run the app

Please go through this if you dont have an AVD already (To check it just press Run button and see if an AVD is opening up or not)

https://youtu.be/6CIPovJxty8

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.