어떤 심리전도
상대가 뭘 원하는지
상대가 뭘 좋아하는지
상대가 뭘 싫어하는지
상대가 뭘 생각하는지만 알면
세상의 모든 게임을 당신 뜻대로 움직인다
Hello world
어떤 심리전도
상대가 뭘 원하는지
상대가 뭘 좋아하는지
상대가 뭘 싫어하는지
상대가 뭘 생각하는지만 알면
세상의 모든 게임을 당신 뜻대로 움직인다
[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
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]
[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]
장화신은 고양이 Puss In Boots, 2011
사실 큰 기대를 하고 본건 아니었다.
예매율 1위고 애니메이션이라 무난할 것 같아 선택했는데,
장화신은 고양이의 이 표정!!!! -ㅁ-
귀여워!!!
아이패드2(ipad2) 32G 화이트 구매
펌웨어 4.3.3으로 탈옥이 가능
생각보다 가볍지 않은 무게로 크로스백에 가지고 다니기에는
어깨에 부담이 될 것 같다.
USB를 이용한 파일전송 속도는 18~20Mbyte/s
전/후면 카메라 성능은 기대에 못 미침
일명 김태희백 ㅋㅋ
교환신청하고 무려 2주만에 받았슴….. ㅜ_ㅜ
사이즈 : 31x28x8
색상 : 브라운
재질 : 소가죽
[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!!!”를 출력하도록 했다.
여러가지 이벤트 처리방법이 있는데 가장 간편한 방법이다.