0% found this document useful (0 votes)
32 views4 pages

Pemrograman Komputer Iii: Jobsheet 7: Pembuatan Aplikasi Dan Antarmuka

This document contains code for an Android application project that displays two lines of text and a symbol. The first line of text is "Prodi Telkom" in red color and the second line is "Polines" in blue color. It also includes a button that, when clicked, changes the text and colors or resets the text to "...." if clicked again. The code implements click listeners for the button to change and reset the text and colors displayed.

Uploaded by

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

Pemrograman Komputer Iii: Jobsheet 7: Pembuatan Aplikasi Dan Antarmuka

This document contains code for an Android application project that displays two lines of text and a symbol. The first line of text is "Prodi Telkom" in red color and the second line is "Polines" in blue color. It also includes a button that, when clicked, changes the text and colors or resets the text to "...." if clicked again. The code implements click listeners for the button to change and reset the text and colors displayed.

Uploaded by

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

PEMROGRAMAN KOMPUTER III

Jobsheet 7 : Pembuatan Aplikasi Dan Antarmuka

Faliq Faza
TE-2A / 08

POLITEKNIK NEGERI SEMARANG


2016
7.2. Lembar Kerja

No Nama File Hasil Keluaran


1. Lat1
7.3. Pertanyaan dan Tugas

Buatlah proyek yang dapat menampilkan 2 baris tulisan dan lambang. Tulisan dalam
baris pertama adalah Prodi Telkom berwarna merah dan baris kedua adalah Polines
berwarna biru. Selain itu tambahkan sebuah tombol, bila di klik ….
package faliq.tugas1;

import android.graphics.Color;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.TextView;

public class MainActivity extends AppCompatActivity {

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
final TextView Ucapan;
Ucapan = (TextView) findViewById(R.id.textView);
final TextView Text = (TextView) findViewById(R.id.textView2);
Button btnSaya = (Button) findViewById(R.id.button);
btnSaya.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {

String teks, teks1;


teks = (String) Ucapan.getText();
if (teks == "Apa kabar?") {
Ucapan.setText("Prodi Telkom");
Text.setText("Polines");
Ucapan.setTextColor(Color.RED);
Text.setTextColor(Color.BLUE);
} else {
Ucapan.setText("Apa kabar?");
Text.setText("Pemrograman Android");
Ucapan.setTextColor(Color.BLUE);
Text.setTextColor(Color.RED);
}
}
});
Button Clear = (Button) findViewById(R.id.button2);
Clear.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Ucapan.setText("....");
Text.setText("....");
}
});
}
}

You might also like