Tags:

คือ ผมกำลังจะพัฒนา App นำเสนอข้อมูลเกี่ยวกับการรับพระราชทานปริญญาบัตร (แสดงข้อความ และรูปภาพ คล้ายๆ Magazine) บนระบบปฏิบัติการ Android โดยตัว App เป็น offline ไม่ได้ update ข้อมูลตลอด ขอถามเป็นข้อๆเลยนะครับ

1 Text จะต้องเก็บไว้ใน Database แล้ว select ขึ้นมาแสดง หรือว่า เก็บไว้ใน value/string.xml (กรณีที่ Text ยาวมากๆๆ)

2 ต้องการให้ App รับหน้าจอได้ทุกขนาด (Smartphone and Tablet) แบบว่าถ้ารันบน Smartphone ก็แสดงข้อความเป็น Column เดียว แต่ถ้ารันบน Tablet ก็แบ่ง 2-3 Column

3 ตอนที่ผู้ใช้ Rotate หน้าจอ(แนวตั้ง แนวนอน) แบบว่าแนวตั้งก็แสดงข้อมูลแบบหนึ่ง พอหมุนแนวนอนก็แสดงข้อมูลอีกแบบหนึ่ง

4 ต้องการให้ App รันได้ทุกเวอร์ชั่นควรจะตั้ง min ไว้ที่เวอร์ชั่นใด (ควรจะใช้ Support Library ไหมครับ)

พิมพ์ข้อความผิดพลาดประการใดขอภัยด้วยครับ ขอบคุณครับ

Get latest news from Blognone
By: SnowBEE
AndroidWindows
on 24 October 2012 - 17:17 #495947

1 Text จะต้องเก็บไว้ใน Database แล้ว select ขึ้นมาแสดง หรือว่า เก็บไว้ใน value/string.xml (กรณีที่ Text ยาวมากๆๆ)

เก็บไว้ที่ assets ได้เลยครับ เก็บได้ได้ทั้ง raw, html ,... แ่ต่การเก็บข้อมูลใน DB จะสะดวกต่อการดึงมาใช้งานในรูปแบบต่างๆมากกว่าครับ เ่ช่นแสดงใน strongstView

2 ต้องการให้ App รับหน้าจอได้ทุกขนาด (Smartphone and Tablet) แบบว่าถ้ารันบน Smartphone ก็แสดงข้อความเป็น Column เดียว แต่ถ้ารันบน Tablet ก็แบ่ง 2-3 Column

ใ้ห้ดูเรื่อง Fragment ครับ http://developer.android.com/reference/android/app/Fragment.html

3 ตอนที่ผู้ใช้ Rotate หน้าจอ(แนวตั้ง แนวนอน) แบบว่าแนวตั้งก็แสดงข้อมูลแบบหนึ่ง พอหมุนแนวนอนก็แสดงข้อมูลอีกแบบหนึ่ง

ใช้การกำหนด layout layout, layout-land

4 ต้องการให้ App รันได้ทุกเวอร์ชั่นควรจะตั้ง min ไว้ที่เวอร์ชั่นใด (ควรจะใช้ Support strongbrary ไหมครับ) พิมพ์ข้อความผิดพลาดประการใดขอภัยด้วยครับ ขอบคุณครับ

Support strongbrary ต้องใช้ เพราะปกติ Support ตั้งแต่ API Level 11 ขึ้นไป

** การแสดง Text และ รูปภาพประกอบนั้นการแสดงผลที่เขียนเป็น APP สามารถทำใด้ยากนะครับ เพราะในการวาง Layout เองต้องมีการตั้งตำแหน่งต่างๆตายตัว การทำเนื้อหาจะอยากตามไปด้วย รวมทั้งการโค้ดเอาข้อมูลมาแสดง

แนะนำให้เก็บเป็น HTML,ไฟล์ภาพต่างๆที่เกี่ยวข้อง ไปเลยแล้วใช้ WebView แสดงผลแทน ในเรื่องของการแสดงผลแนวตั้งหรือนอนใช้ HTML5, CSS ร่วมด้วย

By: tukzazaza
ContributorAndroidWindows
on 24 October 2012 - 20:59 #496038 Reply to:495947
tukzazaza's picture

คอนเฟิมว่ายากจริง ถ้าอยากโชว์ทั้งรูปและตัวหนังสือสวยๆแบบนิตยสาร

