심영보 학생의 button 실습 코드
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class MainActivity extends AppCompatActivity { | |
@Override | |
protected void onCreate(Bundle savedInstanceState) { | |
super.onCreate(savedInstanceState); | |
setContentView(R.layout.activity_main); | |
} | |
public void onClick(View view){ | |
// Button button = (Button)findViewById(view.getId()); | |
switch (view.getId()){ | |
case R.id.button0: startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse("http://www.nate.com"))); | |
break; | |
case R.id.button1: startActivity(new Intent(Intent.ACTION_DIAL, Uri.parse("tel:911"))); | |
break; | |
case R.id.button2: startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse("content://media/internal/images/media"))); | |
break; | |
case R.id.button3: finish(); | |
break; | |
} | |
} | |
} |