매일코딩/안드로이드
[안드로이드 기초] 메시지 띄우기 url이동 전화걸기
인생여희
2017. 8. 10. 10:30
반응형
메시지 띄우기 url이동 전화걸기
#디자인 페이지
#자바 소스
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 | package me.happygate.myapplication001; import android.content.Intent; import android.net.Uri; import android.os.Bundle; import android.support.v7.app.AppCompatActivity; import android.view.View; import android.widget.Toast; public class MainActivity extends AppCompatActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); } //버튼 클릭 메시지 뛰워주기 public void onButtonMessge(View v){ Toast.makeText(this, "button clicked", Toast.LENGTH_SHORT).show(); } //해당 url 이동 public void onButtonNaver(View v){ Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse("http://m.naver.com")); startActivity(intent); } //전화하기 public void onButtonCall(View v){ Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse("tel:010-1000-1000")); startActivity(intent); } } |
반응형