跳到主要內容

【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.


留言

這個網誌中的熱門文章

R 語言翻轉教室-2

Lesson 2 :  Object 入門操作 R的object結構是依照針對資料結構分析所設計的。 最簡單的object 即為 一串數字  。 一般程式語言最簡單的object則為 一個數字。 若要儲存一個向量到變數“x”當中: example: 要用R 建立一個內容為10.4, 5.6, 3.1和6.4的向量, 最常用的方式就是輸入:`c(10.4, 5.6, 3.1, 6.4)` 請同學依照這樣的語法建立一個這樣的向量,並且把它存為變數x。 Ans:x <- c(10.4, 5.6, 3.1, 6.4) 欲求出變數向量的最大最小值: c(min(x), max(x)) 欲求出範圍: range(x) 欲求出向量平均: sum(x)/length(x)(總和/向量長度)

R語言翻轉教室-3【01-RBasic-03-Data-Structure-Object】

*R的物件結構 組成R語言的基本物件結構為「向量」。 向量物件有兩個很重要的屬性: `mode`和`length`。 `mode`代表這個向量的值型態,總共有:`logical`、`integer`、`numeric`、`complex`、`character`和`raw`。 `length`則代表這個向量中值的個數。 list可以裝所有R的物件 所有的R物件都有「屬性」 所有R 物件的attributes都是帶有名字的list。 本課程筆記,出處: R語言翻轉教室 回家作業: 連結

【 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