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
@Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
 
        tabHost = (TabHost) findViewById(android.R.id.tabhost);
        tabHost.setup();
 
        tapSpec_1 = tabHost.newTabSpec("TAB_1").setContent(R.id.tab1).setIndicator(getString(R.string.menu_1));
        tabHost.addTab(tapSpec_1);
 
        tapSpec_2 = tabHost.newTabSpec("TAB_2").setContent(R.id.tab2).setIndicator(getString(R.string.menu_2));
        tabHost.addTab(tapSpec_2);
 
        RelativeLayout.LayoutParams tvParams = new RelativeLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT,
                ViewGroup.LayoutParams.WRAP_CONTENT);
 
        RelativeLayout rl1 = (RelativeLayout) tabHost.getTabWidget().getChildAt(0);
//        rl1.setBackgroundResource(R.drawable.tab1_bg);
        rl1.setGravity(Gravity.CENTER_VERTICAL);
        TextView tv1 = (TextView) rl1.getChildAt(1);
        tv1.setLayoutParams(tvParams);
        tv1.setTextAppearance(this, android.R.style.TextAppearance_Medium);
        tv1.setPadding(100100);
        tv1.setGravity(Gravity.CENTER);
cs



1
2
3
4
5
6
7
8
9
10
11
12
13
14
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android" >
    <item 
        android:state_selected="true"
        android:drawable="@drawable/tab1_true"/>
    <item 
        android:state_pressed="true"
        android:drawable="@drawable/tab1_press"/>
    <item 
        android:state_focused="false"
        android:drawable="@drawable/tab1_false"/>
 
</selector>
 
cs


'이것저것 > 자바*안드로이드' 카테고리의 다른 글

안드로이드 현재시간 TextView 출력  (0) 2016.12.20
안드로이드 스튜디오 jar 파일 추가  (0) 2016.12.07
xml 파싱  (0) 2016.11.24
TCP 통신  (0) 2016.11.18
TabHost  (0) 2016.11.09
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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
    Handler handler = new Handler() {
        public void handleMessage(Message msg) {
            Bundle bun = msg.getData();
             
            String xml = bun.getString("response");
             
             
            DocumentBuilderFactory t_dbf = null;
            DocumentBuilder t_db = null;
            org.w3c.dom.Document t_doc = null;
            NodeList ex_nodes = null;
            Node t_node = null;
            Element t_element = null;
            InputSource t_is = new InputSource();
      
            try
            {
                t_dbf = DocumentBuilderFactory.newInstance();
                t_db = t_dbf.newDocumentBuilder();
                t_is = new InputSource();
                t_is.setCharacterStream(new StringReader(xml));
                t_doc = t_db.parse(t_is);
                t_doc.getTextContent();
                 
                 
                ex_nodes = t_doc.getElementsByTagName("Ex");
      
                for (int i = 0, t_len = ex_nodes.getLength();
                        i < t_len; i ++)
                {
                    t_element = (Element)ex_nodes.item(i);
 
                         
                        example.setText(t_element.getTextContent()); 
                   
                     
                }
          
            }
            catch (Exception e)
            {
                e.printStackTrace();
            }
 
 
        }
    };
cs


'이것저것 > 자바*안드로이드' 카테고리의 다른 글

안드로이드 스튜디오 jar 파일 추가  (0) 2016.12.07
TabWidget 탭 이미지 변경  (0) 2016.11.28
TCP 통신  (0) 2016.11.18
TabHost  (0) 2016.11.09
TimePickerDialog  (0) 2016.11.08

$ cd /dev 

  dev폴더로 이동

$ ls

 목록보기, 연결된 dev명 확인

$ screen [디바이스명] [포트번호]  

 screen 명령어, 디바이스명과 포트번호 입력



'이것저것 > Mac*IOS' 카테고리의 다른 글

코코아포드(cocoapods) 설치 및 사용법  (0) 2018.01.18
App 설정으로 이동하기  (0) 2017.09.28
맥 HomeBrew로 Mysql 설치하기  (0) 2016.09.26
맥에 Homebrew 설치  (0) 2016.09.26
맥에서 중국어 입력하기  (0) 2016.09.25

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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
public class TCP_Client extends AsyncTask {
 
    protected static String SERV_IP = "server ip"
    protected static int PORT = 0000;
 
    @Override
    protected Object doInBackground(Object... params) {
        // TODO Auto-generated method stub
 
        
        try {
            Socket sock = new Socket(SERV_IP, PORT);
            DataInputStream input = new DataInputStream(sock.getInputStream());
            DataOutputStream output = new DataOutputStream(sock.getOutputStream());
 
            
            try {
                
                WriteSocket(output);
//                ReadSock(input);
 
 
            } catch (IOException e) {
                e.printStackTrace();
            }
 
        } catch (UnknownHostException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        } catch (IOException e) {
            e.printStackTrace();
        }
 
        return null;
    }
 
