해당 증상은 기기 내에 backup data가 남아있기 때문이다.

manifest.xml에서

1
2
3
4
5
<application
...
android:allowBackup="false"
...
</application>
cs

추가하면 해결됨.

 

res 폴더 내부에 "font"폴더 생성.

"resource/font/폰트이름.ttf" 파일 넣고

res/values/styles.xml

1
2
3
    <style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar">
        <item name="android:fontFamily">@font/폰트이름</item>
    </style>
 
cs

 

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
    private void showPickerView(){
        final String items[] = {"아이템1","아이템2","아이템3"};
        int mmSelectedNum = 0;
        AlertDialog.Builder mmBuilder = new AlertDialog.Builder(this);
        mmBuilder.setTitle("선택창");
        mmBuilder.setSingleChoiceItems(items, mmSelectedNum, new DialogInterface.OnClickListener() {
            @Override
            public void onClick(DialogInterface dialog, int selected) {
                switch (selected){
                    case 0:
                        Toast.makeText(this"아이템1", Toast.LENGTH_SHORT).show();
                        break;
                    case 1:
                        Toast.makeText(this"아이템2", Toast.LENGTH_SHORT).show();
                        break;
                    case 2:
                        Toast.makeText(this"아이템3", Toast.LENGTH_SHORT).show();
                        break;
                }
            }
        });
        AlertDialog mmAlert = mmBuilder.create();
        mmAlert.setCanceledOnTouchOutside(true);
        mmAlert.show();
    }
cs

 

  • 명령어
1
2
3
$react-native run-ios --simulator="기종 이름"
 
예 ) $react-native run-ios --simulator="iPhone 4s"
cs

 

  • 기종 이름 리스트 출력 명령어
1
$scrum simctl list devices
cs

 

'개발 > React native' 카테고리의 다른 글

[React Native] react native 시작하기, 환경세팅(mac)  (0) 2019.12.10

아래 링크의 react reference를 참고하여 순서대로 설치하면 됨.

 

 

  • Android : (19.12.10 기준) JDK 13은 빌드가 아예안됨..ㅠㅠ 혹시 jdk 버전이 13이면 11로 버전을 바꿔야함.
  • change JDK version 13 to 11 (참고 : https://www.charlezz.com/?p=128)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
// 1. terminal 실행 후 아래 명령어 입력하여 설치된 모든 JDK를 확인함.
$/usr/libexec/java_home -V
 
// 2. 홈으로 이동. 
$cd
 
// 3. bash_profile 에 환경 변수 추가. 'ctrl+x'-'y'-'enter' 버튼을 누르면 저장됨. 
 
// (방법 1)
$sudo nano ~/.bash_profile
// (방법 2)
$nano .bash_profile
 
// 3-1. 환경변수 추가
export JAVA_HOME=/Library/Java/JavaVirtualMachines/버전이름/Contents/Home
 
예 ) export JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk-11.0.5.jdk/Contents/Home
 
// 4. bash_profile 다시 로드.
$source ~/.bash_profile
 
// 5. 자바 버전 확인
$java -version
 
cs

 

  • 프로젝트 생성
1
$react-native init 프로젝트명
cs

 

  • 프로젝트 파일로 이동
1
$cd 생성한프로젝트경로
cs

 

  • ios 실행 방법
1
$react-native run-ios
cs

 

  • android 실행 방법
1
$react-native run-android
cs

 

  • Developer menu 확인 방법
1
2
3
4
5
- ios 에뮬레이터 : cmd + D
 
- android 에뮬레이터 : cmd + M
 
- android 기기 : 흔들면 나옴.
cs

 

'개발 > React native' 카테고리의 다른 글

[React Native] ios virtual machine 기종 변경  (0) 2019.12.10
1
2
3
4
5
Build.SERIAL // is deprecated on API 26.
Build.getSerial() // Use this.
 
//need to set 
<uses-permission android:name="android.permission.READ_PHONE_STATE" />
cs

 

* JSON DATA

1
2
3
4
5
6
7
8
9
10
11
{  // json object node
    "response":{ // json object response
        "header":{ // json object header
            "resultCode":"00",
            "resultMsg":"NORMAL SERVICE."},
        "body":{ // json object body
            "items":{ // json object body
                "item":[ // json array item
                    { //json object node
                        "arrprevstationcnt":9,
                        "arrtime":720,
cs

 

* Parsing source

1
2
3
4
5
6
7
8
  JSONObject mmJsonObject = new JSONObject("JSON DATA").getJSONObject("items");
    JSONArray mmJsonArray = mmJsonObject.getJSONArray("item");
 
        for (int i = 0; i < mmJsonArray.length(); i++) {
            HashMap<StringString> mmBusHash = new HashMap<>();
            JSONObject obj = mmJsonArray.getJSONObject (i);
            mmBusHash.put ( Key.BUS_STOP , obj.getString ( "nodenm" ));
            mmBusHash.put ( Key.BUS_NUM , obj.getString ( "arrtime" ));
cs

 

 

참고 : https://stackoverflow.com/questions/20653106/json-type-mismatch-or-org-json-jsonecxeption

키보드를 숨기는 메소드

1
2
3
4
5
6
7
    private static void hideSoftKeyboard(Activity activity) {
        InputMethodManager inputMethodManager =
                (InputMethodManager) activity.getSystemService(
                        Activity.INPUT_METHOD_SERVICE);
        inputMethodManager.hideSoftInputFromWindow(
                activity.getCurrentFocus().getWindowToken(), 0);
    }
 
cs

 

null exception 방지

1
2
if (This.getCurrentFocus() != null)
            hideSoftKeyboard(This);
cs

 

+ Recent posts