전화번호가 있는 안드로이드 폰은 device id 있습니다.
반면에 와이파이버전의 갤럭시탭이나 갤럭시 플레이어는 device id가 없습니다.

안드로이드 폰의 device id와 폰번호를 얻는 방법은 다음과 같습니다.

먼저 Manifest에 다음의 퍼미션을 추가합니다.

<uses-permission android:name="android.permission.READ_PHONE_STATE" />

그리고 다음 코드로 전화번호와 device id를 얻어옵니다.

TelephonyManager telephony = (TelephonyManager)getSystemService(Context.TELEPHONY_SERVICE);
String my_phone_num = telephony.getLine1Number();   //폰번호
String mu_phone_deviceid = telephony.getDeviceId();    //device id


와이파이버전의 갤럭시탭이나 갤럭시 플레이어는 null 값을 반환하기 때문에 코드상에 적당히 null 처리를 해주어야 합니다.


참조 : http://treejsh.tistory.com/1


Mosquitto is a BSD licensed message broker that implements the MQ Telemetry Transport protocol versions 3.1 and 3.1.1.

Mosquitto is a lightweight broker and it is available in binary form for most used platforms like Windows, Linux and Mac OS X.

In a previous post I shown how to install mosquitto, on Raspberry Pirunning raspbian, from source code.

On Mac OS X you could have some error because you should build all the environment for compiling.

Instead you could use brew.

Install brew.

from a terminal run the following commands:

mosquitto_mqtt
$ ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
$ brew doctor
$ brew prune

$ brew install mosquitto

Prepare mosquitto for launchd

