Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Hi, I have been attempting to do the following assignment and figured out how to do #2. Can you please explain to me how to

Hi, I have been attempting to do the following assignment and figured out how to do #2. Can you please explain to me how to do #1 and #3? I feel like I am missing something fundamental (my attempt below)

In Android Studio (using Kotlin) make an app that does the following:

1. Make the background change to a random color on a button click

2. Make the button show how many times it's been clicked with every click

3. show the time of the last time the button was clicked

Activity_main.xml

  

MainActivity.kt

package com.example.inclassassignment1 import androidx.appcompat.app.AppCompatActivity import android.os.Bundle import android.os.SystemClock import android.text.Layout import android.view.View import android.widget.Button import android.widget.CalendarView import android.widget.TextView import androidx.constraintlayout.widget.ConstraintSet import java.lang.Thread.sleep import java.util.* import kotlin.random.Random class MainActivity : AppCompatActivity() { override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) setContentView(R.layout.activity_main) var randomColor: Int = Random.nextInt(0, 16777215) //rgb color amount 16777215 var randomColorHex = java.lang.Integer.toHexString(randomColor) var clickerCount = 0; var timer = 0 var buttonChange = findViewById

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Processing Fundamentals Design And Implementation

Authors: KROENKE DAVID M.

1st Edition

8120322258, 978-8120322257

More Books

Students also viewed these Databases questions