Notice
Recent Posts
Recent Comments
Link
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | |||
5 | 6 | 7 | 8 | 9 | 10 | 11 |
12 | 13 | 14 | 15 | 16 | 17 | 18 |
19 | 20 | 21 | 22 | 23 | 24 | 25 |
26 | 27 | 28 | 29 | 30 | 31 |
Tags
- Spring
- JavaScript
- CSS
- 회원가입
- 자바
- Resources
- 청주
- Selector
- #청주주님의교회
- Android
- java 8
- Intent
- TinyMCE
- jQuery
- 프로그래밍
- 안드로이드
- 생명주기
- 주님의교회
- 인텐트
- Java
- 아이콘
- 안드로이드 AVD
- androidstudio
- 글쓰기
- 제이쿼리
- 게시판
- 영성
- 에디터
- 웹개발
- Activity
Archives
- Today
- Total
공부하는 블로그
(안드로이드 프로그래밍) Activity로 화면전환제어 본문
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 | <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:tools="http://schemas.android.com/tools" android:orientation="vertical" android:layout_width="match_parent" android:layout_height="match_parent" tools:context="com.ktds.lesson05_1.MainActivity"> <Button android:id="@+id/btn_1_activity" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="New Activity1"/> <Button android:id="@+id/btn_2_activity" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="New Activity2"/> <Button android:id="@+id/btn_3_activity" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="New Activity3"/> </LinearLayout> | cs |
Main
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 | <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:tools="http://schemas.android.com/tools" android:orientation="vertical" android:layout_width="match_parent" android:layout_height="match_parent" tools:context="com.ktds.lesson05_1.NewActivity1"> <Button android:id="@+id/btn_close" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="Close"/> </LinearLayout> | cs |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 | package com.ktds.lesson05_1; import android.content.Intent; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; import android.view.View; import android.widget.Button; public class MainActivity extends AppCompatActivity { private Button btn_1_activity; private Button btn_2_activity; private Button btn_3_activity; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); btn_1_activity = (Button) findViewById(R.id.btn_1_activity); btn_2_activity = (Button) findViewById(R.id.btn_2_activity); btn_3_activity = (Button) findViewById(R.id.btn_3_activity); btn_1_activity.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Intent intent = new Intent( MainActivity.this , NewActivity1.class); startActivity(intent); } }); btn_2_activity.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Intent intent = new Intent( MainActivity.this , NewActivity2.class); startActivity(intent); } }); btn_3_activity.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Intent intent = new Intent( MainActivity.this , NewActivity3.class); startActivity(intent); } }); } } | cs |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 | package com.ktds.lesson05_1; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; import android.view.View; import android.widget.Button; public class NewActivity1 extends AppCompatActivity { private Button btn_close; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_new1); btn_close = (Button) findViewById(R.id.btn_close); btn_close.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { finish(); } }); } } | cs |