$ ln -sfv /usr/local/opt/mosquitto/*.plist ~/Library/LaunchAgents

Run mosquitto

$ launchctl load ~/Library/LaunchAgents/homebrew.mxcl.mosquitto.plist

 

Now let’s try the broker, in the terminal launch the subscriber client:

$ mosquitto_sub -h 127.0.0.1 -t topic/hello

In another terminal launch the publisher client

$ mosquitto_pub -h 127.0.0.1 -t topic/hello -m "Hello world"

in the first terminal you should see the Hello world! message.


참조 : http://www.xappsoftware.com/wordpress/2014/10/30/install-mosquitto-on-mac-os-x/


MQTT client tools

http://www.hivemq.com/blog/seven-best-mqtt-client-tools





'ESP8266' 카테고리의 다른 글

MY ESPRESSIF DEVKIT FOR WINDOWS + ECLIPSE IDE  (0) 2015.11.28

ESP-OPEN-SDK Github

https://github.com/pfalcon/esp-open-sdk


맥 환경에서 Esp8266 개발환경 구축하기

http://tuanpm.net/esp8266-development-kit-on-mac-os-yosemite-and-eclipse-ide/


COULDN'T INSTALL THE TOOLCHAIN ON MY MAC BOOK.

http://www.esp8266.com/viewtopic.php?p=21833

https://github.com/pfalcon/esp-open-sdk/issues/45


gsed -i '1s/^/#include <stddef.h>\n/' crosstool-NG/.build/src/gcc-4.8.2/gcc/graphite.c 

gsed -i '1s/^/#include <stddef.h>\n/' crosstool-NG/.build/src/gcc-4.8.2/gcc/graphite-blocking.c 

gsed -i '1s/^/#include <stddef.h>\n/' crosstool-NG/.build/src/gcc-4.8.2/gcc/graphite-clast-to-gimple.c

gsed -i '1s/^/#include <stddef.h>\n/' crosstool-NG/.build/src/gcc-4.8.2/gcc/graphite-dependences.c 

gsed -i '1s/^/#include <stddef.h>\n/' crosstool-NG/.build/src/gcc-4.8.2/gcc/graphite-interchange.c 

gsed -i '1s/^/#include <stddef.h>\n/' crosstool-NG/.build/src/gcc-4.8.2/gcc/graphite-optimize-isl.c 

gsed -i '1s/^/#include <stddef.h>\n/' crosstool-NG/.build/src/gcc-4.8.2/gcc/graphite-poly.c 

gsed -i '1s/^/#include <stddef.h>\n/' crosstool-NG/.build/src/gcc-4.8.2/gcc/graphite-scop-detection.c 

gsed -i '1s/^/#include <stddef.h>\n/' crosstool-NG/.build/src/gcc-4.8.2/gcc/graphite-sese-to-poly.c



윈도우 환경에서 Esp8266 개발환경 구축하기

http://www.esp8266.com/viewtopic.php?t=820


Instructions for installing and configuring the Unofficial Development Kit for Espressif ESP8266:
1. To download the Windows (145Mb) and install my Unofficial Development Kit for Espressif ESP8266.
2. Download and install the Java Runtime x86 (jre-7uXX-windows-i586.exe)
3. Download and install Eclipse Mars x86 to develop in C ++ (eclipse-cpp-mars-R-win32.zip). Unpack the archive to the root of drive C.
4. Download and install MinGW. Run mingw-get-setup.exe, the installation process to select without GUI, ie uncheck "... also install support for the graphical user interface".
5. Download the (84Mb) my scripts to automate the installation of additional modules for MinGW.
6. Run from my file install-mingw-package.bat. He will establish the basic modules for MinGW, installation should proceed without error.
7. Start the Eclipse Luna from the directory c:\eclipse\eclipse.exe
8. In Eclipse, select File -> Import -> General -> Existing Project into Workspace, in the line Select root directory, select the directory C:\Espressif\examples and import work projects.
Further, the right to select the Make Target project, such as hello-world and run the target All the assembly, while in the console window should display the progress of the build. To select the target firmware flash.




Project Unofficial Development Kit for Espressif ESP8266

http://programs74.ru/udkew-en.html


참조할만한 Esp8266 프로젝트 Github

https://github.com/CHERTS


'ESP8266' 카테고리의 다른 글

Install mosquitto on mac os x  (0) 2015.12.10

A Byte of Python

http://byteofpython-korean.sourceforge.net/byte_of_python.pdf


Python 선 그래프 그리기

http://sijoo.tistory.com/133



http://php.net/manual/kr/language.oop5.php


'PHP' 카테고리의 다른 글

Aptana Studio에 SVN 설치하기  (0) 2015.11.13


http://lifeofcoding.com/2015/01/19/How-to-increase-Android-studio-memory-limit-in-Mac/

참조 : http://denodo1.tistory.com/149


neli 접속 방법

putty 접속시

ip: ec2-54-199-221-176.ap-northeast-1.compute.amazonaws.com

pw: leadweb123456

ssh key: neli_ssh.ppk


securecrt 접속시 

ssh key: neli_ssh_securecrt_Identity



구동정보

tomcat7 

시작: sudo service tomcat7 start
종료: sudo service tomcat7 stop

웹: http://ec2-54-199-221-176.ap-northeast-1.compute.amazonaws.com:8080/manager/status

admin/leadweb123456

mysql

시작: sudo service mysqld start
종료: sudo service mysqld stop


neli

http://ec2-54-199-221-176.ap-northeast-1.compute.amazonaws.com:8080/neli/

/usr/share/tomcat7/webapps/neli


설치순서

AMI t1.micro로 기본 설치 
ssh -i neli_ssh.pem ec2-user@54.199.215.255 접속

한국시간으로 변경 ('AWS 한국시간 변경 참조')


Timezone ?

리눅스를 새로 설치하고 나면 (AWS EC2 AMI도 Linux와 동일) 시간대(Timezone)을 맞추지 않으면, 리눅스의 date가 미국 태평양 시간인 PST로 표시됩니다. 즉 캘리포니아 현지 시간으로 표시됩니다. 이럴경우 한국 표준시인 KST로 변경해주어야 합니다.


Timezone 변경

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
[ec2-user@ip-172-31-7-180 ~]$ date
Fri Aug  8 06:41:49 UTC 2014
 
[ec2-user@ip-172-31-7-180 ~]$ sudo date
Fri Aug  8 06:42:01 UTC 2014
 
[ec2-user@ip-172-31-7-180 ~]$ sudo cat /etc/localtime
TZif2UTCTZif2UTC
UTC0
 
[ec2-user@ip-172-31-7-180 ~]$ sudo rm /etc/localtime
 
[ec2-user@ip-172-31-7-180 ~]$ sudo ln -s /usr/share/zoneinfo/Asia/Seoul /etc/localtime
 
[ec2-user@ip-172-31-7-180 ~]$ date
Fri Aug  8 15:48:27 KST 2014
 
[ec2-user@ip-172-31-7-180 ~]$ sudo date
Fri Aug  8 15:48:40 KST 2014


oracle java 설치 ('AWS 설치 – TimeZone 및 Java 설치')
yum install tomcat7 tomcat7-webapps tomcat7-docs-webapp tomcat7-admin-webapps

sudo service tomcat7 start
sudo service tomcat7 stop
http://ec2-54-199-221-176.ap-northeast-1.compute.amazonaws.com:8080/

yum install mysql-server

sudo service mysqld start
sudo service mysqld stop

mysql_secure_installation

모두 Y

mysql 초기 셋팅
mysqlworkbanch 접속

ssh key 는 .pem 파일 선택

http://www.youtube.com/watch?v=pZFSSVVdqmw

iptables -t nat -I PREROUTING -p tcp --dport 80 -j REDIRECT --to-port 8080

https://console.aws.amazon.com/ec2/v2/home?region=ap-northeast-1#


AWS 접속

https://console.aws.amazon.com/ec2/v2/home?region=ap-northeast-1#

AWS 기본설치

http://www.kimjmin.net/2014/01/aws_1/

AWS 한국시간 변경

sudo vi /etc/profile

TZ=Asia/Seoul
export TZ
source /etc/profile
date


AWS 접속방법(상세)

기본: ssh -i neli_ssh.pem ec2-user@54.199.215.255

puttygen 으로 pem 파일을 로드하여 pub, ppk 파일을 만든다. 
자동으로 ppk 파일이 서버의 .ssh/authorized_keys 파일에 복사 된다.

securecrt에서 create public key를 클릭 pub 파일을 만든다. (DSA 선택)
해당 파일을 AWS에 복사후 
※ssh-keygen -i -f ./Identity.pub >> .ssh/authorized_keys
하기 명령을 공개키를 authorized_keys에 등록 해준다.

암호: leadweb123456

AWS tomcat, mysql 설치

http://coenraets.org/blog/2011/11/set-up-an-amazon-ec2-instance-with-tomcat-and-mysql-5-minutes-tutorial/

mysql 까지 설치가 완료되면,

sudo service mysqld start

위 service로 mysql 구동 하여준다

 그리고mysql의 root 계정 패스워드를 초기화 해주어야 한다

(처음엔 password가 지정되어 있지 않으므로

> mysql -u root

로 접속하면 된다)

접속한 뒤 아래와 같이 비밀번호를 셋팅 해준다


Method 2 - Update or change password

MySQL stores usernames and passwords in the user table inside the MySQL database. You can directly update a password using the following method to update or change passwords:

1) Login to the MySQL server, type the following command at the shell prompt:


$ mysql -u root -p


2) Use the mysql database (type commands at the mysql> prompt):


mysql> use mysql;


3) Change password for a user:


mysql> update user set password=PASSWORD("newpass") where User='ENTER-USER-NAME-HERE';


4) Reload privileges:


mysql> flush privileges;
mysql> quit



AWS 설치 – TimeZone 및 Java 설치

http://www.kimjmin.net/2014/01/aws_2/


mysql 초기 셋팅

[root@ip-172-31-17-71 bin]# mysql -u root -p
Enter password: 
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 9
Server version: 5.5.34 MySQL Community Server (GPL)

Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql> create database neli
-> ;
Query OK, 1 row affected (0.00 sec)

mysql> use neli;
Database changed
mysql> create table test (
-> id integer not null auto_increment,
-> name varchar(255) not null,
-> body text not null,
-> primary key(id)
-> );
Query OK, 0 rows affected (0.03 sec)

mysql> create user 'neli_user'@'localhost' identified by 'leadweb123456';
Query OK, 0 rows affected (0.00 sec)

mysql> grant all privileges on neli.* to 'neli_user'@'localhost';
Query OK, 0 rows affected (0.00 sec)

mysql> flush privileges;
Query OK, 0 rows affected (0.00 sec)

mysql> quit
Bye
[root@ip-172-31-17-71 bin]#


mysql 인코딩 설정

$ vi /etc/my.cnf


[mysql]

default-character-set = utf8


[mysqld]

character-set-client-handshake=FALSE

init_connect="SET collation_connection = utf8_general_ci"

init_connect="SET NAMES utf8"

default-character-set = utf8

character-set-server = utf8

collation-server = utf8_general_ci


datadir=/var/lib/mysql

socket=/var/lib/mysql/mysql.sock

user=mysql

# Disabling symbolic-links is recommended to prevent assorted security risks

symbolic-links=0


[client]

default-character-set = utf8


[mysqldump]

default-character-set = utf8


[mysqld_safe]

log-error=/var/log/mysqld.log

pid-file=/var/run/mysqld/mysqld.pid



그리고 재시작 
$ service mysqld restart 
Stopping MySQL: [ OK ] 
Starting MySQL: [ OK ] 

이제 최종적으로 status를 통해 서버와 mysql의 인코딩이 통일 되었는지 확인해보자 .

mysql> status
--------------
mysql  Ver 14.14 Distrib 5.1.61, for redhat-linux-gnu (x86_64) using readline 5.1

Connection id:          8
Current database:
Current user:           root@localhost
SSL:                    Not in use
Current pager:          stdout
Using outfile:          ''
Using delimiter:        ;
Server version:         5.1.61 Source distribution
Protocol version:       10
Connection:             Localhost via UNIX socket
Server characterset:    utf8
Db     characterset:    utf8
Client characterset:    utf8
Conn.  characterset:    utf8
UNIX socket:            /var/lib/mysql/mysql.sock
Uptime:                 27 min 16 sec

Threads: 1  Questions: 52  Slow queries: 0  Opens: 23  Flush tables: 1  Open tables: 11  Queries per second avg: 0.31
--------------

mysql> show variables like 'c%' ;


1. 소스 내려받기 checkout(= co)


로컬주소(=작업 사본)와 저장소주소 확인

- 로컬주소가 없으면 생성하고 저장소주소에 있는 파일들을 가져온다.

- svn을 처음 설치할 때 사용

- 로컬주소를 생략하면 현재 위치가 로컬주소가 된다.

svn checkout 저장소주소 로컬주소


svn  checkout  {저장소주소}  {로컬주소}


# svn co svn://127.0.0.1/저장소주소

# svn checkout svn://127.0.0.1/저장소 주소




2. 프로젝트 import


전체 파일 업로드

- 서버(svn 저장소주소)에 파일을 업로드 한다.

- 저장소 주소에 업로드 할 디렉토리 (파일을 지정하면 오류가 발생한다.

- 저장소 주소에 처음으로 파일을 업로드 할 때 한번만 사용


svn  import  {업로드할 디렉토리}  {저장소 주소}


# svn  import   /svn/tmp  svn://127.0.0.1/myproject/trunk




3. 소스 최신 버전으로 업데이트

svn upate

#svn update
#svn up




4. 소스 차이점 비교


svn  diff


# svn diff

# svn diff -r 4 (리비전 4와 비교)
# svn diff -r test.c (리비전 4의 test.c 파일의 변경 사항 로그 보기)



5. 소스의 리비전 로그 보기


svn log


# svn log

# svn log -r 4 (리비전 4의 변경사항 로그 보기)

# svn log -r 4 test.c (리비전 4의 test.c파일의 변경사항 로그 보기)

# svn log -r 4:5 (리비전 4~5의 변경사항 로그 보기)




6. 파일 export 하기


* 체크아웃과는 달리 버전 관리 파일들을 뺀 순수한 소스 파일을 받아옴.

svn   export  {저장소 주소}


# svn export http://127.0.0.1/svn/myproject





7. 새로운 파일 추가하기


* 실제 변경사항은 커밋시에 적용됨.

svn add newfile.c





8. 새로운 디렉토리 만들기


* 실제 변경사항은 커밋시에 적용됨.

svn mkdir newdir





9. 파일/디렉토리 삭제하기


* 실제 변경사항은 커밋시에 적용됨.

svn delete[del, rm, remove] newfile.c





10. 파일 이동하기


* 실제 변경사항은 커밋시에 적용됨.

svn move[mv] test.c ./src/




11. 파일 리스트 확인하기


svn list

svn list http://192.168.0.128/svn/sandbox/trunk




12. 이전 작업들 되돌리기


* 커밋전의 작업내용들을 되돌림. 커밋 후에는 되돌릴 수 없음.

svn revert (현재 디렉토리의 작업들 되돌리기)

svn revert newdir (newdir에 작업했던 내용들 되돌리기)




13. 소스 파일에 작업한 내용 확인하기


* 한 소스파일을 대상으로 각 리비전에 대해서 어떤 행을 누가 수정했는지 알아보기 위한 명령.

* 출력 순서는 리비전, 커밋한 사용자의 ID, 소스 순임.


svn blame test.c

svn blame -r 4 test.c




14. 파일 이름 변경하기


* 실제 변경은 커밋시에 적용 됨.

svn  rename  test.c  sample.c




15. 소스 서버 변경하기

svn  switch  --relocate   {이전주소}   {새로운주소}




참조 : 

http://stormaa.tistory.com/122

http://okkks.tistory.com/988




Help -> Install New Software.. 로 들어가서


주소 입력 : http://subclipse.tigris.org/update_1.8.x/


Subclipse 에서 아래의 두 항목을 체크 해제한다.

  • Subclipse Integration for Mylyn 3.x (Optional)
  • Subversion Revision Graph






'PHP' 카테고리의 다른 글

클래스와 객체  (0) 2015.11.26
원하는 Activity의 Oncreate()함수에 아래 코드를 넣으시면 

아무런 입력이 없어도 화면이 꺼지지 않습니다.

getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);


참조 : http://egloos.zum.com/surprisen/v/2027959

/Users/{user_id}/.subversion/config 파일 열어서 내용 추가

global-ignores = *.o *.lo *.la *.al *.so *.so.[0-9]* *.a *.pyc *.pyo
   *.rej *~ #*# .#* .*.swp .DS_Store
   .idea target .git .classpath .project .settings *.iml *.log *.bak *.class *.war *.ear 
   node_modules pom.xml.versionsBackup build local.properties 




Preferences -> Version Control -> Ignored Files


  • File:.idea/workspace.xml
  • File: .gradle
  • Directory: build/
  • Mask: *.iws
  • Directory: .idea/libraries/
  • Directory: app/build/
  • File: local.properties



https://www.liferay.com/web/igor.spasic/blog/-/blogs/global-ignore-files-on-svn-or-how-to-ignore-inteliij-files-at-once


 아래 코드처럼 Handler 객체를 생성하면 "This Handler class should be static or leaks might occur" 경고 메시지가 뜬다. Handler 객체가 정적인 상태가 아니면 메모리 누수가 발생할 수 있다고 경고하는 것인데 해결법을 알아보자.

private Handler mHandler = new Handler() {
public void handleMessage(Message msg) {
switch (msg.what) {
case 0:
mIsPressBackKey = false;
// 2초가 지나면 다시 Falg 를 false로 바꾼다.
debugMessage("handleMessage mFlag : " + mIsPressBackKey);
break;
}
}
};


 메시지 큐에 타켓 핸들러를 가지고 있는 메시지들이 있는 동안, 그 핸들러는 가비지 콜랙션되지 않는다. 

만약에 핸들러가 정적 상태가 아니라면 Activity나 Service는 종료 되더라도 가비지 콜렉션 되지 않는다. 따라서 가비지콜렉터가 메모리를 정리하기 위해서 아래 해결법 처럼 수정해야 한다.



해결법

static class BackkeyProcHandler extends android.os.Handler {
private final WeakReference<MainActivity> mMainFrameActivity;

public BackkeyProcHandler(MainActivity activity) {
mMainFrameActivity = new WeakReference<MainActivity>(activity);
}

@Override
public void handleMessage(Message msg)
{
MainActivity act = mMainFrameActivity.get();
if(act == null) return;

switch (msg.what) {
case 0:
// 2초가 지나면 다시 Falg 를 false로 바꾼다.
act.mIsPressBackKey = false;
break;
}
}
}


참조 : http://stackoverflow.com/questions/11407943/this-handler-class-should-be-static-or-leaks-might-occur-incominghandler

http://d2.naver.com/helloworld/329631


안드로이드 스튜디오에서 Generate signed APK 진행 시 아래의 오류가 날 경우, Key store password와 Alias password가 동일해서 나는 오류 같음.

keytool error Keystore was tampered with, or password was incorrect


때문에 keytool 명령을 이용해서 key store password와 alias 패스워드를 서로 다르게 변경하니 

signed APK가 제대로 생성됨.




해결법

Error


java.io.IOException: Cannot recover key

Solution

The KeyStore password and The Key password should be the same :)
Changing both passwords using keytool

Change KeyStore password
keytool -storepasswd -new newpassword -keystore KeyStore.jks
Change Alias key Password
keytool -keypasswd -alias MyKeyAlias -new newpassword -keystore KeyStore.jks

Note: supply old password for both keystore and alias when asked for 






String str1 = “Hello World!”;

// 변수 str1의 바이트 값

// 72101108108111328711111410810033

bytes[] buffers = str1.getBytes(); 

// 바이트 배열 자체의 문자열 값

// [B@ca0b6

String buffersArrayString = buffers.toString();

// 바이트 배열을 문자열로 변환한 값

// Hello World!

String str2 = new String(buffers);


참조 : http://roadrunner.tistory.com/139


가로 모드 : Landscape

세로 모드 : Portrait



1. Manifaest에서 속성으로 고정하기


화면을 portrait(세로) 화면으로 고정하고 싶은 경우

<activity android:name="com.example.appname.ActivityName"

    android:theme="@style/AppTheme"

    android:screenOrientation="portrait"

</activity>



화면을 landscape(가로) 화면으로 고정하고 싶은 경우

<activity android:name="com.example.appname.ActivityName"

    android:theme="@style/AppTheme"

    android:screenOrientation="landscape">

</activity>




2. 액티비티 실행시 onCreate() 메소드 내부에 지정하기


화면을 portrait(세로) 화면으로 고정하고 싶은 경우

@Override

    public void onCreate(Bundle savedInstanceState)

    {

        super.onCreate(savedInstanceState);


        // 화면을 portrait(세로) 화면으로 고정하고 싶은 경우         

        setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);


        // setContentView()가 호출되기 전에 setRequestedOrientation()이 호출되어야 함

        setContentView(R.layout.main);        

    }



화면을 landscape(가로) 화면으로 고정하고 싶은 경우

@Override

    public void onCreate(Bundle savedInstanceState)

    {

        super.onCreate(savedInstanceState);


        // 화면을 landscape(가로) 화면으로 고정하고 싶은 경우         

        setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);


        // setContentView()가 호출되기 전에 setRequestedOrientation()이 호출되어야 함         

        setContentView(R.layout.main);

    }



Android Studio에서 finished with non-zero exit value 2 오류가 날 경우, 라이브러리 중복 확인과 함께 아래 링크 내용을 확인 하면 된다.


http://stackoverflow.com/questions/28640314/android-studio-fails-to-debug-with-error-org-gradle-process-internal-execexcepti?answertab=oldest#tab-top



해결법

app 레벨에 있는 build.gradle에서 아래와 같이 입력

defaultConfig {
    multiDexEnabled true
}



최신 Android Studio, Google Cloud Messaging 3.0(GCM)을 이용하여 Android 푸시 서비스 구현하기

http://blog.saltfactory.net/android/implement-push-service-via-gcm.html


http://wowan.tistory.com/120



Always “aidl” is missing on Android Studio 1.2.1.1



aidl is missing android studio

http://stackoverflow.com/questions/30506406/aidl-is-missing-android-studio



ViewPager PagerAdapter not updating the View



Update ViewPager dynamically?

http://stackoverflow.com/questions/10849552/update-viewpager-dynamically




<RelativeLayout 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:background="@color/default_background"
android:focusable="true"
android:focusableInTouchMode=
"true"
>



부모 Layout 속성에 focusable, focusableInTouchMode 추가

android:focusable="true"
android:focusableInTouchMode="true"



Layout 작업 중에  아래의 그림처럼 Rendering Problems이 생기는 경우 해결법





Path.isConvex를 지원하지 않는다는 오류가 뜨는데 이 경우 EditText에 적용한 shape style의 corners 태그 때문이다.

안드로이드 스튜디오의 버그처럼 보이는데 다음과 같이 수정하면 깨끗하게 해결된다.



문제의 코드

<corners
android:bottomRightRadius="2dp"
android:bottomLeftRadius="2dp"
android:topLeftRadius="2dp"
android:topRightRadius="2dp"/>


수정

<corners android:radius="2dp"/>


참조 : https://code.google.com/p/android/issues/detail?id=72999




mTxt.setPaintFlags(mTxt.getPaintFlags() | Paint.UNDERLINE_TEXT_FLAG);


Android Studio에서 컴파일 했을 때 Gradle 오류로 

Android java.exe finished with non-zero exit value 1

메시지가 보인다면 drawable resources가 라이브러리나 모듈에서의 종속관계에서 충돌이 원인이다.
해결 방법은 Gradle 메시지에서 충될되는 drawable resource를 찾아서 지우면 해결 됨.

참조


How to dismiss the dialog with click on outside of the dialog?

http://stackoverflow.com/questions/8384067/how-to-dismiss-the-dialog-with-click-on-outside-of-the-dialog


액티비티 전체를 덮는 네비게이션 드로어 만들기

http://androidhuman.tistory.com/560







<!-- Base application theme. -->
<style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar">
<item name="colorPrimary">#FCC248</item>
<item name="colorPrimaryDark">#FFBB00</item>
<item name="colorAccent">#CC3D3D</item>

<!-- toolbar text 색깔 -->
<item name="android:textColorPrimary">@color/white</item>

<!-- 액티비티 윈도우 배경색 -->
<item name="android:windowBackground">@color/white</item>

<!-- 기본 텍스트 색깔 -->
<item name="android:textColor">@color/black</item>

<!-- 메뉴 화살표 색깔 -->
<item name="colorControlNormal">@color/white</item>
</style>

Android styles and themes - Tutorial

http://www.vogella.com/tutorials/AndroidStylesThemes/article.html


ActionBarDrawerToggle v7 arrow color

http://stackoverflow.com/questions/27861102/actionbardrawertoggle-v7-arrow-color


Styling  the Actionbar

https://developer.android.com/training/basics/actionbar/styling.html


Style Resource

http://developer.android.com/guide/topics/resources/style-resource.html


ActionBar text color

http://stackoverflow.com/questions/5861661/actionbar-text-color





보내는 Activity:

     Bitmap -> ByteArray 로 전환 후 Intent의 Extra로 넣어서 전달.

Bitmap bitmap = snapshot;

ByteArrayOutputStream stream = new ByteArrayOutputStream();

bitmap.compress(Bitmap.CompressFormat.PNG, 100, stream);

byte[] byteArray = stream.toByteArray();

Intent intent = new Intent(Activity.this, AnotherActivity.class);

intent.putExtra("image",byteArray);

      startActivity(intent);



받는 Activity:

     ByteArray -> Bitmap으로 전환.

byte[] arr = getIntent().getByteArrayExtra("image");

Bitmap bm = BitmapFactory.decodeByteArray(arr, 0, arr.length);



보낼때 :

     BitmapDrawable d = (BitmapDrawable)(ImageView)view.findViewById(R.id.imageView1)).getDrawable();

     Bitmap b = d.getBitmap();

     imgview.setImageBitmap(b);

     intent.putExtra("bm", (Bitmap)b);


받는 Activity :

        Bitmap bm = (Bitmap)in.getExtras().get("bm");

        imgview.setImageBitmap(bm);

        또는 

        Bitmap bm = (Bitmap)in.getParcelableExtra("bm");

        imgview.setImageBitmap(bm);  


주의

byteArray 사이즈는 40k까지만 전송 가능. 그 이상 크기의 배열을 전송할 경우에는

 !!! FAILED BINDER TRANSACTION !!! 

오류 뜸.


출저 : http://smile8916.tistory.com/72


개요

https://en.wikipedia.org/wiki/Processing_(programming_language)#Hello_World


프로세싱 예제

https://processing.org/examples/keyboard.html


네비게이션 드로어에 머터리얼 디자인 적용하기

http://androidhuman.tistory.com/559



모든 디바이스를 위한 머터리얼 디자인 - AppCompat 라이브러리

http://googledevkr.blogspot.kr/2014/10/appcompat-v21-material-design-for-pre.html



"Back button" using getSupportActionbar and appcompat v7 toolbar

http://stackoverflow.com/questions/27230827/back-button-using-getsupportactionbar-and-appcompat-v7-toolbar

@InjectView(R.id.toolbar)
Toolbar mToolbar;

private void init() {
setSupportActionBar(mToolbar);
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
getSupportActionBar().setHomeButtonEnabled(true);
getSupportActionBar().setDisplayShowHomeEnabled(true);
getSupportActionBar().setHomeAsUpIndicator(R.drawable.abc_ic_ab_back_mtrl_am_alpha);
}

public boolean onOptionsItemSelected(MenuItem item) {
if(item.getItemId() == android.R.id.home) {
debugMessage("press home button");
this.finish();
}
return super.onOptionsItemSelected(item);
}


Setup Toolbar di Appcopat7 v21

https://pratamawijaya.com/programming/setup-toolbar-di-appcompat-7-v21



안드로이드 스타일 > 컬러

https://www.google.com/design/spec/style/color.html#



How do I use DrawerLayout to display over the ActionBar/Toolbar and under the status bar?
http://stackoverflow.com/questions/26440879/how-do-i-use-drawerlayout-to-display-over-the-actionbar-toolbar-and-under-the-st

http://stackoverflow.com/questions/26913770/make-navigation-drawer-draw-behind-status-bar



Android Libraries and Resources

http://alamkanak.github.io/android-libraries-and-resources/



List of Android UI/UX Libraries

https://github.com/wasabeef/awesome-android-ui



Android상에서 Bitmap 처리 관련 링크들 및 Out Of Memory에 대한 개인적인 방안

http://charlie0301.blogspot.kr/2013/08/android-bitmap-out-of-memory.html


Android 개발가이드 - View에 할당한 리소스 완전히 해제하기


Android 개발가이드 - 메모리릭 피하기(Avoiding memory leaks)


Bitmap과 힙메모리에 대한 소고

http://distress.tistory.com/48




+ Recent posts