hanker

Android - URL 이동 본문

Android

Android - URL 이동

hanker 2021. 5. 10. 16:36
@Override
public void onClick(View v) {
	switch(v.getId()) {
    	case R.id.btn1:
          Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse("http://www.hanke-r.tistory.com"));
          startActivity(intent);
          break;
      	case R.id.btn2:
           ... 
    }
}

App 화면에 버튼을 만들어 URL 이동을 하고 싶은 경우

Uri.parse("") 안에 이동하고싶은 URL 넣어서 startActivity 메서드 실행