웹에 있는 이미지를 읽어서 ImageView에 출력

[code java]
package yell.exam01;

import java.io.FileOutputStream;
import java.io.InputStream;
import org.apache.http.HttpResponse;
import org.apache.http.client.methods.HttpGet;
import org.apache.http.entity.BufferedHttpEntity;
import org.apache.http.impl.client.DefaultHttpClient;

import android.app.Activity;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.os.Bundle;
import android.os.Environment;
import android.util.Log;
import android.view.View;
import android.widget.EditText;
import android.widget.ImageView;
import yell.exam01.R;

public class test_network extends Activity {

/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.test_network);
}

public void mOnClick(View v) {

EditText et = (EditText) findViewById(R.id.textURL);
ImageView iv = (ImageView) findViewById(R.id.imageview1);

if (et.getText().toString() != null) {
try {
HttpGet httpget = new HttpGet(et.getText().toString());
DefaultHttpClient client = new DefaultHttpClient();
HttpResponse response = client.execute(httpget);
InputStream is = new BufferedHttpEntity(response.getEntity()).getContent();

Bitmap bit = BitmapFactory.decodeStream(is);
iv.setImageBitmap(bit);

String path = Environment.getDataDirectory().getAbsolutePath();
path += “/data/yell.exam01/files/test.png”;

Log.d(“YELL”, path);
FileOutputStream fos = new FileOutputStream(path);
bit.compress(Bitmap.CompressFormat.PNG, 100, fos);
}
catch (Exception e) {
// TODO: handle exception
Log.d(“YELL”, e.getMessage());
}
}
}
}
[/code]

쓰레드를 사용해서 웹페이지 소스 가져오기

[code java]
package yell.exam01;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

import org.apache.http.HttpResponse;
import org.apache.http.client.ClientProtocolException;
import org.apache.http.client.ResponseHandler;
import org.apache.http.client.methods.HttpGet;
import org.apache.http.impl.client.DefaultHttpClient;

import android.app.Activity;
import android.os.Bundle;
import android.os.Handler;
import android.os.Message;
import android.util.Log;
import android.view.View;
import android.widget.EditText;
import android.widget.ImageView;
import android.widget.TextView;
import yell.exam01.R;

public class test_network extends Activity {

downloadThread mThread;

/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.test_network);
}

public void mOnClick(View v) {

EditText et = (EditText) findViewById(R.id.textURL);
ImageView iv = (ImageView) findViewById(R.id.imageview1);

if (et.getText().toString() != null) {
mThread = new downloadThread(et.getText().toString());
mThread.start();
}
}

class downloadThread extends Thread {
String mAddr;

public downloadThread(String addr) {
// TODO Auto-generated constructor stub
mAddr = addr;
}

@Override
public void run() {
// TODO Auto-generated method stub
HttpGet httpget = new HttpGet(mAddr);
DefaultHttpClient client = new DefaultHttpClient();
try {
client.execute(httpget, mResHandler);
}
catch (Exception e) {
// TODO: handle exception
}
}

ResponseHandler mResHandler = new ResponseHandler() {
public String handleResponse(HttpResponse response) throws ClientProtocolException, IOException {
// TODO Auto-generated method stub

Log.d(“YELL”, “읽기 스트림 시작”);

StringBuilder html = new StringBuilder();
try {
BufferedReader br = new BufferedReader(new InputStreamReader(response.getEntity().getContent()));
String line = null;
while ((line = br.readLine()) != null) {
html.append(line + “\n”);
}
br.close();

Log.d(“YELL”, “끗~ 메시지 보냄”);
Log.d(“YELL”, html.substring(0, 1000).toString());

Message message = mAfterDown.obtainMessage();
Bundle bundle = new Bundle();
bundle.putString(“result”, html.toString());
message.setData(bundle);
mAfterDown.sendMessage(message);
}
catch (Exception e) {
// TODO: handle exception
}

return html.toString();
}
};

Handler mAfterDown = new Handler() {
public void handleMessage(android.os.Message msg) {
String sResult = msg.getData().getString(“result”);
TextView tv = (TextView) findViewById(R.id.textview_result);
tv.setText(sResult);
};
};
}
}
[/code]

탭(TabHost, TabWidget)

[code java]




[/code]
[code java]
public class TabTest extends TabActivity {

/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.tab_test);

TabHost mTab = getTabHost();
Intent intent;

intent = new Intent().setClass(this, Tab01.class);
mTab.addTab(mTab.newTabSpec(“tag1”).setIndicator(“TAB1”).setContent(intent));

intent = new Intent().setClass(this, Tab02.class);
mTab.addTab(mTab.newTabSpec(“tag2”).setIndicator(“TAB2”).setContent(intent));

intent = new Intent().setClass(this, Tab03.class);
mTab.addTab(mTab.newTabSpec(“tag3”).setIndicator(“TAB3”).setContent(intent));

mTab.setCurrentTab(0);
}
}
[/code]

암시적 인텐트

