'android'에 해당되는 글 47건

Intent 사용법

android 2020. 2. 1. 13:28

* 기본

Intent intent = new Intent(getApplicationContext(), MenuActivity.class);
startActivity(intent);

* 요청코드 추가

Intent intent = new Intent(getApplicationContext(), MenuActivity.class);
startActivityForResult(intent, 101);

* 전화걸기

Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse("tel:010-1000-1000"));
startActivity(intent);

* 웹접속

Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse("https://m.naver.com"));
startActivity(intent);

'android' 카테고리의 다른 글

SharedPreferences 사용법  (0) 2020.02.01
Intent 값전달 및 받기  (0) 2020.02.01
프로그레스바  (0) 2020.02.01
다이얼로그 메시지  (0) 2020.02.01
스낵바 메시지  (0) 2020.02.01
블로그 이미지

디츠

“말은 쉽지, 코드를 보여줘.” “Talk is cheap. Show me the code.” – 리누스 토르발스(Linus Torvalds)

,

프로그레스바

android 2020. 2. 1. 12:39
  • progress : 초기값, max : 최대값
public class MainActivity extends AppCompatActivity {

    ProgressBar progressBar;
    int value = 0;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);

        progressBar = findViewById(R.id.progressBar);

        Button button = (Button) findViewById(R.id.button);
        button.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                value += 10;
                if (value > 100) {
                    value = 0;
                }

                progressBar.setProgress(value);
            }
        });
    }
}

'android' 카테고리의 다른 글

Intent 값전달 및 받기  (0) 2020.02.01
Intent 사용법  (0) 2020.02.01
다이얼로그 메시지  (0) 2020.02.01
스낵바 메시지  (0) 2020.02.01
토스트 메시지 위치 변경  (0) 2020.02.01
블로그 이미지

디츠

“말은 쉽지, 코드를 보여줘.” “Talk is cheap. Show me the code.” – 리누스 토르발스(Linus Torvalds)

,
    public void dialog() {
        AlertDialog.Builder builder = new AlertDialog.Builder(this);
        builder.setTitle("안내");
        builder.setMessage("종료하시겠습니까?");
        builder.setIcon(android.R.drawable.ic_dialog_alert);

        builder.setPositiveButton("예", new DialogInterface.OnClickListener() {
            @Override
            public void onClick(DialogInterface dialog, int which) {
                Toast.makeText(getApplicationContext(), "예 버튼 눌림", Toast.LENGTH_SHORT).show();
            }
        });

        builder.setNegativeButton("아니오", new DialogInterface.OnClickListener() {
            @Override
            public void onClick(DialogInterface dialog, int which) {
                Toast.makeText(getApplicationContext(), "아니오 버튼 눌림", Toast.LENGTH_SHORT).show();
            }
        });

        AlertDialog dialog = builder.create();
        dialog.show();
    }

'android' 카테고리의 다른 글

Intent 값전달 및 받기  (0) 2020.02.01
Intent 사용법  (0) 2020.02.01
프로그레스바  (0) 2020.02.01
스낵바 메시지  (0) 2020.02.01
토스트 메시지 위치 변경  (0) 2020.02.01
블로그 이미지

디츠

“말은 쉽지, 코드를 보여줘.” “Talk is cheap. Show me the code.” – 리누스 토르발스(Linus Torvalds)

,

스낵바 메시지

android 2020. 2. 1. 12:15

* xml에서 Palette > Containers > AppBarlayout 다운 후(외부라이브러리라서)

Snackbar.make(v, "스낵바입니다.", Snackbar.LENGTH_LONG).show();

'android' 카테고리의 다른 글

Intent 값전달 및 받기  (0) 2020.02.01
Intent 사용법  (0) 2020.02.01
프로그레스바  (0) 2020.02.01
다이얼로그 메시지  (0) 2020.02.01
토스트 메시지 위치 변경  (0) 2020.02.01
블로그 이미지

디츠

“말은 쉽지, 코드를 보여줘.” “Talk is cheap. Show me the code.” – 리누스 토르발스(Linus Torvalds)

,
Toast toastView = Toast.makeText(getApplicationContext(), "토스트 메시지입니다.", Toast.LENGTH_LONG);
toastView.setGravity(Gravity.TOP|Gravity.LEFT, 300, 500);
toastView.show();

'android' 카테고리의 다른 글

Intent 값전달 및 받기  (0) 2020.02.01
Intent 사용법  (0) 2020.02.01
프로그레스바  (0) 2020.02.01
다이얼로그 메시지  (0) 2020.02.01
스낵바 메시지  (0) 2020.02.01
블로그 이미지

디츠

“말은 쉽지, 코드를 보여줘.” “Talk is cheap. Show me the code.” – 리누스 토르발스(Linus Torvalds)

,