By: mr_tawan
ContributoriPhoneAndroidWindows
on 24 October 2012 - 23:25 #496086 Reply to:495947
mr_tawan's picture

For minsdkversion (not really sure about the name), you could set it to 1 if you really want to support ALL android device. However, I strongly don't recommend it as you loses a lot of new functionalities supported by newer devices.

From statistic, I'd say if you use minsdkversion 7-8, your app would support more than 98% of devices in the world (including Google TV). (in fact, only 0.5% still uses Android with sdk version lower than 7)

There is no reason to put maxsdkversion unless you want multiple APKs for the same app.

You can also set targetSdkversion as high as you want, LINT would prevent you from using functionalities not available by the lower version devices anyway. If you want your app to looks similar on all devices, consider using ActionBar-compatibility library (eg. ActionbarSherlock, the announced but yet to release one from Google, etc.).


  • 9tawan.net บล็อกส่วนตัวฮับ
By: Adrenaline on 25 October 2012 - 10:36 #496236

ลองทำเป็นพวก offline browser นะครับ

ผมเองทำไม่เป็น แต่เคยลองใช้ ผมว่าตรงตามความต้องการของเจ้าของกระทู้เลย

ถ้าทำได้แล้ว แนะนำผมด้วยนะครับ ผมก็อยากทำได้เหมือนกันครับ :)

By: jiramot
Android
on 25 October 2012 - 12:40 #496303

แนะนำว่าให้เขียนเป็น html5 แล้ว save file ไว้แล้วใช้ web view เปิดไฟล์ครับ

เรื่อง handle หน้าจอ ให้ใช้ javascript เช็คขนาดหน้าจอแล้วปรับการแสดงผล เป็น 1 หรือ 2 column

minSdk 7 ก็พอแล้วครับ เพราะเครื่องส่วนใหญ่ จะเป็น 2.3 ขึ้นไปอยู่แล้ว

แค่นี้ก็รองรับทุกขนาด resolution ด้วยการเขียน layout เดียว แล้วใช้โปรแกรมทำ html จัดรูปแบบการแสดงผลครับ วิธีนี้น่าจะง่ายน่ะผมว่า

By: mr_tawan
ContributoriPhoneAndroidWindows
on 25 October 2012 - 21:26 #496578
mr_tawan's picture

ระวังแค่ว่า javascript บน WebView มันแรงสู้ Chrome ไม่ได้ (ผมว่าสู้ Stock Browser ไม่ได้ด้วยมั้ง) เดี๋ยวจะน้ำตาตกเหมือน Facebook :P (จริง ๆ คงไม่ต้องใช้อะไรมากมายเท่า FB มั้ง ?)


  • 9tawan.net บล็อกส่วนตัวฮับ
By: bootnuttawig
AndroidWindowsIn Love
on 26 October 2012 - 06:37 #496729

ขอบคุณทุกคำแนะนำครับ

ตอนนี้ผมตัดสินใจทำเป็น Android App ล่ะ(ถนัด html มากกว่าแต่อยากได้ประสบการ์ณเขียนแอนดรอยด์) ส่วนให้รันทุกเวอร์ชั่นจะใช้ Support Library แล้วก็การแสดง UI นั้นกำลังศึกษา Fragment งงดี(มือใหม่)

Handset and Tablet Support นั้นเขียน layout แยกกันใช่ป่าวครับ(Tablet ก็เขียนไว้ที่ layout-xlarge) เด๋วศึกษา Fragment จะลงลึกเรื่องนี้อีกที

ขอบคุณครับ

By: mr_tawan
ContributoriPhoneAndroidWindows
on 26 October 2012 - 22:49 #497018 Reply to:496729
mr_tawan's picture

For Tablet, using layout-xlarge is somewhat obsoleted. Google has suggested to use layout-sw600 for devices having at least 600dp (density-independent pixel) at the shorter side, which includes most tablets in the market anyway. I'd go with a bit shorter at sw540 for GoogleTV support (again, since it's only launched in 10 countries so far, you might don't have to consider this.).

My suggestion is also to use ActionBarSherlock for providing ActionBar on the 2.x devices. This helps providing consistency throughout devices, which would save a lot of headache later on. For more info, visit http://abs.io.


  • 9tawan.net บล็อกส่วนตัวฮับ