티스토리 뷰
//화면을 임시로 밝게 하기 위함.
package com.example.myapplication;
import android.annotation.TargetApi;
import android.content.ContentResolver;
import android.content.Intent;
import android.net.Uri;
import android.os.Build;
import android.provider.Settings;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.view.WindowManager;
import android.widget.Button;
public class MainActivity extends AppCompatActivity {
private WindowManager.LayoutParams params;
private float brightness;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
// 화면 정보
params = getWindow().getAttributes();
Button mcardButton = (Button)findViewById(R.id.button);
mcardButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
changeBrightness();
}
});
}
@Override
protected void onResume() {
super.onResume();
}
protected void changeBrightness(){
// 기존 밝기 저장
brightness = params.screenBrightness;
// 밝게 설정
params.screenBrightness = 1f;
// 밝기 설정 적용
getWindow().setAttributes(params);
}
@Override
protected void onPause() {
super.onPause();
// 시스템밝기
params.screenBrightness = brightness;
getWindow().setAttributes(params);
}
}
'JAVA' 카테고리의 다른 글
CentOS6.x Tomcat7 자동시작 chkconfig 명령어 (0) | 2017.12.29 |
---|---|
MINA, Netty 문서 (0) | 2017.11.24 |
apache httpclient proxy authentication id password (0) | 2017.09.07 |
ORACLE 프로시져생성, 권한, Synonym (0) | 2017.09.05 |
Android SQLite사용법 (0) | 2017.07.30 |
- Total
- Today
- Yesterday
- 서버주소
- 리눅스
- 타임스탬프
- Android
- 더불어 민주당
- Python
- stamp
- websocket
- 파이썬
- 관련사이트
- 프로그래밍대회
- 안드로이드 화면 밝기 조절
- 프로젝트관리전문가
- 온라인저지
- .svn
- setup.py
- qwebview
- 파이썬프레임워크
- 사용법
- ORACLE 프로시져생성
- WSS
- 코드스쿨
- IT-PMP
- PyQt
- 자유한국당
- SW대회
- 명령어
- 디지털서명
- signtool
- 소프트웨어대회
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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 |