2017년 10월 14일 토요일

안드로이드 화면 회전 및 로딩 흰색 화면 방지

로딩시 화면 흰색 제거
와 화면 회전시 센서에의한 회전 과 내용 refresh 방지



AndroidManifest.xml
android:configChanges="orientation|screenSize"
android:screenOrientation="sensor">

styles.xml
 //로딩시 화면 흰색 제거
@null
true

2017년 10월 13일 금요일

what the fuck steam

what the fuck steam


Running Steam on ubuntu 16.04 64-bit
STEAM_RUNTIME is enabled automatically
Pins up-to-date!
[2017-10-14 04:21:50] Startup - updater built Oct 11 2017 10:57:45
SteamUpdateUI: An X Error occurred
X Error of failed request:  BadWindow (invalid Window parameter)
Major opcode of failed request:  155 (NV-GLX)
Minor opcode of failed request:  4
Resource id in failed request:  0x1400002
Serial number of failed request:  45
xerror_handler: X failed, continuing
Looks like steam didn't shutdown cleanly, scheduling immediate update check
[2017-10-14 04:21:50] Checking for update on startup
[2017-10-14 04:21:50] Checking for available updates...
[2017-10-14 04:21:50] Download skipped: /client/steam_client_ubuntu12 version 1507769972, installed version 1507769972
[2017-10-14 04:21:50] Nothing to do
[2017-10-14 04:21:50] Verifying installation...
[2017-10-14 04:21:50] Performing checksum verification of executable files
[2017-10-14 04:21:50] Verification complete


==============================================================



mv $HOME/.steam/ubuntu12_32/steam-runtime/i386/usr/lib/i386-linux-gnu/libstdc++.so.6{.bak,}

mv $HOME/.steam/ubuntu12_32/steam-runtime/amd64/usr/lib/x86_64-linux-gnu/libstdc++.so.6{.bak,}

LD_PRELOAD='/usr/$LIB/libstdc++.so.6' DIAPLAY=:0 steam

안드로이드 공유 기능




안드로이드 공유(sms, sns) 기능





Intent msg = new Intent(Intent.ACTION_SEND);
msg.addCategory(Intent.CATEGORY_DEFAULT);
msg.putExtra(Intent.EXTRA_SUBJECT, "주제");
msg.putExtra(Intent.EXTRA_TEXT, "내용");
msg.putExtra(Intent.EXTRA_TITLE, "제목");
msg.setType("text/plain");   
startActivity(Intent.createChooser(msg, "공유"));

2017년 10월 12일 목요일

천단위 컴마 붙이기








edt1 = (EditText) findViewById(R.id.editText);
edt1.addTextChangedListener(new CustomTextWatcher(edt1));





클래스 생성
=======================================================



import android.text.Editable;
import android.text.Selection;
import android.text.TextWatcher;
import android.widget.EditText;

import java.text.DecimalFormat;

/**
 * Created by buster on 17. 10. 13.
 * 천단위 컴마 붙이기
 *
 */
public class CustomTextWatcher implements TextWatcher {
    @SuppressWarnings("unused")
    private EditText mEditText;
    String strAmount = ""; // 임시 저장값 (콤마)

    public CustomTextWatcher(EditText e) {
        mEditText = e;
    }

    @Override
    public void afterTextChanged(Editable s) {
        // TODO Auto-generated method stub

    }

    @Override
    public void beforeTextChanged(CharSequence s, int start, int count,
                                  int after) {
        // TODO Auto-generated method stub

    }

    @Override
    public void onTextChanged(CharSequence s, int start, int before, int count) {    //텍스트가 변경될때마다 실행
        if (!s.toString().equals(strAmount)) { // StackOverflow 방지
            strAmount = makeStringComma(s.toString().replace(",", ""));
            mEditText.setText(strAmount);
            Editable e = mEditText.getText();
            Selection.setSelection(e, strAmount.length());
        }
    }

    protected String makeStringComma(String str) {    // 천단위 콤마 처리
        if (str.length() == 0)
            return "";
        long value = Long.parseLong(str);
        DecimalFormat format = new DecimalFormat("###,###");
        return format.format(value);
    }

}
======================================================
계산식에 , 마 제거 해야 정상적인 계산이 이루어 진다.

double input1 = Double.valueOf(edt1.getText().toString().replace(",",""));

자바 데이터형

종류       설명              저장 공간    값의 범위 (최소값~최대값)
======================================================================================
boolean    논리값            1 bit        true / false
--------------------------------------------------------------------------------------
byte       부호 있는 정수    8 bits       -128 ~ 127
--------------------------------------------------------------------------------------
char       유니코드 문자     16 bits      \u0000 ~ \uFFFF
--------------------------------------------------------------------------------------
short      부호 있는 정수    16 bits      -32768 ~ 32767
--------------------------------------------------------------------------------------
int        부호 있는 정수    32 bits      -2147483648 ~ 2147483647
--------------------------------------------------------------------------------------
long       부호 있는 정수    64 bits      -9223372036854775808 ~ 9223372036854775807
--------------------------------------------------------------------------------------
float      IEEE 754 실수     32 bits      1.40239846E-45f
                                          ~ (표현 가능 양수 범위)
                                          3.40282347E+38f
--------------------------------------------------------------------------------------
double     IEEE 754 실수     64 bits      4.94065645841246544E-324
                                          ~ (표현 가능 양수 범위)
                                          1.79769313486231570E+308
--------------------------------------------------------------------------------------

2017년 10월 9일 월요일

자바 메쏘드 분리 및 인수 전달

 
 
android:background="#333333" 
android:textColor="#99ff00"
android:gravity="center_vertical"
 
 
 double input1 = Double.valueOf(edt1.getText().toString());


 m2result= calc.M2Result(input1);
 


 
 public static double M2Result(double input1) {
 
 
return input1;
 
 
} 

2017년 10월 8일 일요일

안드로이드 스튜디오 화면 고정


첫번째 방법 엑티비티 소스에 골라서 추가

setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);  //강제 가로
setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);  //강제 세로
setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_SENSOR); //센서대로


두번째 방법
androidmanifest.xml 수정 방법

android:screenOrientation="portrait"

android:screenOrientation="landscape"