라이브세미나 이어서이니다.
2010년 11월 29일 월요일
2010년 11월 22일 월요일
안드로이드 에어 세미나 자료
안드로이드 에어 세미나 자료를 첨부합니다.
세미나 자료는 아래 주소에서 다운로드 받으시기 바랍니다.
http://wowflex.com/samples.zip
세미나 자료는 아래 주소에서 다운로드 받으시기 바랍니다.
http://wowflex.com/samples.zip
2010년 11월 6일 토요일
2010년 5월 26일 수요일
안드로이드에서 플래시 컨텐트 플레이
다음 코드일 가능성이 높음..
Intent intent = new Intent();
intent.setAction(android.content.Intent.ACTION_VIEW);
File file = new File("/sdcard/SomeGame.swf");
intent.setDataAndType(Uri.fromFile(file), "flash/*");
startActivity(intent);
Intent intent = new Intent();
intent.setAction(android.content.Intent.ACTION_VIEW);
File file = new File("/sdcard/SomeGame.swf");
intent.setDataAndType(Uri.fromFile(file), "flash/*");
startActivity(intent);
2010년 4월 28일 수요일
2010년 4월 16일 금요일
2010년 4월 7일 수요일
2010년 3월 27일 토요일
2010년 3월 25일 목요일
Android에서 비디오 재생하기
public void onCreate(Bundle icicle) {
super.onCreate(icicle);
getWindow().setFormat(PixelFormat.TRANSLUCENT);
videoHolder = new VideoView(this);
videoHolder.setMediaController(new MediaController(this));
setContentView(videoHolder);
// it works fine for .wmv, .3gp and .mp4
// videoHolder.setVideoURI(Uri.parse("file:///sdcard/video.3gp"));
videoHolder.setVideoURI(Uri.parse("file:///sdcard/video.mp4"));
videoHolder.requestFocus();
videoHolder.start();
}
super.onCreate(icicle);
getWindow().setFormat(PixelFormat.TRANSLUCENT);
videoHolder = new VideoView(this);
videoHolder.setMediaController(new MediaController(this));
setContentView(videoHolder);
// it works fine for .wmv, .3gp and .mp4
// videoHolder.setVideoURI(Uri.parse("file:///sdcard/video.3gp"));
videoHolder.setVideoURI(Uri.parse("file:///sdcard/video.mp4"));
videoHolder.requestFocus();
videoHolder.start();
}
2010년 3월 20일 토요일
Android 이미지를 URL로부터 읽어들이기..
< ?xml version="1.0" encoding="utf-8"?>
< LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
>
< TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="Hello World, HTTPImage load test"
/>
< Button id="@+id/get_imagebt"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Get an image"
android:layout_gravity="center"
/>
< ImageView id="@+id/imview"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
/>
< /LinearLayout>
The java code goes like it
import java.io.IOException;
import java.io.InputStream;
import java.net.HttpURLConnection;
import java.net.MalformedURLException;
import java.net.URL;
import java.util.HashMap;
import java.util.Map;
import java.util.Random;
import android.app.Activity;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.ImageView;
public class HTTPTest extends Activity {
ImageView imView;
String imageUrl="http://11.0.6.23/";
Random r;
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle icicle) {
super.onCreate(icicle);
setContentView(R.layout.main);
r= new Random();
Button bt3= (Button)findViewById(R.id.get_imagebt);
bt3.setOnClickListener(getImgListener);
imView = (ImageView)findViewById(R.id.imview);
}
View.OnClickListener getImgListener = new View.OnClickListener()
{
@Override
public void onClick(View view) {
// TODO Auto-generated method stub
//i tried to randomize the file download, in my server i put 4 files with name like
//png0.png, png1.png, png2.png so different file is downloaded in button press
int i =r.nextInt()%4;
downloadFile(imageUrl+"png"+i+".png");
Log.i("im url",imageUrl+"png"+i+".png");
}
};
Bitmap bmImg;
void downloadFile(String fileUrl){
URL myFileUrl =null;
try {
myFileUrl= new URL(fileUrl);
} catch (MalformedURLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
try {
HttpURLConnection conn= (HttpURLConnection)myFileUrl.openConnection();
conn.setDoInput(true);
conn.connect();
int length = conn.getContentLength();
int[] bitmapData =new int[length];
byte[] bitmapData2 =new byte[length];
InputStream is = conn.getInputStream();
bmImg = BitmapFactory.decodeStream(is);
imView.setImageBitmap(bmImg);
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}
Read more: http://getablogger.blogspot.com/2008/01/android-download-image-from-server-and.html#ixzz0ijXC8BDP
< LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
>
< TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="Hello World, HTTPImage load test"
/>
< Button id="@+id/get_imagebt"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Get an image"
android:layout_gravity="center"
/>
< ImageView id="@+id/imview"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
/>
< /LinearLayout>
The java code goes like it
import java.io.IOException;
import java.io.InputStream;
import java.net.HttpURLConnection;
import java.net.MalformedURLException;
import java.net.URL;
import java.util.HashMap;
import java.util.Map;
import java.util.Random;
import android.app.Activity;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.ImageView;
public class HTTPTest extends Activity {
ImageView imView;
String imageUrl="http://11.0.6.23/";
Random r;
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle icicle) {
super.onCreate(icicle);
setContentView(R.layout.main);
r= new Random();
Button bt3= (Button)findViewById(R.id.get_imagebt);
bt3.setOnClickListener(getImgListener);
imView = (ImageView)findViewById(R.id.imview);
}
View.OnClickListener getImgListener = new View.OnClickListener()
{
@Override
public void onClick(View view) {
// TODO Auto-generated method stub
//i tried to randomize the file download, in my server i put 4 files with name like
//png0.png, png1.png, png2.png so different file is downloaded in button press
int i =r.nextInt()%4;
downloadFile(imageUrl+"png"+i+".png");
Log.i("im url",imageUrl+"png"+i+".png");
}
};
Bitmap bmImg;
void downloadFile(String fileUrl){
URL myFileUrl =null;
try {
myFileUrl= new URL(fileUrl);
} catch (MalformedURLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
try {
HttpURLConnection conn= (HttpURLConnection)myFileUrl.openConnection();
conn.setDoInput(true);
conn.connect();
int length = conn.getContentLength();
int[] bitmapData =new int[length];
byte[] bitmapData2 =new byte[length];
InputStream is = conn.getInputStream();
bmImg = BitmapFactory.decodeStream(is);
imView.setImageBitmap(bmImg);
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}
Read more: http://getablogger.blogspot.com/2008/01/android-download-image-from-server-and.html#ixzz0ijXC8BDP
2010년 3월 17일 수요일
자바 1회차 과제
먼저 다음의 클래스를 작성하시오..
Book
CD --> Addition , Music , DVD
그리고 이렇게 상속 구조를 가진 클래스들에서 Lendable 인터페이스를 작성하고 Book 클래스와 Addition 클래스에 구현하고 Buyable 인터페이스는 buy 메소드를 넣어 작성하고 이것을 Book과 Music , DVD에 적용하시오. 그리고 이 모든 클래스의 구동은 BookManager 를 통해서 메인을 작성하시오.
Book
CD --> Addition , Music , DVD
그리고 이렇게 상속 구조를 가진 클래스들에서 Lendable 인터페이스를 작성하고 Book 클래스와 Addition 클래스에 구현하고 Buyable 인터페이스는 buy 메소드를 넣어 작성하고 이것을 Book과 Music , DVD에 적용하시오. 그리고 이 모든 클래스의 구동은 BookManager 를 통해서 메인을 작성하시오.
2010년 3월 15일 월요일
안드로이드 버튼에 아이콘 넣기
Button button = new Button(mContext);
button.setText("Close");
Drawable close = Drawable.createFromPath("/data/icon/image.png");
close.setBounds(0, 0, close.getIntrinsicWidth(), close.getIntrinsicHeight());
button.setCompoundDrawables(close, null, null, null);
button.setText("Close");
Drawable close = Drawable.createFromPath("/data/icon/image.png");
close.setBounds(0, 0, close.getIntrinsicWidth(), close.getIntrinsicHeight());
button.setCompoundDrawables(close, null, null, null);
2010년 3월 10일 수요일
Custome Android List Adapter
public class ItemsList extends ListActivity { private ItemsAdapter adapter; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.items_list); this.adapter = new ItemsAdapter(this, R.layout.items_list_item, ItemManager.getLoadedItems()); setListAdapter(this.adapter); } private class ItemsAdapter extends ArrayAdapter- { private Item[] items; public ItemsAdapter(Context context, int textViewResourceId, Item[] items) { super(context, textViewResourceId, items); this.items = items; } @Override public View getView(int position, View convertView, ViewGroup parent) { View v = convertView; if (v == null) { LayoutInflater vi = (LayoutInflater)getSystemService(Context.LAYOUT_INFLATER_SERVICE); v = vi.inflate(R.layout.items_list_item, null); } Item it = items[position]; if (it != null) { ImageView iv = (ImageView) v.findViewById(R.id.list_item_image); if (iv != null) { iv.setImageDrawable(it.getImage()); } } return v; } } @Override protected void onListItemClick(ListView l, View v, int position, long id) { this.adapter.getItem(position).click(this.getApplicationContext()); } }
2010년 3월 4일 목요일
Android에서 전화번호 정보 불러오기
TelephonyManager mTelephonyMgr =(TelephonyManager)context.getSystemService(Context.TELEPHONY_SERVICE);
String imei = mTelephonyMgr.getDeviceId();
String imei = mTelephonyMgr.getDeviceId();
이 코드를 먼저 준비한다. 이것은 전화번호뿐만 아니라 장치에 대한 정보를 모두 읽어올 수 있다. 이곳에서 getLine1Number 메소드를 호출하면 된다. 그리고 사용자 설정을 위해서 XML 파일에서 설정을 추가해야 한다.
<uses-permission android:name="android.permission.READ_PHONE_STATE" />
Android Custom Title Bar 만들기
반드시 호출 순서를 지켜야 한다.
requestWindowFeature(Window.FEATURE_CUSTOM_TITLE) ;
setContentView(R.layout.main);
getWindow().setFeatureInt(Window.FEATURE_CUSTOM_TITLE,R.layout.application_title) ;
피드 구독하기:
글 (Atom)