PROGRESS WHEEL 버튼을 누르면
원형 로딩화면이 나옵니다.
PROGRESS BAR 버튼을 누르면
막대형 로딩화면이 나옵니다.
지원 중지된 서비스
스틱코드 서비스가 2022년 3월 9일 Bata 2.1 버전으로 업데이트 되면서, 기존의 ‘포스트 기능’의 지원을 임시 중단하기로 결정했습니다.
더 나은 서비스로 돌아오도록 하겠습니다.
임포트 코드가 존재하지 않습니다
xxxxxxxxxx
import androidx.annotation.NonNull;
import androidx.appcompat.app.AppCompatActivity;
import android.app.ProgressDialog;
import android.os.Bundle;
import android.os.Handler;
import android.os.Message;
import android.view.View;
import android.widget.Button;
public class MainActivity extends AppCompatActivity {
private ProgressDialog pBar;
private Button wheel,bar;
private ThreadEx threadEx;
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
wheel = (Button)findViewById(R.id.wheel);
bar = (Button)findViewById(R.id.bar);
wheel.setOnClickListener(new View.OnClickListener() {
public void onClick(View view) {
//프로그래스바는 기본적으로 원형을 제공한다.
pBar = ProgressDialog.show(MainActivity.this//Context
,"title"//타이틀
,"Loading..."//메세지
);
//도중 취소 여부
pBar.setCancelable(false);
threadEx = new ThreadEx(handler);
threadEx.start();//Thread 실행
}
});
bar.setOnClickListener(new View.OnClickListener() {
public void onClick(View view) {
pBar = new ProgressDialog(MainActivity.this);
//수평 프로그레스바로 설정
pBar.setProgressStyle(ProgressDialog.STYLE_HORIZONTAL);
//메세지 설정
pBar.setMessage("Loading...");
//중도 취소 여부
pBar.setCancelable(true);
pBar.show();
threadEx = new ThreadEx(handler);
threadEx.start();//Thread 실행
}
});
}
Handler handler = new Handler(){
public void handleMessage( Message msg) {
//인자로 전달된 Message객체로 부터 Bundle 객체를 얻어야 한다...
//Bundle bundle = msg.getData();
//value값 추출
//int value = bundle.getInt("value");
int value = msg.getData().getInt("value");
//받은 정수를 프로그레스 바의 진행값으로 설정...
pBar.setProgress(value);
super.handleMessage(msg);
pBar.setMessage("Loding..." + value + "%");
if(value >= 100){
pBar.dismiss();
threadEx.setCheck(false);
}
}
};
}
PROGRESS WHEEL 버튼을 누르면
원형 로딩화면이 나옵니다.
PROGRESS BAR 버튼을 누르면
막대형 로딩화면이 나옵니다.