[code java]
public void mOnClick(View v) {
Intent intent;
switch (v.getId()) {
case R.id.btnWeb:
intent = new Intent(Intent.ACTION_VIEW, Uri.parse(“http://www.yell.co.kr”));
startActivity(intent);
break;

case R.id.btnCall:
intent = new Intent(Intent.ACTION_DIAL, Uri.parse(“tel:010-1234-5678”));
startActivity(intent);
break;

case R.id.btnPhoto:
intent = new Intent(Intent.ACTION_VIEW);
String sd = Environment.getExternalStorageDirectory().getAbsolutePath();
Uri uri = Uri.fromFile(new File(sd + “/devil.jpg”));
intent.setDataAndType(uri, “image/jpeg”);
startActivity(intent);
break;

default:
break;
}
}
[/code]

액티비티간의 통신

[Codejava]
package yell.exam01;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.LinearLayout;
import android.widget.TextView;
import android.widget.Toast;

public class Exam01Activity extends Activity {

TextView mText;
final static int ACT_EDIT = 0;

/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.listview);

mText = (TextView) findViewById(R.id.textView1);
}

public void modifyText(View v) {
switch (v.getId()) {
case R.id.btnModify:
Intent intent = new Intent(this, Exam01_modifyText.class);
intent.putExtra(“TextIn”, mText.getText().toString());
startActivityForResult(intent, ACT_EDIT);
break;

default:
break;
}
}

protected void onActivityResult(int requestCode, int resultCode, Intent data) {
switch (requestCode) {
case ACT_EDIT:
if (resultCode == RESULT_OK) {
mText.setText(data.getStringExtra(“TextOut”));
}
break;

default:
break;
}
}

public void showSubActivity(View v) {
Intent intent = new Intent(this, Exam01SubActivity.class);
startActivity(intent);
}
}
[/code]

[code java]
package yell.exam01;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.EditText;

public class Exam01_modifyText extends Activity {

EditText mEdit;

/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.modifytext);

mEdit = (EditText) findViewById(R.id.editText1);

Intent intent = getIntent();
String text = intent.getStringExtra(“TextIn”);
if (text != null) {
mEdit.setText(text);
}
}

public void mOnClick(View v) {
switch (v.getId()) {
case R.id.btnOk:
Intent intent = new Intent();
intent.putExtra(“TextOut”, mEdit.getText().toString());
setResult(RESULT_OK, intent);
finish();
break;

default:
setResult(RESULT_CANCELED);
finish();
break;
}
}
}
[/code]

아이패드2 32G

아이패드2(ipad2) 32G 화이트 구매

사용자 삽입 이미지

사용자 삽입 이미지

사용자 삽입 이미지

사용자 삽입 이미지

사용자 삽입 이미지

사용자 삽입 이미지

사용자 삽입 이미지

사용자 삽입 이미지

사용자 삽입 이미지

사용자 삽입 이미지

펌웨어 4.3.3으로 탈옥이 가능

생각보다 가볍지 않은 무게로 크로스백에 가지고 다니기에는
어깨에 부담이 될 것 같다.

USB를 이용한 파일전송 속도는 18~20Mbyte/s

전/후면 카메라 성능은 기대에 못 미침

이벤트 처리 > 익명 이너 클래스를 바로 사용

[code java]
package yell.exam01;

import android.app.Activity;
import android.os.Bundle;
import android.view.MotionEvent;
import android.view.View;
import android.widget.LinearLayout;
import android.widget.Toast;

public class Exam01Activity extends Activity {
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);

LinearLayout linear = new LinearLayout(this);
linear.setOnTouchListener(new View.OnTouchListener() {
public boolean onTouch(View v, MotionEvent event) {
if ( event.getAction() == MotionEvent.ACTION_DOWN ) {
Toast.makeText(Exam01Activity.this, “Touched!!!”, Toast.LENGTH_SHORT).show();
return true;
}
return false;
}
});
setContentView(linear);
}
}
[/code]

LinearLayout 객체를 생성한 뒤, 터치 리스너를 등록했다.

리스너에는 MotionEvent.ACTION_DOWN 즉, 화면 터치시 “Touched!!!”를 출력하도록 했다.

여러가지 이벤트 처리방법이 있는데 가장 간편한 방법이다.

jQuery UI Datepicker() / HTML Parsing Error – KB927917

사용자 삽입 이미지

HTML Parsing Error: Unable to modify the parent container element before the child element is closed (KB927917)

jQuery UI 에서 Datapicker 를 사용할 때 인터넷 익스플로러에서 위와 같은 오류가 나올 때가 있다.
항상 오류가 나타나는 것은 아니며,
몇몇 컴퓨터에서만 나타나는 현상이다

[소스]
<input type=”text” id=”sdate” name=”sdate” size=”12″ value=”” />
<script type=”text/javascript”>
<!–
    $(“#sdate”).datepicker({dateFormat: “yy-mm-dd”});
//–>
</script>

[해결방법]
<script type=”text/javascript”>
<!–
    $(function(){
        $(“#sdate”).datepicker({dateFormat: “yy-mm-dd”});
    });
//–>
</script>