0% found this document useful (0 votes)
31 views5 pages

Android Studio Cloud Workspace Creation

The document outlines the steps to create a workspace in Android Studio Cloud and connect it to Firebase for app development. It includes a sample code for a basic Android application that displays a text view and buttons to interact with the user. The instructions detail the process of setting up Firebase integration and provide a simple user interface for button interactions.

Uploaded by

Akshat gupta
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
31 views5 pages

Android Studio Cloud Workspace Creation

The document outlines the steps to create a workspace in Android Studio Cloud and connect it to Firebase for app development. It includes a sample code for a basic Android application that displays a text view and buttons to interact with the user. The instructions detail the process of setting up Firebase integration and provide a simple user interface for button interactions.

Uploaded by

Akshat gupta
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 5

Android Studio Cloud Workspace Creation

Akshat Gupta
AP22110010024
CSE A

We have to create a workspace and run a basic program to display text view and button
using Android studio cloud https://studio.firebase.google.com/new/android-studio

Steps to Create and Connect Firebase to Android Studio App

1. Open Android Studio on your computer.


2. Create a new Android project or open your existing one.
3. In the top menu, go to Tools → Firebase.
. The Firebase Assistant panel opens on the right side of Android Studio.
5. Choose a feature to integrate (e.g., Authentication, Realtime Database, Firestore, or
Analytics).
6. Click on “Connect to Firebase” inside the Assistant panel.
7. A browser tab opens → sign in with your Google account.
8. Click “Create Project”, give it a name (e.g., MyAppFirebase), and click Continue.
9. (Optional) Enable Google Analytics and click Create Project.
10. Wait for the Firebase project to be ready, then click Continue to Console.
CODE :---
package com.example.textviewbuttonapp

import android.os.Bundle

import androidx.activity.ComponentActivity

import androidx.activity.compose.setContent

import androidx.compose.foundation.layout.*

import androidx.compose.material3.*

import androidx.compose.runtime.*

import androidx.compose.ui.Alignment

import androidx.compose.ui.Modifier

import androidx.compose.ui.unit.dp

import androidx.compose.ui.unit.sp

class MainActivity : ComponentActivity() {

override fun onCreate(savedInstanceState: Bundle?) {

super.onCreate(savedInstanceState)

setContent {
MyScreen()

@Composable

fun MyScreen() {

var buttonClicked by remember { mutableStateOf(false) }

var clickCount by remember { mutableStateOf(0) }

var message by remember { mutableStateOf("Hello, Android Studio Cloud!") }

Column(

modifier = Modifier

.fillMaxSize()

.padding(16.dp),

horizontalAlignment = Alignment.CenterHorizontally,

verticalArrangement = Arrangement.Center

){

Text(

text = message,

fontSize = 24.sp

Spacer(modifier = Modifier.height(20.dp))

Button(onClick = {

buttonClicked = true

clickCount++

message = "Button Clicked $clickCount times!"

}) {

Text(text = "Click Me")


}

Spacer(modifier = Modifier.height(10.dp))

Button(onClick = {

buttonClicked = !buttonClicked

message = if (buttonClicked) "Button ON" else "Button OFF"

}) {

Text(text = "Toggle Text")

Spacer(modifier = Modifier.height(10.dp))

Button(onClick = {

clickCount = 0

buttonClicked = false

message = "Reset Done! Hello Again!"

}) {

Text(text = "Reset")

}
}

You might also like