<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>ไอเอินบล๊อก &#187; Android</title>
	<atom:link href="http://www.iearn.in.th/tag/android/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.iearn.in.th</link>
	<description>Just Play and Just Knowledge</description>
	<lastBuildDate>Fri, 05 Aug 2011 15:10:12 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
		<item>
		<title>ฟังเำพลงใน Android กันเถอะ</title>
		<link>http://www.iearn.in.th/2009/01/08/%e0%b8%9f%e0%b8%b1%e0%b8%87%e0%b9%80%e0%b8%b3%e0%b8%9e%e0%b8%a5%e0%b8%87%e0%b9%83%e0%b8%99-android-%e0%b8%81%e0%b8%b1%e0%b8%99%e0%b9%80%e0%b8%96%e0%b8%ad%e0%b8%b0/</link>
		<comments>http://www.iearn.in.th/2009/01/08/%e0%b8%9f%e0%b8%b1%e0%b8%87%e0%b9%80%e0%b8%b3%e0%b8%9e%e0%b8%a5%e0%b8%87%e0%b9%83%e0%b8%99-android-%e0%b8%81%e0%b8%b1%e0%b8%99%e0%b9%80%e0%b8%96%e0%b8%ad%e0%b8%b0/#comments</comments>
		<pubDate>Wed, 07 Jan 2009 18:42:33 +0000</pubDate>
		<dc:creator>nolifelover</dc:creator>
				<category><![CDATA[Android]]></category>
		<category><![CDATA[android audio]]></category>
		<category><![CDATA[android play music]]></category>
		<category><![CDATA[android xml]]></category>
		<category><![CDATA[music player]]></category>

		<guid isPermaLink="false">http://www.iearn.in.th/?p=17</guid>
		<description><![CDATA[ว่างๆ ไม่มีอะไรทำเลยเอาโค้ดสำหรับไว้ฟังเพลงเผื่อว่าใครต้องการเขียนโปรแกรมสำหรับการฟังเพลง หรือการเล่นเสียงใน android ซึ่งผมว่ามันทำได้ง่ายมากเนื่องจา่ก api ที่ให้มาสามารถที่จะทำให้เราเขียนเจ้าโปรแกรมฟังเพลงนี้ได้อย่าง่ายดาย โดยในส่วนี้เป็นโค้ดที่ผมไปหามาจากใน anddev.org ส่วนกระทุ้ไหนผมจำไม่ได้ละเพราะว่าผมเอาโึค้ดมาป่นๆ กันแล้วเขียนเองบ้างลอกเขามาบ้างแต่ยังไงก็ให้ credit anddev.org นะครับเอาเป็นว่าไปดู source กันดีกว่าครับ MusicPlayer.java import java.io.IOException; import android.app.Activity; import android.media.MediaPlayer; import android.media.MediaPlayer.OnCompletionListener; import android.os.Bundle; import android.view.View; import android.view.View.OnClickListener; import android.widget.Button; &#160; import com.atm.R; &#160; public class MusicPlayer extends Activity &#123; /** Called when the activity is first created. */ @Override public void [...]]]></description>
			<content:encoded><![CDATA[<p style="text-align: center;"><a href="http://www.iearn.in.th/wp-content/uploads/2009/01/music_player.png"><img class="aligncenter size-medium wp-image-19" title="music_player" src="http://www.iearn.in.th/wp-content/uploads/2009/01/music_player-200x300.png" alt="music_player" width="200" height="300" /></a></p>
<p>ว่างๆ ไม่มีอะไรทำเลยเอาโค้ดสำหรับไว้ฟังเพลงเผื่อว่าใครต้องการเขียนโปรแกรมสำหรับการฟังเพลง หรือการเล่นเสียงใน android ซึ่งผมว่ามันทำได้ง่ายมากเนื่องจา่ก api ที่ให้มาสามารถที่จะทำให้เราเขียนเจ้าโปรแกรมฟังเพลงนี้ได้อย่าง่ายดาย โดยในส่วนี้เป็นโค้ดที่ผมไปหามาจากใน anddev.org ส่วนกระทุ้ไหนผมจำไม่ได้ละเพราะว่าผมเอาโึค้ดมาป่นๆ กันแล้วเขียนเองบ้างลอกเขามาบ้างแต่ยังไงก็ให้ credit anddev.org นะครับเอาเป็นว่าไปดู source กันดีกว่าครับ<br />
<span id="more-17"></span></p>
<blockquote><p>MusicPlayer.java</p></blockquote>

<div class="wp_syntax"><div class="code"><pre class="java" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">java.io.IOException</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">android.app.Activity</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">android.media.MediaPlayer</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">android.media.MediaPlayer.OnCompletionListener</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">android.os.Bundle</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">android.view.View</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">android.view.View.OnClickListener</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">android.widget.Button</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">com.atm.R</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">class</span> MusicPlayer <span style="color: #000000; font-weight: bold;">extends</span> Activity <span style="color: #009900;">&#123;</span>
	<span style="color: #008000; font-style: italic; font-weight: bold;">/** Called when the activity is first created. */</span>
	@Override
	<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000066; font-weight: bold;">void</span> onCreate<span style="color: #009900;">&#40;</span>Bundle icicle<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
		<span style="color: #000000; font-weight: bold;">super</span>.<span style="color: #006633;">onCreate</span><span style="color: #009900;">&#40;</span>icicle<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		setContentView<span style="color: #009900;">&#40;</span>R.<span style="color: #006633;">layout</span>.<span style="color: #006633;">music_player</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
		<span style="color: #666666; font-style: italic;">// Find the Button from the xml-file.</span>
		<span style="color: #003399;">Button</span> cmd_play <span style="color: #339933;">=</span> <span style="color: #009900;">&#40;</span><span style="color: #003399;">Button</span><span style="color: #009900;">&#41;</span> <span style="color: #000000; font-weight: bold;">this</span>.<span style="color: #006633;">findViewById</span><span style="color: #009900;">&#40;</span>R.<span style="color: #006633;">id</span>.<span style="color: #006633;">cmd_play</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		cmd_play.<span style="color: #006633;">setOnClickListener</span><span style="color: #009900;">&#40;</span><span style="color: #000000; font-weight: bold;">new</span> OnClickListener<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
&nbsp;
			@Override
			<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000066; font-weight: bold;">void</span> onClick<span style="color: #009900;">&#40;</span><span style="color: #003399;">View</span> arg0<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
				MediaPlayer mp <span style="color: #339933;">=</span> MediaPlayer.<span style="color: #006633;">create</span><span style="color: #009900;">&#40;</span>MusicPlayer.<span style="color: #000000; font-weight: bold;">this</span>,
						R.<span style="color: #006633;">raw</span>.<span style="color: #006633;">fish</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
				<span style="color: #000000; font-weight: bold;">try</span> <span style="color: #009900;">&#123;</span>
					mp.<span style="color: #006633;">prepare</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
				<span style="color: #009900;">&#125;</span> <span style="color: #000000; font-weight: bold;">catch</span> <span style="color: #009900;">&#40;</span><span style="color: #003399;">IllegalStateException</span> e<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
					<span style="color: #666666; font-style: italic;">// TODO Auto-generated catch block</span>
					e.<span style="color: #006633;">printStackTrace</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
				<span style="color: #009900;">&#125;</span> <span style="color: #000000; font-weight: bold;">catch</span> <span style="color: #009900;">&#40;</span><span style="color: #003399;">IOException</span> e<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
					<span style="color: #666666; font-style: italic;">// TODO Auto-generated catch block</span>
					e.<span style="color: #006633;">printStackTrace</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
				<span style="color: #009900;">&#125;</span>
				mp.<span style="color: #006633;">start</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
				<span style="color: #666666; font-style: italic;">// i.e. react on the end of the music-file:</span>
				mp.<span style="color: #006633;">setOnCompletionListener</span><span style="color: #009900;">&#40;</span><span style="color: #000000; font-weight: bold;">new</span> OnCompletionListener<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
&nbsp;
					<span style="color: #666666; font-style: italic;">// @Override</span>
					<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000066; font-weight: bold;">void</span> onCompletion<span style="color: #009900;">&#40;</span>MediaPlayer arg0<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
						<span style="color: #666666; font-style: italic;">// File has ended !!! Wink</span>
					<span style="color: #009900;">&#125;</span>
				<span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
			<span style="color: #009900;">&#125;</span>
		<span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span></pre></div></div>

<blockquote><p>music_player.xml</p></blockquote>

<div class="wp_syntax"><div class="code"><pre class="xml" style="font-family:monospace;"><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;?xml</span> <span style="color: #000066;">version</span>=<span style="color: #ff0000;">&quot;1.0&quot;</span> <span style="color: #000066;">encoding</span>=<span style="color: #ff0000;">&quot;utf-8&quot;</span><span style="color: #000000; font-weight: bold;">?&gt;</span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;LinearLayout</span> <span style="color: #000066;">xmlns:android</span>=<span style="color: #ff0000;">&quot;http://schemas.android.com/apk/res/android&quot;</span></span>
<span style="color: #009900;">	<span style="color: #000066;">android:orientation</span>=<span style="color: #ff0000;">&quot;vertical&quot;</span> <span style="color: #000066;">android:layout_width</span>=<span style="color: #ff0000;">&quot;fill_parent&quot;</span></span>
<span style="color: #009900;">	<span style="color: #000066;">android:layout_height</span>=<span style="color: #ff0000;">&quot;fill_parent&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
	<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;Button</span> <span style="color: #000066;">android:id</span>=<span style="color: #ff0000;">&quot;@+id/cmd_play&quot;</span> <span style="color: #000066;">android:layout_width</span>=<span style="color: #ff0000;">&quot;fill_parent&quot;</span></span>
<span style="color: #009900;">		<span style="color: #000066;">android:layout_height</span>=<span style="color: #ff0000;">&quot;wrap_content&quot;</span></span>
<span style="color: #009900;">		<span style="color: #000066;">android:text</span>=<span style="color: #ff0000;">&quot;Play the music !!!&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/LinearLayout<span style="color: #000000; font-weight: bold;">&gt;</span></span></span></pre></div></div>

<p>หลังจากนั้นก็ทำการเลือกเพลงมาซักเพลงครับ สมมุติว่าเป็น fish.mp3 นะครับ ผมก็ทำการ copy file ไปไว้ที่ raw ครับก็เป็นอันว่าเรียบร้อยสำหรับคนที่เล่นแล้วบอกว่า อ้าว เปิดแล้วไม่มีเสียงมันเสียหรือเปล่า อาจจะเป็นเพราะว่าเรายังไม่ได้ทำการตั้งค่าให้ emulator รู้จักเสียงครับก็ให้เข้่าไปแก้ใน Addition Emulator command line เพิ่มในส่วนนี้ครับ</p>
<blockquote><p>-audio winaudio</p></blockquote>
<p>แค่นี้ก็ฟังเพลงได้แล้วครับ</p>

<p class="sayac_bilgi">63 views</p>
]]></content:encoded>
			<wfw:commentRss>http://www.iearn.in.th/2009/01/08/%e0%b8%9f%e0%b8%b1%e0%b8%87%e0%b9%80%e0%b8%b3%e0%b8%9e%e0%b8%a5%e0%b8%87%e0%b9%83%e0%b8%99-android-%e0%b8%81%e0%b8%b1%e0%b8%99%e0%b9%80%e0%b8%96%e0%b8%ad%e0%b8%b0/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Create SD Card in Android</title>
		<link>http://www.iearn.in.th/2009/01/07/create-sd-card-in-android/</link>
		<comments>http://www.iearn.in.th/2009/01/07/create-sd-card-in-android/#comments</comments>
		<pubDate>Wed, 07 Jan 2009 05:28:41 +0000</pubDate>
		<dc:creator>nolifelover</dc:creator>
				<category><![CDATA[Android]]></category>
		<category><![CDATA[Android Emulator]]></category>
		<category><![CDATA[Emulator]]></category>
		<category><![CDATA[SD Card]]></category>

		<guid isPermaLink="false">http://www.iearn.in.th/?p=13</guid>
		<description><![CDATA[สำหรับหลายคนที่มีปัญหาเมื่อเปิด Android Emulator มาแล้วเมื่อเปิดไปยัง Gallery หรือว่า Music Player แต่ไม่สามารถใช้งานได้เนื่องจากว่าเจ้า Emulator บอกว่าเราไม่ได้เสียบ SD Card อ้าวแล้วอย่างเนี่ย เราจะทำไงละ ช่องเสียบ SD Card ก็ไม่มี อย่าเป็นกังวลครับ Google เขาได้ทำ SD Card ให้กับ Emulator แล้วเหมือนกันครับ หากว่าใครต้องการทราบรยละเีอียดการทำ SD Card ใน Emulator นั้นไม่ยากเลยครับ เริ่มต้นให้ 1.ไปที่ /tools ที่ได้ทำการลง sdk ไว้ครับ mksdcard ตัวอย่างครับ mksdcard 1024M sdcard.img 2.หลังจากนั้นไปที่ Eclipse เพื่อทำการ Set parameter ในการรัน Android ให้รับเจ้า sd card ที่เราสร้างขึ้น [...]]]></description>
			<content:encoded><![CDATA[<p>สำหรับหลายคนที่มีปัญหาเมื่อเปิด Android Emulator มาแล้วเมื่อเปิดไปยัง Gallery หรือว่า Music Player แต่ไม่สามารถใช้งานได้เนื่องจากว่าเจ้า Emulator บอกว่าเราไม่ได้เสียบ SD Card อ้าวแล้วอย่างเนี่ย เราจะทำไงละ ช่องเสียบ SD Card ก็ไม่มี อย่าเป็นกังวลครับ Google เขาได้ทำ SD Card ให้กับ Emulator แล้วเหมือนกันครับ หากว่าใครต้องการทราบรยละเีอียดการทำ SD Card ใน Emulator นั้นไม่ยากเลยครับ เริ่มต้นให้<br />
<span id="more-13"></span><br />
1.ไปที่ /tools ที่ได้ทำการลง sdk ไว้ครับ</p>
<blockquote><p>mksdcard</p></blockquote>
<p>ตัวอย่างครับ</p>
<blockquote><p>mksdcard 1024M sdcard.img</p></blockquote>
<p>2.หลังจากนั้นไปที่ Eclipse เพื่อทำการ Set parameter ในการรัน Android ให้รับเจ้า sd card ที่เราสร้างขึ้น<br />
3.คลิ๊กขวาที่โปรแจค propoties-&gt;run as -&gt; run as dialog เลือก tab target ดูตรงที่ Additions Emulator command line options เพิ่มโค้ดตามนี้ครับ</p>
<blockquote><p>-sdcard</p></blockquote>
<p>คัวอย่างครับ</p>
<blockquote><p>-sdcard E:\Util\android\sdcard.img</p></blockquote>
<p>4.เป็นอันว่าเรียบร้อยครับเราสามาถเข้่าใช้งาน Gallery ได้แล้ว</p>

<p class="sayac_bilgi">65 views</p>
]]></content:encoded>
			<wfw:commentRss>http://www.iearn.in.th/2009/01/07/create-sd-card-in-android/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>การทำ Android Emulator เป็นภาษาไทย</title>
		<link>http://www.iearn.in.th/2008/03/26/%e0%b8%81%e0%b8%b2%e0%b8%a3%e0%b8%97%e0%b8%b3/</link>
		<comments>http://www.iearn.in.th/2008/03/26/%e0%b8%81%e0%b8%b2%e0%b8%a3%e0%b8%97%e0%b8%b3/#comments</comments>
		<pubDate>Wed, 26 Mar 2008 13:24:02 +0000</pubDate>
		<dc:creator>nolifelover</dc:creator>
				<category><![CDATA[Android]]></category>
		<category><![CDATA[Android Emulator]]></category>

		<guid isPermaLink="false">http://www.jaideaw.com/nolifelover/?p=64</guid>
		<description><![CDATA[หลังจากมั่วเรื่อง Google Andoird เบื้องต้นมาแล้วอยากที่จะลองเล่นเน็ตผ่าน Google android browser ปรากฏว่าไม่สามารถอ่านภาษาไทยได้เซ็งๆ ครับ เลยได นั่ง search ดูปรากฏว่า พบใน Ubuntuclub.com ?ครับเลยเอามาเก็บไว้ในบล๊อกตัวเองเผื่อว่าได้ดูครับ นำไฟล์ ramdisk.img โหลดได้จาก link ข้างล่าง ไปวางทับไฟล์ ramdisk.img ตัวเดิมที่อยู่ใน SDK (tool/lib/images/) แล้ว restart emulator แค่นี้ก็พร้อมใช้งานภาษาไทยได้ทันทีครับ เนื่องจากเป็น Thai localizing แบบถาวร (ไม่ได้ใช้การ Upload Fonts ผ่าน ADB เหมือนครั้งก่อน แต่ใช้การ Hack OS) รายแรกๆ คงยังมีข้อผิดพลาดอยู่ มีอะไรแนะนำก็ Comment ไว้เลยครับ Suported SDK: Linux, OS X and Windows [...]]]></description>
			<content:encoded><![CDATA[<p>หลังจากมั่วเรื่อง Google Andoird เบื้องต้นมาแล้วอยากที่จะลองเล่นเน็ตผ่าน Google android browser<br />
ปรากฏว่าไม่สามารถอ่านภาษาไทยได้เซ็งๆ ครับ เลยได นั่ง search ดูปรากฏว่า พบใน Ubuntuclub.com ?ครับเลยเอามาเก็บไว้ในบล๊อกตัวเองเผื่อว่าได้ดูครับ</p>
<p><img SRC="http://files.ubuntuclub.com/lindever/android/ramdisk_th.png" ALT="SDK Androide" TITLE="SDK Androide" ALIGN="middle" WIDTH="491" HEIGHT="327" STYLE="width: 491px; height: 327px" /><br />
นำไฟล์ ramdisk.img โหลดได้จาก link ข้างล่าง ไปวางทับไฟล์ ramdisk.img ตัวเดิมที่อยู่ใน SDK<br />
(tool/lib/images/) แล้ว restart emulator แค่นี้ก็พร้อมใช้งานภาษาไทยได้ทันทีครับ<br />
เนื่องจากเป็น Thai localizing แบบถาวร (ไม่ได้ใช้การ Upload Fonts ผ่าน ADB เหมือนครั้งก่อน<br />
แต่ใช้การ Hack OS) รายแรกๆ คงยังมีข้อผิดพลาดอยู่ มีอะไรแนะนำก็ Comment ไว้เลยครับ<br />
Suported SDK: Linux, OS X and Windows<br />
Download<br />
<a HREF="http://files.ubuntuclub.com/lindever/android/ramdisk.img">http://files.ubuntuclub.com/lindever/android/ramdisk.img</a></p>
<p>ที่มา?<a HREF="http://ubuntuclub.com/node/530" TARGET="_blank">http://ubuntuclub.com/node/530?</a></p>

<p class="sayac_bilgi">295 views</p>
]]></content:encoded>
			<wfw:commentRss>http://www.iearn.in.th/2008/03/26/%e0%b8%81%e0%b8%b2%e0%b8%a3%e0%b8%97%e0%b8%b3/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Access web behind proxy on google android</title>
		<link>http://www.iearn.in.th/2008/03/26/access-web-behind-proxy-on-google-android/</link>
		<comments>http://www.iearn.in.th/2008/03/26/access-web-behind-proxy-on-google-android/#comments</comments>
		<pubDate>Tue, 25 Mar 2008 18:26:11 +0000</pubDate>
		<dc:creator>nolifelover</dc:creator>
				<category><![CDATA[Android]]></category>
		<category><![CDATA[http_proxy]]></category>

		<guid isPermaLink="false">http://www.jaideaw.com/nolifelover/?p=63</guid>
		<description><![CDATA[สวัสดีครับหลังจากที่ไปศึกษา Akelos Framwork ได้ไม่เท่าไร Project โดนยกเลิกครับเลยมาทาม Google Android แทน ฏ้พอลองเล่น Application แล้วปรากฏว่าเล่นเน็ตไม่ได้อะเซ็งเลย ลอง search เลยไปพบอยู่ใน googlegropu เลยเอาวิธีมาเก็บไว้เผื่อว่าเราได้ใช้เอง เอิ๊กๆๆๆ เอมพร่ามมาเยอะละมาเริ่มกันเลยอะ สำหรับการแก้ไขให้เราทำการ Run Emulator ไว้นะครับ จากนั้นเข้าไปที่ sdk ของ android แล้วไปที่ folder tools ครับ 1.เรียก command ขึ้นมาครับ จากนั้นไปที่เราเก็ย SDK ไว้ครับ 2&#8230;&#62; adb shell 3&#8230;&#62; sqlite3 /data/data/com.google.android.providers.settings/databases/settings.db 4 sqlite&#62;INSERT INTO system VALUES (99,&#8217;http_proxy&#8217;,'&#60;YOUR_PROXY_IP_OR_HOST&#62;:&#60;PROXY_PORT_NUMBER&#62;&#8217;); 5. เรียบร้อยครับ retsart emulator ก็ใช้เน็ตได้เลยอะ อ่านไม่รู้เรื่องไปที่นี้ครับ [...]]]></description>
			<content:encoded><![CDATA[<p>สวัสดีครับหลังจากที่ไปศึกษา Akelos Framwork ได้ไม่เท่าไร Project โดนยกเลิกครับเลยมาทาม Google Android แทน ฏ้พอลองเล่น Application แล้วปรากฏว่าเล่นเน็ตไม่ได้อะเซ็งเลย ลอง search เลยไปพบอยู่ใน googlegropu เลยเอาวิธีมาเก็บไว้เผื่อว่าเราได้ใช้เอง เอิ๊กๆๆๆ เอมพร่ามมาเยอะละมาเริ่มกันเลยอะ</p>
<p>สำหรับการแก้ไขให้เราทำการ Run Emulator ไว้นะครับ จากนั้นเข้าไปที่ sdk ของ android แล้วไปที่ folder tools ครับ<span id="more-229"></span></p>
<p>1.เรียก command ขึ้นมาครับ จากนั้นไปที่เราเก็ย SDK ไว้ครับ<br />
2&#8230;&gt; adb shell<br />
3&#8230;&gt; sqlite3 /data/data/com.google.android.providers.settings/databases/settings.db<br />
4 sqlite&gt;INSERT INTO system VALUES (99,&#8217;http_proxy&#8217;,'&lt;YOUR_PROXY_IP_OR_HOST&gt;:&lt;PROXY_PORT_NUMBER&gt;&#8217;);<br />
5. เรียบร้อยครับ retsart emulator ก็ใช้เน็ตได้เลยอะ</p>
<p>อ่านไม่รู้เรื่องไปที่นี้ครับ <a href="http://groups.google.com/group/android-developers/msg/d8cb5935a609b8cc">http://groups.google.com/group/android-developers/msg/d8cb5935a609b8cc</a></p>

<p class="sayac_bilgi">30 views</p>
]]></content:encoded>
			<wfw:commentRss>http://www.iearn.in.th/2008/03/26/access-web-behind-proxy-on-google-android/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How to Program Google Android</title>
		<link>http://www.iearn.in.th/2008/02/07/how-to-program-google-android/</link>
		<comments>http://www.iearn.in.th/2008/02/07/how-to-program-google-android/#comments</comments>
		<pubDate>Thu, 07 Feb 2008 10:53:09 +0000</pubDate>
		<dc:creator>nolifelover</dc:creator>
				<category><![CDATA[Android]]></category>
		<category><![CDATA[Program Android]]></category>

		<guid isPermaLink="false">http://www.jaideaw.com/nolifelover/?p=59</guid>
		<description><![CDATA[So you saw the Android announcement and decided you wanted a piece of that US$10million in prize money huh? In the week since the SDK was released more than 4,300 people have joined the Android support forum posting more than 4,000 messages between them. Robert Scoble doesn&#8217;t know a single developer playing with Android ? [...]]]></description>
			<content:encoded><![CDATA[<p>So you saw the <a href="http://android-developers.blogspot.com/2007/11/posted-by-jason-chen-android-advocate.html">Android announcement</a> and decided you wanted a piece of that US$10million in <a href="http://code.google.com/android/adc.html">prize money</a> huh? In the week since the <acronym title="Software Development Kit">SDK</acronym> was released more than 4,300 people have joined the <a href="http://groups.google.com/group/android-developers">Android support forum</a> posting more than 4,000 messages between them. Robert Scoble <a href="http://scobleizer.com/2007/11/12/google-android-we-want-developers-but/">doesn&#8217;t know</a> a single developer playing with Android ? perhaps Scoble doesn&#8217;t hang around with many developers?</p>
<p><strong>I wanted to give the SDK a good work-out so my application uses the <acronym title="Global Positioning System">GPS</acronym>, the address book, and has a map.</strong></p>
<p>The only way to judge an SDK is getting in there and writing an application that does something cool, so I&#8217;ll take you through the development process for my first Android application: <em>Where Are My Friends?</em></p>
<p><em>WamF</em> shows how far away you are right now from all the people in your address book, plots you and them on a map, and draws lines between you and any friends nearby.</p>
<p><span id="more-225"></span></p>
<p><em>WamF</em> is pretty simple but it makes use of some of the more interesting features of Android ? Location Based Information (GPS etc), maps, the contacts manager, and the phone dialer. Total development time from hitting Download on the SDK page was about 14 hours (spread over two mornings and evenings). <strong>My Android development is in Windows with Eclipse using the plugin, so I will assume you&#8217;re doing the same.</strong>Before I get started here&#8217;s a bit on my background. I&#8217;ve mentioned before that I&#8217;m a C# .NET desktop applications developer in <a href="http://www.linkedin.com/profile?viewProfile=&amp;key=5838021">my real life</a>. It&#8217;s been almost 10 years since I&#8217;ve done anything with Java and I&#8217;ve never done any mobile phone development. With Android I develop in <em>Windows</em> with <em>Eclipse</em> using the Android plugin.</p>
<p>Let&#8217;s start by downloading <a href="http://www.eclipse.org/downloads/download.php?file=/technology/epp/downloads/release/20071103/eclipse-java-europa-fall2-">Eclipse</a> and unzipping it into a new folder. Then download the <a href="http://code.google.com/android/download.html">Android SDK</a> and unzip that into another new folder. Open Eclipse and create a new workspace for Android development.</p>
<p>Install the <a href="http://code.google.com/android/intro/installing.html#installingplugin">Android Plugin</a> by selecting <kbd>Help &gt; Software Updates &gt; Find and Install...</kbd>, and in the dialog box choose <kbd>Search for new Features to install</kbd>. Select <kbd>New Remote Site</kbd> and enter <kbd>https://dl-ssl.google.com/android/eclipse/.</kbd> into the dialog box. Hit OK and accept all the prompts until it&#8217;s installed. Restart Eclipse and you&#8217;re almost ready to rock.</p>
<p><kbd>Select Window &gt; Preferences...</kbd> and select Android, then put the folder where you unzipped the SDK into the SDK Location text box. Hit Apply then OK and you&#8217;re done.</p>
<p><strong>The tutorial and exercises are useful. Do them.</strong></p>
<p>Let&#8217;s make sure everything&#8217;s installed right by creating the <a href="http://code.google.com/android/intro/hello-android.html">Hello Android</a> demo. The Android team have <a href="http://code.google.com/android/intro/hello-android.html">a detailed description</a> of how to do this so I won&#8217;t repeat it here. It&#8217;s worth checking out the <a href="http://code.google.com/android/kb/troubleshooting.html">known bugs</a> if you encounter any problems.</p>
<p>The Android <a href="http://code.google.com/android/documentation.html">documentation</a> is excellent; after you&#8217;ve finished the Hello Android project run through the <a href="http://code.google.com/android/intro/tutorial.html">exercises</a>. They&#8217;re easy to follow and give a good idea of how a &#8216;real&#8217; application fits together.</p>
<p><strong>Design a UI, leveraging one of the sample projects</strong></p>
<p>Onto business. Step one should always be UI design. Figure out what it is you want to tell the user and what actions they&#8217;ll need then develop an interface that will make this as intuitive as possible. To keep things simple I&#8217;m going to base my new project on the <kbd>NotePad</kbd> project used in the tutorial exercises.</p>
<p>I&#8217;ll start by changing the resource strings to change the name of the app, and modifying the <a href="http://code.google.com/android/kb/commontasks.html#addmenuitems">menu options</a> .</p>
<p><strong>Use the Location Based Services to figure out where we are and request updates when we move</strong></p>
<p>Possibly the most enticing of the Android features are the <a href="http://code.google.com/android/toolbox/apis/lbs.html">Location Based Services</a> that give your application geographical context through Location Providers (GPS etc). Android includes a mock provider called &#8216;<kbd>gps</kbd>&#8216; that marches back and forth through San Fransisco. Alternatively you can create your own mock providers in XML.</p>
<p>You use the <kbd>LocationManager</kbd> to find your current position.</p>
<ul><kbd>locationManager = (LocationManager)getSystemService(Context.LOCATION_SERVICE); Location location = locationManager.getCurrentLocation("gps");</kbd></ul>
<p><strong>Iterate over the address book pulling out names, locations, and phone numbers</strong></p>
<p>A less publicized feature of Android is the ability to share content between applications. We&#8217;re going to use this feature to populate our List with our contacts&#8217; names and their current distance from our phone so we create an <kbd>updateList</kbd> method that we call after we&#8217;ve gotten our current location.</p>
<p>Use the <kbd>ContentResolver</kbd> to return a query that provides access to data shared using <a href="http://code.google.com/android/devel/data/contentproviders.html">Content Providers</a>. Queries are returned as <a href="http://code.google.com/android/reference/android/database/Cursor.html">cursors</a> that provide access to the underlying data tables. The data we&#8217;re interested in is accessed using the <a href="http://code.google.com/android/reference/android/provider/Contacts.People.html">People</a> content provider.</p>
<ul><kbd>Cursor c = getContentResolver().query(People.CONTENT_URI, null, null, null, null); startManagingCursor(c);</kbd></ul>
<p>The Cursor is a managed way of controlling your position (Row) in the underlying table. We get access to the data by specifying the column that holds the information we&#8217;re after. Rather than memorising the column index for each Content Provider we can use constants from the <kbd>People</kbd> class as a shortcut.</p>
<ul><kbd>int coordIdx = c.getColumnIndex(People.NOTES); int phoneIdx = c.getColumnIndex(People.PhonesColumns.NUMBER); int nameIdx = c.getColumnIndex(People.NAME);</kbd></ul>
<p>Now iterate over the table using the cursor storing the results in arrays. You&#8217;ll note that we&#8217;re pulling our contacts&#8217; location from the <kbd>Notes</kbd> field. In reality we&#8217;d want to figure this out based on their address using a geocoding lookup.</p>
<ul>
<li>?
<ul><kbd>String name = c.getString(nameIdx);<br />
String coords = c.getString(coordIdx);<br />
String phone = c.getString(phoneIdx);... [ Process the lat/long from the coordinates ] ...<br />
... [ Storing their location under variable loc ] ...String distStr = String.valueOf(location.distanceTo(loc)/1000);<br />
name = name + " (" + distStr + "km)";<br />
listItems.add(name);numbers.add("tel:" + phone); </p>
<p> </p>
<p></kbd></ul>
</li>
<p><kbd>List listItems = new ArrayList();</kbd><kbd>c.first();<br />
do { <kbd>} while(c.next());</kbd></kbd></ul>
<p>Then we assign our list of strings to the array using an ArrayAdapter.</p>
<ul><kbd>ArrayAdapter notes = new ArrayAdapter(this, R.layout.notes_row, items);<br />
setListAdapter(notes);</kbd></ul>
<p><strong>Refresh our list when we move</strong></p>
<p>Given the location sensitive nature of WamF it makes sense to update the display whenever we move. Do this by asking the <kbd>LocationManager</kbd> to trigger a new <kbd>Intent</kbd> when our location provider notices we&#8217;ve moved.</p>
<ul><kbd>List providers = locationManager.getProviders();<br />
LocationProvider provider = providers.get(0);<br />
Intent intent = new Intent(LOCATION_CHANGED);<br />
locationManager.requestUpdates(provider, minTime, minDistance, intent);</kbd></ul>
<p><a href="http://code.google.com/android/reference/android/content/Intent.html">Intents in Android</a> are like <em>events</em> in traditional event driven programming, so we&#8217;re triggering a <kbd>LOCATION_CHANGED</kbd> event/intent every time we move by a minimum distance after a minimum time. The next step is to create an <kbd>IntentReceiver</kbd> (event handler), so create a new internal class that extends <kbd>IntentReceiver</kbd> and override the <kbd>ReceiveIntent</kbd> event to call our update method.</p>
<ul>
<li>?
<ul>
<li>?
<ul><kbd>updateList();</kbd></ul>
</li>
<p><kbd>@Override<br />
public void onReceiveIntent(Context context, Intent intent) {</kbd> <kbd>}</kbd></ul>
</li>
<p><kbd>public class myIntentReceiver extends IntentReceiver {</kbd> <kbd>}</kbd></ul>
<p>We then have our activity listen for a <kbd>LOCATION_CHANGED</kbd> intent by registering the event handler and specifying the intent it should be listening for (<kbd>LOCATION_CHANGED</kbd>). Do this in the <kbd>onCreate</kbd> method or create a new menu option to start/stop the automatic updates.</p>
<ul><kbd>filter = new IntentFilter(LOCATION_CHANGED);<br />
receiver = new myIntentReceiver();<br />
registerReceiver(receiver, filter);</kbd></ul>
<p>Keep your phone running light by registering / unregistering the receiver when the activity Pauses and Resumes ? there&#8217;s no point in listening for location changes if we can&#8217;t see the list.</p>
<p><strong>Set up a map activity and create an overlay to show where you are in relation to your friends</strong></p>
<p>Half of the fun in having location sensitive information is drawing it on a <a href="http://code.google.com/android/toolbox/google-apis.html">map</a>. Create a new activity class to display a map centered on our current location with markers at our friends locations. While we&#8217;re at it we can draw a line from our position to each of our friends.</p>
<p>The map control itself is called a <kbd>MapView</kbd>, but we can only use a <kbd>MapView</kbd> in a <kbd>MapActivity</kbd>, so we&#8217;ll change the inheritance of this activity to <kbd>MapActivity</kbd>.</p>
<ul><kbd>public class MyMapViewActivity extends MapActivity</kbd></ul>
<p>To <a href="http://code.google.com/android/toolbox/google-apis.html">display the map</a> we need to create a new <kbd>MapView</kbd> and set it as the content for our activity in the <kbd>OnCreate</kbd> method.</p>
<ul><kbd>MapView mapView = new MapView(this);<br />
setContentView(mapView);</kbd></ul>
<p>This will make the <kbd>MapView</kbd> fill the entire screen, so use views like <kbd>LinearLayout</kbd> if we want to create a <a href="http://code.google.com/android/devel/ui/layout.html">more complicated UI layout</a>.</p>
<p>We&#8217;ll want to get access to the <kbd>OverlayController</kbd> and <kbd>MapController</kbd>, so create global variables to store them and assign the references within the <kbd>OnCreate</kbd> method. We&#8217;ll also be using the <kbd>Location</kbd> information, so get a reference to that too. With the references assigned set your map zoom and starting location using the <kbd>MapController</kbd>. When you&#8217;re finished <kbd>OnCreate</kbd> should look something like this.</p>
<ul>
<li>?
<ul><kbd>super.onCreate(icicle);<br />
MapView mapView = new MapView(this);<br />
mapController = mapView.getController();<br />
overlayController = mapView.createOverlayController();<br />
locationManager = (LocationManager)getSystemService(Context.LOCATION_SERVICE);<br />
mapController.zoomTo(9);<br />
setContentView(mMapView);<br />
updateView();</kbd></ul>
</li>
<p><kbd>protected void onCreate(Bundle icicle) {</kbd> <kbd>}</kbd></ul>
<p><kbd>updateView</kbd> is where we do the work. Start by getting our current location and convert the Lat/Long to a map <kbd>Point</kbd>, then centre the map on our current location.</p>
<ul><kbd>Double lat = location.getLatitude()*1E6;<br />
Double lng = location.getLongitude()*1E6;<br />
Point point = new Point(lat.intValue(), lng.intValue());<br />
mapController.centerMapTo(point, false);</kbd></ul>
<p>The only thing left to do on our map is draw markers and link them up with lines. To do this you need to create a new class that extends <kbd>Overlay</kbd>, and add this using the <kbd>OverlayController</kbd>.</p>
<ul><kbd>MyLocationOverlay myLocationOverlay = new MyLocationOverlay();<br />
overlayController.add(myLocationOverlay, true);</kbd></ul>
<p>The work in the Overlay class is done by overriding the draw method.</p>
<ul>
<li>?
<ul>
<li>?
<ul><kbd>... [ draw things here ] ...</kbd></ul>
</li>
<p><kbd>@Override<br />
public void draw(Canvas canvas, PixelCalculator calculator, boolean<br />
shadow) {</kbd> <kbd>}</kbd></ul>
</li>
<p><kbd>protected class MyLocationOverlay extends Overlay {</kbd> <kbd>}</kbd></ul>
<p>I start by drawing a &#8216;marker&#8217; on my current location. There doesn&#8217;t seem to be support for &#8216;traditional&#8217; Google Maps markers but you can achieve the same thing by <a href="http://code.google.com/android/reference/android/graphics/Canvas.html">drawing on the map canvas</a>; I chose to draw small circles as markers. First you need to use the <kbd>PixelCalculator</kbd> to convert your Lat/Long points to screen coordinates, then create a <kbd>Paint</kbd> object to define the colours and settings for your brush. Then paint your markers.</p>
<ul><kbd>int[] screenCoords = new int[2];<br />
calculator.getPointXY(point, screenCoords);<br />
RectF oval = new RectF(...);<br />
Paint paint = new Paint();<br />
paint.setARGB(200, 255, 0, 0);<br />
canvas.drawOval(oval, paint); </kbd></ul>
<p>I add my friends locations the same way as before, iterating over my address book grabbing names and locations. I filter out anyone too far away (say 10km) and draw markers, names (<kbd>drawText</kbd>), and joining lines (<kbd>drawLine</kbd>) to those nearby.</p>
<p><strong>Let&#8217;s make a call</strong></p>
<p>Now we know when we&#8217;re close to our friends, what are we likely to want to do when we&#8217;re close? Drop in! But we&#8217;re polite so we&#8217;ll call them first. Let&#8217;s change our list item click function to call the friend we&#8217;ve clicked. We can do this by firing a <kbd>DIAL_ACTION</kbd> intent.</p>
<ul><kbd>Intent i = new Intent();<br />
i.setAction(DIAL_ACTION);<br />
i.setData(new ContentURI(numbers.get(position)));<br />
startActivity(i);</kbd></ul>
<p>The phone dialer has registered an <kbd>IntentReceiver</kbd> filtered on <kbd>DIAL_ACTION</kbd> so it will react to this.</p>
<p><strong>Android is an environment where the biggest limitation is your imagination</strong></p>
<p>And that&#8217;s it.</p>
<p>I&#8217;ve got a list of a dozen or so changes to make it a little more useful and a half dozen ideas for projects that might actually make it into the running for some of that prize money. My conclusion? Android is everything a development kit should be ? an environment where the biggest limitation is what you can imagine.</p>
<p>From : <a href="http://blogoscoped.com/archive/2007-11-19-n27.html">http://blogoscoped.com/archive/2007-11-19-n27.html</a></p>

<p class="sayac_bilgi">15 views</p>
]]></content:encoded>
			<wfw:commentRss>http://www.iearn.in.th/2008/02/07/how-to-program-google-android/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

