跳到主要內容

【Android Development for Beginners】 Lesson 2A : Add TextViews for Price

This Notes is according to the udacity free course :

Android Development for Beginners

Lesson 2A : Add TextViews for Price
===============================

Next Step is to check your app can change "price" on your screen.

First : Add Price and @+id/quantity_text_view to your layout.


Second : copy those code into the MainActivity.java.
paste them here under your left braces

*Under the display method( Like the pic below)

Third: You may notice the NumberFormat was colored in red. Also, displayPrice was colored in gray.

  • NumberFormat : We have to set up "Auto import" so that android studio can recognize them.
    • For Windows, go to File > Settings > Editor > General > Auto Import
    • For Mac, go to Menu Bar > Android Studio > Preferences > Editor > General > Auto Import
  • displayPrice : add displayPrice in the submitOrder.


H.W.


留言

這個網誌中的熱門文章

【Android Development for Beginners】 Lesson 2A : Create a New Project , Plan How to Build the Layout, Build Layout

This Notes is according to the udacity free course : Android Development for Beginners Lesson 2A : Create a New Project Plan How to Build the Layout Build layout Follow the instruction below to build up a new app called "Just Java" use empty activity .

【Android Development for Beginners】Lesson 2A : Update a Variable in the App

This Notes is according to the udacity free course : Android Development for Beginners The Notes below are my own notes in class. Lesson 2A :  Update a Variable in the App When you put new variable in the MainActivity.java you will get a new results when you press the button"+"

【 Android Development for Beginners】 Lesson 3A : Object Oriented Programming - 4

(I think Lesson 3A is the most important but also the most difficult part for beginner so far ) This Notes is according to the udacity free course : Android Development for Beginners Lesson 3A : Object Oriented Programming Call Method on an objects If We want to call a method on an object object variable name . method name ( input argument ); ex: titleTextView.setText("News"); You need to make sure you put a right object so you can call the method