PRACS 3 ANDROID || Sorry for the mistakes if any. :) :-)

ANDROID PRACTICAL NO : 3 CHANGE THE TEXT OF A TEXTVIEW ON A CLICK OF A BUTTON.

NOTE : BEFORE RUNNING YOUR ANDROID PROGRAM START YOU AVD (ANDROID VIRTUAL DEVICE) AND THEN START TO CODE
SO THAT IT WILL NOT TAKE MORE TIME TO GET AVD BOOT UP… IN MY CASE I AM USING BLUESTACKS EMULATOR…

OPEN ANDROID STUDIO CREATE A NEW PROJECT.

AFTER THE PROJECT IS LOADED AND THE GRADLE SYNC IS FINISHED..

GO TO ACTIVITY_MAIN.XML FILE WHICH IS PRESENT UNDER LAYOUT FOLDER …

NOTE : CHANGE THE LAYOUT TO RELATIVELAYOUT AND REMOVE THE DEFAULT TEXTVIEW…

SELECT DESIGN MODE AND JUST DRAG N DROP A BUTTON AND A TEXTVIEW.
CHANGE THE TEXT ON THE TEXTVIEW AND BUTTON .
YOU CAN CHANGE THE SIZE OF THESE CONTROLS BUTTONS AND TEXTVIEW..

AFTER DESIGNING THE UI.. GO TO THE MainActivity.java import the following packages…

import android.widget.TextView;
import android.widget.Button;
import android.view.View;
import android.view.View.OnClickListener;

Type the following code just under the onCreate() method…

final Button b1 = findViewById(R.id.button);
final TextView t1 = findViewById(R.id.textView);
b1.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
t1.setText(“HELLO SYCS”);
}
});

THATS IT RUN YOUR PROGRAM..

ALSO NOTE THAT V IS CAPITAL IN “textView” LETS CLICK ON THE BUTTON TO SEE THE EFFECT.. 🙂 OUR TEXT GOT CHANGED… 🙂

YOU WILL HAVE TO SELECT YOUR AVD DEVICE THAT I TOLD PREVIOUSLY….

HOW TO START AVD , ITS SIMPLE GO TO THIS LOCATION FOLLOW ME…
YOU WILL HAVE SOME OF THE DEVICE PRESENT HERE…
OUR APP HAS BEEN INSTALLED LETS CHECK…

THANKS FOR WATCHING GUYS.. 🙂 🙂

SOLVED : Gradle Error on Android Studio 3.0.1

As you can see. I managed to overcome the gradle error.
Channel: Endi Hariadi
Published: 2018-02-10 19:26:57
Duration: 3M57S
Views: 1483
Likes: 7
Favorites: 0

A 12-year-old app developer | Thomas Suarez

Most 12-year-olds love playing videogames — Thomas Suarez taught himself how to create them. After developing iPhone apps like “Bustin Jeiber,” a whack-a-mole game, he is now using his skills to help other kids become developers. (Filmed at TEDxManhattanBeach.)

TEDTalks is a daily video podcast of the best talks and performances from the TED Conference, where the world’s leading thinkers and doers give the talk of their lives in 18 minutes (or less). Look for talks on Technology, Entertainment and Design — plus science, business, global issues, the arts and much more.
Find closed captions and translated subtitles in many languages at http://www.ted.com/translate

Follow TED news on Twitter: http://www.twitter.com/tednews
Like TED on Facebook: https://www.facebook.com/TED

Subscribe to our channel: http://www.youtube.com/user/TEDtalksDirector

Channel: TED
Published: 2012-10-24 19:28:17
Duration: 4M41S
Views: 5169625
Likes: 59321
Favorites: 0

Leave a Reply

Your email address will not be published. Required fields are marked *