ANDROID APP
Create successful ePaper yourself
Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.
228 บทที่ 9 การทำางานร่วมกับข้อมูล<br />
รูปที่ 9.2 หน้าล็อกอินจากชุดคำาสั่งที่ 9.5<br />
กรรมวิธี: การเรียกใช้หน้าจอแสดงข้อตกลงลิขสิทธิ์ของผู้ใช้งาน<br />
เรามักจะกำหนดให้ระบบแสดงหน้าจอข้อตกลงลิขสิทธิ์ของผู้ใช้งานในการติดตั้งแอพครั้งแรก<br />
และในระหว่างที่เรียกใช้แอพ ถ้าผู้ใช้ไม่ยอมรับข้อตกลงนั้น ระบบก็จะยกเลิกการติดตั้งหรือหยุดทำงาน<br />
แต่ถ้าผู้ใช้ยอมรับข้อตกลง หน้าจอดังกล่าวก็จะไม่แสดงขึ้นอีก<br />
คำสั่งที่ใช้เปิดหน้าจอแสดงข้อตกลงลิขสิทธิ์ของผู้ใช้งานนั้นสามารถเรียกใช้ได้จากคลาส EULA<br />
ตามที่แสดงในชุดคำสั่งที่ 9.7 ซึ่งจะแสดงการใช้ SharedPreferences ร่วมกับตัวแปรแบบบูลีนชื่อ<br />
PREFERENCE_EULA_ACCEPTED เพื่อตรวจสอบว่าผู้ใช้งานได้ยอมรับในข้อตกลงดังกล่าวหรือไม่<br />
ชุดคำสั่งที่ 9.7 src/com/cookbook/eula_example/Eula.java<br />
/*<br />
* Copyright (C) 2008 The Android Open Source Project<br />
*<br />
* Licensed under the Apache License, Version 2.0 (the "License");<br />
* you may not use this file except in compliance with the License.<br />
* You may obtain a copy of the License at<br />
*<br />
* http://www.apache.org/licenses/LICENSE-2.0<br />
*<br />
* Unless required by applicable law or agreed to in writing, software<br />
* distributed under the License is distributed on an "AS IS" BASIS,<br />
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.<br />
* See the License for the specific language governing permissions and