public class MainActivity extends Activity {
@Override
protected void onCreate(Bundle savedInstanceState) {
requestWindowFeature(Window.FEATURE_NO_TITLE); // 타이틀바 없음
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
WebView webView = (WebView)findViewById(R.id.webView);
webView.setWebViewClient(new WebViewClient());
webView.clearCache(true); // 캐쉬 삭제
webView.getSettings().setJavaScriptEnabled(true); // 자바스크립트 사용 여부
/*
webView.getSettings().setSaveFormData(false); // 비밀번호저장 사용 안함
webView.getSettings().setSavePassword(false); // 폼 데이터 저장(자동완성) 사용 안함
webView.getSettings().setBuiltInZoomControls(false); // 멀티줌 사용 안함
webView.getSettings().setSupportZoom(false); // 줌 사용 안함
webView.setVerticalScrollBarEnabled(false); // 세로 스크롤바 사용 안함
webView.setHorizontalScrollBarEnabled(false); // 가로 스크롤바 사용 안함
*/
webView.loadUrl("http://google.com");
}
@Override
public boolean onKeyDown(int keyCode, KeyEvent event) {
// TODO Auto-generated method stub
if(keyCode == KeyEvent.KEYCODE_BACK){
if(webView.canGoBack()){
webView.goBack();
return false;
} else{
// else 인 경우 코드 추가
}
return super.onKeyDown(keyCode, event);
}
}
2013년 9월 27일 금요일
[AnDrOiD] WebView 의 간단한 예제
[AnDrOiD] 타이틀바 안보이도록 설정
1. Using JAVA CODE
2. Using AndroidManifast.xml
requestWindowFeature(Window.FEATURE_NO_TITLE);
2. Using AndroidManifast.xml
<activity android:name=".ActivityMain" android:theme="@android:style/Theme.NoTitleBar"> <activity android:name=".ActivityMain" android:theme="@android:style/Theme.NoTitleBar.Fullscreen">
2013년 9월 25일 수요일
[AnDrOiD] inflater 의 간단한 예제
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
LinearLayout linearLayout = (LinearLayout)findViewById(R.id.linearLayout);
LayoutInflater inflater = (LayoutInflater)getSystemService(Context.LAYOUT_INFLATER_SERVICE);
inflater.inflate(R.layout.activity_test, linearLayout, true);
}
[AnDrOiD] xml 파일 include 예제
1. activity_main.xml 의 내용
2. activity_import_test.xml 의 내용
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical" >
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal" >
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="center_horizontal"
android:text="테스트" />
<EditText
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:inputType="numberSigned" />
</LinearLayout>
<include layout="@layout/activity_import_test" />
</LinearLayout>
2. activity_import_test.xml 의 내용
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >
<EditText
android:id="@+id/editText1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:ems="10"
android:hint="테스트용 입니다." />
</LinearLayout>
2013년 9월 23일 월요일
[AnDrOiD] 파라메터 전달 간단한 예제
MainActivity.java 의 파일 내용
package com.example.androidexam;
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.Toast;
public class MainActivity extends Activity implements View.OnClickListener{
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
Button btnTest1 = (Button)findViewById(R.id.btnTest1);
btnTest1.setOnClickListener(this);
}
@Override
public void onClick(View v) {
// TODO Auto-generated method stub
switch(v.getId()){
case R.id.btnTest1:
Intent intent = new Intent(getBaseContext(), SubActivity.class);
intent.putExtra("name", "홍길동");
intent.putExtra("age", 29);
startActivity(intent);
break;
case R.id.btnTest2:
Toast.makeText(getBaseContext(), "btnTest2 클릭", Toast.LENGTH_SHORT).show();
break;
default:
break;
}
}
}
SubActivity.java 의 파일 내용
package com.example.androidexam;
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.widget.Toast;
public class SubActivity extends Activity {
@Override
protected void onCreate(Bundle savedInstanceState) {
// TODO Auto-generated method stub
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_sub);
Intent intent = new Intent(this.getIntent());
String name = intent.getStringExtra("name");
int age = intent.getIntExtra("age", 1);
Toast.makeText(getBaseContext(), name + "님의 나이는 " + age + "입니다.", Toast.LENGTH_SHORT).show();
}
}
2013년 8월 18일 일요일
[EtC] HTTP 에러코드(HTTP Error Code)
100 : Continue
101 : Switching protocols
200 : OK, 에러없이 전송 성공
201 : Created, POST 명령 실행 및 성공
202 : Accepted, 서버가 클라이언트 명령을 받음
203 : Non-authoritative information, 서버가 클라이언트 요구 중 일부만 전송
204 : No content, 클라언트 요구을 처리했으나 전송할 데이터가 없음
205 : Reset content
206 : Partial content
300 : Multiple choices, 최근에 옮겨진 데이터를 요청
301 : Moved permanently, 요구한 데이터를 변경된 임시 URL에서 찾았음
302 : Moved temporarily, 요구한 데이터가 변경된 URL에 있음을 명시
303 : See other, 요구한 데이터를 변경하지 않았기 때문에 문제가 있음
304 : Not modified
305 : Use proxy
400 : Bad request, 클라이언트의 잘못된 요청으로 처리할 수 없음
401 : Unauthorized, 클라이언트의 인증 실패
402 : Payment required, 예약됨
403 : Forbidden, 접근이 거부된 문서를 요청함
404 : Not found, 문서를 찾을 수 없음
405 : Method not allowed, 리소스를 허용안함
406 : Not acceptable, 허용할 수 없음
407 : Proxy authentication required, 프록시 인증 필요
408 : Request timeout, 요청시간이 지남
409 : Conflict
410 : Gone, 영구적으로 사용할 수 없음
411 : Length required
412 : Precondition failed, 전체조건 실패
413 : Request entity too large,
414 : Request-URI too long, URL이 너무 김
415 : Unsupported media type
500 : Internal server error, 내부서버 오류(잘못된 스크립트 실행시)
501 : Not implemented, 클라이언트에서 서버가 수행할 수 없는 행동을 요구함
502 : Bad gateway, 서버의 과부하 상태
503 : Service unavailable, 외부 서비스가 죽었거나 현재 멈춤 상태
504 : Gateway timeout
505 : HTTP version not supported
101 : Switching protocols
200 : OK, 에러없이 전송 성공
201 : Created, POST 명령 실행 및 성공
202 : Accepted, 서버가 클라이언트 명령을 받음
203 : Non-authoritative information, 서버가 클라이언트 요구 중 일부만 전송
204 : No content, 클라언트 요구을 처리했으나 전송할 데이터가 없음
205 : Reset content
206 : Partial content
300 : Multiple choices, 최근에 옮겨진 데이터를 요청
301 : Moved permanently, 요구한 데이터를 변경된 임시 URL에서 찾았음
302 : Moved temporarily, 요구한 데이터가 변경된 URL에 있음을 명시
303 : See other, 요구한 데이터를 변경하지 않았기 때문에 문제가 있음
304 : Not modified
305 : Use proxy
400 : Bad request, 클라이언트의 잘못된 요청으로 처리할 수 없음
401 : Unauthorized, 클라이언트의 인증 실패
402 : Payment required, 예약됨
403 : Forbidden, 접근이 거부된 문서를 요청함
404 : Not found, 문서를 찾을 수 없음
405 : Method not allowed, 리소스를 허용안함
406 : Not acceptable, 허용할 수 없음
407 : Proxy authentication required, 프록시 인증 필요
408 : Request timeout, 요청시간이 지남
409 : Conflict
410 : Gone, 영구적으로 사용할 수 없음
411 : Length required
412 : Precondition failed, 전체조건 실패
413 : Request entity too large,
414 : Request-URI too long, URL이 너무 김
415 : Unsupported media type
500 : Internal server error, 내부서버 오류(잘못된 스크립트 실행시)
501 : Not implemented, 클라이언트에서 서버가 수행할 수 없는 행동을 요구함
502 : Bad gateway, 서버의 과부하 상태
503 : Service unavailable, 외부 서비스가 죽었거나 현재 멈춤 상태
504 : Gateway timeout
505 : HTTP version not supported
2013년 8월 15일 목요일
[EtC] 윈도우 정품인증 0xC004C020
옛날 하고 아주 먼 옛날에 어느 회사 프로젝트에 투입이 되어서, 시디키 주면서 운영체제를
새로 설치 하라고 해서 새로 설치 했는데, 해당 시디키가 사용 갯수 초과.
이 상태로 3일 기다리다가 해적 인증 하라고...ㅡ,.ㅡ;
2013년 7월 29일 월요일
2013년 7월 4일 목요일
[EtC] Spring3.x - properties 파일을 xml 로 바꾸자.
원문 : http://umsh86.tistory.com/category/spring
1. 설정 값이 들어 있는 xml 파일. 이 문서에서는 mobileWeb-properties.xml 파일.
<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE properties SYSTEM "http://java.sun.com/dtd/properties.dtd" > <properties> <comment>comment here</comment> <entry key="TestMessage">이 값은 mobileWeb-properties.xml 에 들어 있는 값 입니다.</entry> </properties>
2. beans가 등록된 xml 파일. 이 문서에서는 mobileWeb-servlet.xml 파일.
<?xml version="1.0" encoding="UTF-8"?> <beans xmlns="http://www.springframework.org/schema/beans" ...중략... xmlns:util="http://www.springframework.org/schema/util" xsi:schemaLocation="http://www.springframework.org/schema/beans" ...중략... http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util.xsd" > <!-- 설정값이 들어 있는 xml 파일 --> <util:properties id="config" location="/WEB-INF/config/mobileWeb-properties.xml"></util:properties>
3. xml 문서에서 값을 가져다 쓰기.
<property name="myValue" value="#{config['TestMessage']}">
... 중략 ...
</property>
4. jsp 에서 값을 가져다 쓰기.
<!-- xml의 설정 값을 읽어 오기 위한 부분 --> <%@ taglib uri="http://www.springframework.org/tags" prefix="spring"%> ... 중략 ... <body> ... 중략 ... <spring:eval expression="@config['TestMessage']"></spring:eval><br> </body>
5. SpEL을 이용해서 Java에서 사용하는 방법.
@Value("#{config['TestMessage']}") String TestMessage;
피드 구독하기:
글
(Atom)


