Lab 4: Mastering the Android App debug method and adding a new interface

Source: Internet
Author: User

Fourth chapter, Android application debugging method code listing 4-1 comment out a line of key code (QUIZACTIVITY.JAVA)


Code Listing 4-2 commenting out a line of key code (QUIZACTIVITY.JAVA)


Code Listing 4-3 Convenient and practical debug mode (Quizactivity.java)


Code Listing 4-4 Goodbye, old Friend (Log.d () method) (Quizactivity.java)


Code Listing 4-5 Cancellation code comment (Quizactivity.java)


Code listing 4-6 Mismatched object types (Quizactivity.java)


Code Listing 4-7 correcting type mismatch code errors (Quizactivity.java)

Fifth chapter, add new interface

Code Listing 5-1 Adding a string resource (Strings.xml)


Code Listing 5-2 layout component definition for the second activity (Activity_cheat.xml)


Code Listing 5-3 overrides OnCreate (...) Method (Cheatactivity.java)


Listing 5-4 is declared in the manifest configuration file cheatactivity (androidmanifest.xml)


Code Listing 5-5 Add Cheat button (layout/activity_quiz.xml) in default layout


Listing 5-6 Adding the cheat button to the horizontal layout (layout-land/activity_quiz.xml)


Code listing 5-7 Enabling the Cheat button (Quizactivity.java)


Listing 5-8 starting cheatactivity (Quizactivity.java)


Code listing 5-9 Adding extra constants (Cheatactivity.java)


Listing 5-10 attaching extra to intent (Quizactivity.java)


Code Listing 5-11 getting extra information (Cheatactivity.java)


Code listing 5-12 enabling cheat mode (Cheatactivity.java)


Code Listing 5-13 calls Startactivityforresult (...) Method (Quizactivity.java)


Listing 5-14 Setting the result value (Cheatactivity.java)


Code Listing 5-15 Onactivityresult (...) Implementation of the method (Quizactivity.java)


Code listing 5-16 changing toast messages based on Mischeater variable values (Quizactivity.java)


Code Listing 5-17 Quizactivity is designated as launcher activity (androidmanifest.xml)

Lab 4: Mastering the Android App debug method, adding a new interface

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.