Tugas 1 : Hello World, Hello Toast.
Tugas 1
Hello World, Hello Toast.
Disusun Oleh :
Wiradhika Dwi Putra
1202151228
SI-39-04
Program Studi Pengembangan Aplikasi Bergerak
Fakultas Rekayasa Industri
Telkom University
Hello World
Code : package com.example.wiradhikadwiputra.helloworld;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
public class MainActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
}
}
Hello Toast
package com.example.wiradhikadwiputra.hellotoast;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.TextView;
import android.widget.Toast;
public class MainActivity extends AppCompatActivity {
public abstract class MainActivity extends AppCompatActivity {
private int mCount = 0;
private TextView mShowCount;
mShowCount = (TextView)
findViewById(R.id.show_count) {
}
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
}
public void countUp(View view) {
mCount++;
if (mShowCount != null)
mShowCount.setText(Integer.toString(mCount));
}
public void showToast(View view) {
Toast toast = Toast.makeText(this, R.string.toast_message, Toast.LENGTH_LONG;);
toast.show();
}
}
Yang suka ngomen