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
| /* | |
| * Copyright (C) 2014 The Android Open Source Project | |
| * | |
| * Licensed under the Apache License, Version 2.0 (the "License"); | |
| * you may not use this file except in compliance with the License. | |
| * You may obtain a copy of the License at | |
| * | |
| * http://www.apache.org/licenses/LICENSE-2.0 | |
| * | |
| * Unless required by applicable law or agreed to in writing, software |
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
| package com.example.android.justjava; | |
| import android.os.Bundle; | |
| import android.support.v7.app.AppCompatActivity; | |
| import android.view.View; | |
| import android.widget.CheckBox; | |
| import android.widget.TextView; | |
| /** | |
| * This app displays an order form to order coffee. |
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
| <ScrollView xmlns:android="http://schemas.android.com/apk/res/android" | |
| xmlns:tools="http://schemas.android.com/tools" | |
| android:layout_width="match_parent" | |
| android:layout_height="match_parent" | |
| tools:context=".MainActivity"> | |
| <LinearLayout | |
| android:layout_width="match_parent" | |
| android:layout_height="match_parent" | |
| android:orientation="vertical" |
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
| int numberOfEmailsInInbox = 0; | |
| int numberOfDraftEmails = 2; | |
| String emailMessage = "You have " + numberOfEmailsInInbox + " emails. "; | |
| String draftMessage = "You have " + numberOfDraftEmails + " email drafts."; | |
| if (numberOfEmailsInInbox == 0) { | |
| emailMessage = "You have no new messages. "; | |
| } | |
| if (numberOfDraftEmails == 0) { | |
| draftMessage = "You have no new drafts."; |
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
| boolean isRaining = false; | |
| Log.v("WeatherActivity", "Thank you for using the WhetherWeather App."); | |
| if (isRaining) { | |
| Log.v("WeatherActivity", "It's raining, better bring an umbrella."); | |
| } else { | |
| Log.v("WeatherActivity", "It's unlikely to rain."); | |
| } |
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
| boolean isRaining = true; | |
| if (isRaining) { | |
| Log.v("WeatherActivity", "It's raining, better bring an umbrella."); | |
| } else { | |
| Log.v("WeatherActivity", "It's unlikely to rain."); | |
| } | |
| Log.v("WeatherActivity", "Thank you for using the WhetherWeather App."); |
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
| /** | |
| * Displays an image, such as an icon. | |
| */ | |
| public class ImageView extends View { | |
| // Resource ID for the source image that should be displayed in the ImageView. | |
| private int mImageId; | |
| // Context of the app | |
| private Context mContext; |
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
| /** | |
| * Displays text to the user. | |
| */ | |
| public class TextView extends View { | |
| // String value | |
| private String mText; | |
| // Text color of the text | |
| private int mTextColor; |