목록분류 전체보기 (469)
2swan
main.activity public class MainActivity5 extends AppCompatActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main5); setTitle("리스트 뷰 테스트"); ListView listView1 = findViewById(R.id.listView1); String[ ] mid = {"리스트 뷰 String 1","리스트 뷰 String 2", "리스트 뷰 String 3", "리스트 뷰 String 4","리스트 뷰 String 5", "리스트 뷰 Str..
main.activity public class MainActivity3 extends AppCompatActivity { private ActivityMain3Binding binding; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); //바인딩 객체 초기화 첫번째 방법 binding = ActivityMain3Binding.inflate(getLayoutInflater()); setContentView(binding.getRoot()); setTitle("암시적 인텐트 예제"); //바인딩 객체 초기화 두번째 방법 // binding = ActivityMain3Bindin..
main.xml input.xml output.xml stu.xml main.activity public class MainActivity2 extends AppCompatActivity { private String name, age, phone; private Student student; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main2); Button btnDataInput = findViewById(R.id.btnDataInput); Button btnDataOut = findViewById(R.id...
main.xml sub.xml main.activity public class MainActivity extends AppCompatActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); Button button = findViewById(R.id.btnAdd); EditText edtNum1 = findViewById(R.id.edtNum1); EditText edtNum2 = findViewById(R.id.edtNum2); ActivityResultLauncher launcher = reg..
main.xml input.xml output.xml stuput.xml Student.java (class) public class Student implements Serializable { private int sno; private String name; private String major; public Student(){ } public Student(int sno, String name, String major) { this.sno = sno; this.name = name; this.major = major; } public int getSno() { return sno; } public void setSno(int sno) { this.sno = sno; } public String ge..
.xml .java public class MainActivity2 extends AppCompatActivity { private WebView webView; private String url = "https://www.naver.com"; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main2); webView = findViewById(R.id.webView); webView.getSettings().setJavaScriptEnabled(true); webView.loadUrl(url); webView.set..
.xml .java public class MainActivity2 extends AppCompatActivity { Button btn_dialog; TextView tv_result; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main2); //Dialog 팝업창 btn_dialog = findViewById(R.id.btn_dialog); tv_result = findViewById(R.id.tv_result); btn_dialog.setOnClickListener(new View.OnClickListener..
public class MainActivity2 extends AppCompatActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main2); //Log 출력 String Lee = "이"; Log.e("MainActivity2 : ",Lee); //e는 에러 줄임말 (에러 형태로 출력) int a = 10; Log.e("MainActivity2", String.valueOf(a)); // int값은 로그로 출력할 때 String으로 출력하기 때문에 a값을 String 형태로 출력 } }
.JAVA public class MainActivity2 extends AppCompatActivity { private long backBtnTime = 0; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main2); } @Override public void onBackPressed() { long curTime = System.currentTimeMillis(); long gapTime = curTime - backBtnTime; //현재 시간 가져와서 백버튼 누른 시간 빼준다 if(0 = gapTime ){..
main.xml second.xml third.xml four.xml main.java public class MainActivity extends AppCompatActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); RadioButton rdoSecond = findViewById(R.id.rdoSecond); RadioButton rdoThird = findViewById(R.id.rdoThird); RadioButton rdoFour = findViewById(R.id.rdoFour); ..
.xml .java public class MainActivity2 extends AppCompatActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main2); RatingBar ratingBar1 = findViewById(R.id.ratingBar1); RatingBar ratingBar2 = findViewById(R.id.ratingBar2); RatingBar ratingBar3 = findViewById(R.id.ratingBar3); Button btnInc = findViewById(R..
main.xml sub.xml main.java public class MainActivity3 extends AppCompatActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main3); Button btnResult = findViewById(R.id.btnResult); //투표수 저장 배열 int countVote[] = new int[9]; ImageView image[] = new ImageView[9]; //이미지 뷰 저장 배열 String ImageName[] = { "pic1","pi..