    public void WriteSocket(DataOutputStream data) throws IOException {
        // data send
        byte[] bData = new byte[2];
        
 
        bData[0= (byte0x00;
        bData[1= (byte0x00;
   
        
        data.write(bData);
    }
 
    public void ReadSock(DataInputStream data) throws IOException {
        // data recieve
        byte[] datafile = null;
 
        data.read(datafile);
 
    }
}
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
public class MainActivity extends Activity {
 
    private Button btn;
    TCP_Client tc;
 
    public void onCreate(Bundle savedInstanceState) {
 
        super.onCreate(savedInstanceState);
 
        setContentView(R.layout.activity_main);
 
        btn = (Button) findViewById(R.id.Button01);
        btn.setOnClickListener(new View.OnClickListener() {
 
            @Override
            public void onClick(View v) {
                // TODO Auto-generated method stub
                tc = new TCP_Client();
                tc.execute(this);
            }
        });
 
    }
 
}
cs




'이것저것 > 자바*안드로이드' 카테고리의 다른 글

TabWidget 탭 이미지 변경  (0) 2016.11.28
xml 파싱  (0) 2016.11.24
TabHost  (0) 2016.11.09
TimePickerDialog  (0) 2016.11.08
Okhttp jar  (0) 2016.10.27
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
31
32
33
34
35
36
37
38
39
40
tabHost = (TabHost) findViewById(android.R.id.tabhost);
        tabHost.setup();
 
        tapSpec_1 = tabHost.newTabSpec("TAB_1").setContent(R.id.tab1).setIndicator(null,getResources().getDrawable(R.drawable.setting));
        tabHost.addTab(tapSpec_1);
 
        tapSpec_2 = tabHost.newTabSpec("TAB_2").setContent(R.id.tab2).setIndicator(null,getResources().getDrawable(R.drawable.temphum));
        tabHost.addTab(tapSpec_2);
 
        tapSpec_3 = tabHost.newTabSpec("TAB_3").setContent(R.id.tab3).setIndicator(null,getResources().getDrawable(R.drawable.log)); 
        tabHost.addTab(tapSpec_3);
 
        tabHost.setCurrentTab(1);
 
 
        RelativeLayout.LayoutParams tvParams = new RelativeLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT);
 
        RelativeLayout rl1 = (RelativeLayout) tabHost.getTabWidget().getChildAt(0);
        rl1.setGravity(Gravity.CENTER_VERTICAL);
        TextView tv1 = (TextView) rl1.getChildAt(1);
        tv1.setLayoutParams(tvParams);
        tv1.setTextAppearance(this, android.R.style.TextAppearance_Medium);
        tv1.setPadding(100100);
        tv1.setGravity(Gravity.CENTER);
 
        RelativeLayout rl2 = (RelativeLayout) tabHost.getTabWidget().getChildAt(1);
        rl2.setGravity(Gravity.CENTER_VERTICAL);
        TextView tv2 = (TextView) rl2.getChildAt(1);
        tv2.setLayoutParams(tvParams);
        tv2.setTextAppearance(this, android.R.style.TextAppearance_Medium);
        tv2.setPadding(100100);
        tv2.setGravity(Gravity.CENTER);
 
        RelativeLayout rl3 = (RelativeLayout) tabHost.getTabWidget().getChildAt(2);
        rl3.setGravity(Gravity.CENTER_VERTICAL);
        TextView tv3 = (TextView) rl3.getChildAt(1);
        tv3.setLayoutParams(tvParams);
        tv3.setTextAppearance(this, android.R.style.TextAppearance_Medium);
        tv3.setPadding(100100);
        tv3.setGravity(Gravity.CENTER);
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
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical"
    tools:context="${relativePackage}.${activityClass}" >
 
    <TabHost
        android:id="@android:id/tabhost"
        android:layout_width="match_parent"
        android:layout_height="match_parent" >
 
        <FrameLayout
            android:id="@android:id/tabcontent"
            android:layout_width="match_parent"
            android:layout_height="match_parent" >
 
            <LinearLayout
                android:id="@+id/tab1"
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                android:gravity="center"
                android:orientation="vertical"
                android:paddingTop="40dp" >
 
                
            </LinearLayout>
 
            <LinearLayout
                android:id="@+id/tab2"
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                android:gravity="center"
                android:orientation="vertical"
                android:paddingTop="40dp" >
 
                
            </LinearLayout>
 
            <LinearLayout
                android:id="@+id/tab3"
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                android:gravity="center"
                android:orientation="vertical"
                android:paddingTop="63dp" >
 
                
            </LinearLayout>
        </FrameLayout>
 
        <TabWidget
            android:id="@android:id/tabs"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:tabStripEnabled="true" >
        </TabWidget>
    </TabHost>
 
</LinearLayout>
cs


'이것저것 > 자바*안드로이드' 카테고리의 다른 글

xml 파싱  (0) 2016.11.24
TCP 통신  (0) 2016.11.18
TimePickerDialog  (0) 2016.11.08
Okhttp jar  (0) 2016.10.27
다이얼로그 안에 텍스트 입력하기  (0) 2016.10.21
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
31
32
33
        exTv = (TextView) findViewById(R.id.ex_tv);
 
        exBtn = (Button) findViewById(R.id.ex_btn);
 
 
        exBtn.setOnClickListener(new View.OnClickListener() {
 
            @Override
            public void onClick(View v) {
                // TODO Auto-generated method stub
                Calendar time = Calendar.getInstance();
 
                int hour = time.get(Calendar.HOUR_OF_DAY);
                int minute = time.get(Calendar.MINUTE);
 
                TimePickerDialog mTimePicker;
                mTimePicker = new TimePickerDialog(MainActivity.thisnew TimePickerDialog.OnTimeSetListener() {
                    @Override
                    public void onTimeSet(TimePicker timePicker, int selectedHour, int selectedMinute) {
 
                        String hour = Integer.toString(selectedHour);
                        String min = Integer.toString(selectedMinute);
                        exTv.setText(hour + ":" + min);
 
                    }
                }, hour, minute, false);
 
                mTimePicker.setTitle("");
 
                mTimePicker.show();
 
            }
        });
cs


'이것저것 > 자바*안드로이드' 카테고리의 다른 글

TCP 통신  (0) 2016.11.18
TabHost  (0) 2016.11.09
Okhttp jar  (0) 2016.10.27
다이얼로그 안에 텍스트 입력하기  (0) 2016.10.21
안드로이드 뒤로가기(Back 버튼) 두번 눌러 앱 종료하기  (0) 2016.09.08
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
public class Example{
 OkHttpClient client = new OkHttpClient();
    String run(String url) throws IOException {
       Request request = new Request.Builder().url(url).get().addHeader()
             .addHeader()
             .build();
 
       Response response = client.newCall(request).execute();
       return response.body().string();
 
}
}
-------------------------------------------------------------------------
      Example getEx = new Example();        
      String response = getEx.run("받아오는 주소");
cs



OkHttp
Okio



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
AlertDialog.Builder alert = new AlertDialog.Builder(this);
 
        alert.setTitle("Title");
        alert.setMessage("Message");
 
        // Set an EditText view to get user input
        final EditText input = new EditText(this);
        alert.setView(input);
 
        alert.setPositiveButton("Ok"new DialogInterface.OnClickListener() {
            public void onClick(DialogInterface dialog, int whichButton) {
                String value = input.getText().toString();
                value.toString();
                // Do something with value!
            }
        });
 
        alert.setNegativeButton("Cancel",
                new DialogInterface.OnClickListener() {
                    public void onClick(DialogInterface dialog, int whichButton) {
                        // Canceled.
                    }
                });
        
        alert.show(); 
cs


brew install mysql

치면 우선 설치는 된다..

brew doctor // 문제가 있는지 확인을 해본다.
1
2
3
4
5
6
7
You have unlinked kegs in your Cellar
 
Leaving kegs unlinked can lead to build-trouble and cause brews that depend on
 
those kegs to fail to run properly once built. Run `brew link` on these:
 
    mysql
cs

이런 문제가 뜬다.. 설치가 안된건가 해서 다시 설치를 해본다. 그러면

1
Warning: mysql-5.7.15 already installed, it's just not linked
cs

설치는 되었으나 연결이 안됐다는 이상한 소리를 한다.


brew link mysql

그래서 연결시키려면

1
2
3
4
5
6
7
8
brew link mysql
 
Linking /usr/local/Cellar/mysql/5.7.15... 
 
Error: Could not symlink share/doc/mysql
 
 
/usr/local/share/doc is not writable.
cs

이런다.


그래서 구글링을 해보니

http://stackoverflow.com/questions/26647412/homebrew-could-not-symlink-usr-local-bin-is-not-writable

1
2
3
4
5
6
7
I was able to resolve this issue;
 seems this to be an issue non specific to the packages being installed but of the permissions of homebrew folders.
 
sudo chown -R `whoami`:admin /usr/local/bin
For some packages, you may also need to do this to /usr/local/share.
 
sudo chown -R `whoami`:admin /usr/local/share
cs

그.. 그렇다고 한다.. 어쨌든 시키는데로 하고 다시 연결하니

1
2
brew link mysql
Linking /usr/local/Cellar/mysql/5.7.15... 93 symlinks created
cs

되었다.

'이것저것 > Mac*IOS' 카테고리의 다른 글

App 설정으로 이동하기  (0) 2017.09.28
맥 터미널로 시리얼 출력  (0) 2016.11.24
맥에 Homebrew 설치  (0) 2016.09.26
맥에서 중국어 입력하기  (0) 2016.09.25
맥 캘린더에 구글 캘린더 연동하기  (0) 2016.09.25

터미널을 킨다.

/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

↗ 입력한다.

끝.

'이것저것 > Mac*IOS' 카테고리의 다른 글

App 설정으로 이동하기  (0) 2017.09.28
맥 터미널로 시리얼 출력  (0) 2016.11.24
맥 HomeBrew로 Mysql 설치하기  (0) 2016.09.26
맥에서 중국어 입력하기  (0) 2016.09.25
맥 캘린더에 구글 캘린더 연동하기  (0) 2016.09.25

+ Recent posts