Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Starting Android 2022

Starting Android 2022

In this talk we’ll see how we can set up your development environment and how to effectively start Android today.

We will find a way to use the acquired knowledge from other programming languages and use them in learning Android.

Syrine Trabelsi

October 17, 2022
Tweet

More Decks by Syrine Trabelsi

Other Decks in Programming

Transcript

  1. BIO SYRINE TRABELSI (SHE/HER) ▸ Senior Android Developer @Trainline ▸

    Full time mum of 2 outside working hours ▸ Started Android programming 10 years ago ▸ Slides already available here: https:// speakerdeck.com/syrinet ▸ @sarrouna23
  2. About Trainline Trainline is the leading independent rail and coach

    travel platform selling rail and coach tickets to millions of travellers worldwide. Via our highly rated website and mobile app, people can seamlessly search, book and manage their journeys all in one place. We bring together millions of routes, fares and journey times from more than 270 rail and coach carriers across 45 countries. We help our customers find the best value fares for their journey and smart, real time travel information on the go. Our aim is to make rail and coach travel easier and more accessible, encouraging people to make more environmentally sustainable travel choices. i. Based on transactions from weeks commencing 06/10/2019 to 23/11/2019 ii. iOS rating from UK AppStore as of 29 November 2019 iii. Trainline data for November 2019 (incl. UK consumer number Web/App and EU Web/App) iv. Average monthly visits for year ended 29 February 2020 v. UK consumer mobile app transactions for the year ended 29 February 2020 Trainline is the world’s leading independent rail and coach travel platform We sell tickets on behalf of more than 270 rail and coach companies and are adding more all the time We sell train and coach tickets worldwide, helping our customers travel in and across 45 countries in Europe and the rest of the world We sell tickets to people living in more than 175 countriesi in 14 languages Our customers can book in 10 currencies and payment methods include Apple Pay, PayPal, Google Pay, SOFORT & iDEAL We have built Europe’s leading train and coach app – with a 4.9/5* ratingii There are more than 44m cumulative downloads of our appiii Our platforms host more than 90m visits per monthiv 84% of our transactions are through our appv Our team numbers more than 750 people and more than 50 nationalities, including 400+ travel tech specialists and engineers >160 Train companie s >110 Coach companie s
  3. ANDROID LEXICON ACTIVITY ▸ It’s an entry point for interacting

    with the user ▸ Crucial part for an Android application ▸ Any app have at least 1 activity
  4. import android.app.Activity import android.os.Bundle class MainActivity : Activity() { override

    fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) } override fun onStart() { super.onStart() } override fun onResume() { super.onResume() } override fun onPause() { super.onPause() } override fun onStop() { super.onStop() } override fun onDestroy() { super.onDestroy() } } 10
  5. 11

  6. 14

  7. <?xml version="1.0" encoding="utf-8"?> <manifest xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" package="com.trainline.myapplication"> <uses-permission android:name="android.permission.INTERNET" />

    <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=".MainActivity" android:exported="true" android:theme="@style/Theme.MyApplication"> <intent-filter> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" /> </intent-filter> </activity> </application> </manifest> 17
  8. ANDROID LEXICON THE VIEW : THEN ▸ Layout XML ▸

    Resources XML ▸ Binding the views from Java/Kotlin code
  9. 20

  10. <?xml version="1.0" encoding="utf-8"?> <androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical"> <Button

    android:id="@+id/button" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="Button" app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintEnd_toEndOf="parent" app:layout_constraintStart_toStartOf="parent" app:layout_constraintTop_toTopOf="parent" /> </androidx.constraintlayout.widget.ConstraintLayout> 21
  11. ANDROID LEXICON THE VIEW : NOW ▸ Jetpack compose ▸

    Only Kotlin for the whole project 23
  12. const CustomButton = ({ onPress }) => { return (

    <button type="button" onClick={onPress}> Click on me </button> ); }; @Composable fun CustomButton() { Button(onClick = {}) { Text(text = "Click on me") } } 26