Created
April 29, 2015 00:15
-
-
Save anonymous/f5feae51009b9f8bc956 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* This method displays the given text on the screen. | |
*/ | |
private void displayMessage(String message) { | |
TextView priceTextView = (TextView) findViewById(R.id.price_text_view); | |
priceTextView.setText(message); | |
} |
This string message will help to crash any business in few time!!
public void submit (View view){
String priceTextView = "Free";
displayMessage(priceTextView);
}
/**
- This method displays the given text on the screen.
*/
private void displayMessage(String message) {
TextView priceTextView = (TextView) findViewById(R.id.price_text_view);
priceTextView.setText(message);
}
Thank you! 😊
ok thanks
Thank you
THANK YOU VERY MUCH
Thanksgiving so much
Thanks so much!!
good thank you
"Free"
Thanks!
Very good thank you very much
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
currently the extension to MainActivity in Android Studio is .kt so when I paste de code in Java appears a pop up window with the message to change to kotlin extension but my code is whit 8 errors, I write the right code like catherine said but It still does not work. Can anyone help me?
`package com.example.android.justjava
import android.R
import android.os.Bundle
import android.view.View
import android.widget.TextView
import androidx.appcompat.app.AppCompatActivity
import java.text.NumberFormat
/**
This app displays an order form to order coffee.
*/
class MainActivity : AppCompatActivity() {
var quantity = 0
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_main)
}
/**
This method is called when the increment button is clicked.
*/
fun increment(view: View?) {
var int = quantity
quantity += 1
display (quantity)
}
/**
*/
fun decrement(view: View?) {
var int = quantity
quantity -= 1
display (quantity)
}
/**
*/
fun submitOrder(view: View?) {
String priceMessage = "Free"
displayMessage(priceMessage)
}
/**
*/
private fun display(number: Int) {
val quantityTextView = findViewById(R.id.quantity_text_view) as TextView
quantityTextView.text = "" + number
}
/**
*/
private fun displayPrice(number: Int) {
val priceTextView = findViewById(R.id.price_text_view) as TextView
priceTextView.setText(NumberFormat.getCurrencyInstance().format(number))
}
/**
*/
private fun displayMessage(message: String) {
val priceTextView = findViewById(R.id.price_text_view) as TextView
priceTextView.text = message
}
}`