Skip to content

Instantly share code, notes, and snippets.

View khkred's full-sized avatar
:octocat:
Releasing our Product Soon

Harish Kunchala khkred

:octocat:
Releasing our Product Soon
  • GotInfo
  • Los Angeles
  • 10:01 (UTC -07:00)
  • LinkedIn in/khkred
View GitHub Profile
public class MainActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
}
/**
* Called when the cookie should be eaten.
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.");
}
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.");
}
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.";
int numberOfSmoothiesTillPrize = 10;
if (numberOfSmoothiesTillPrize > 9) {
Log.v("SmoothieActivity", "Congratulations, you get a free smoothie!");
numberOfSmoothiesTillPrize = numberOfSmoothiesTillPrize - 10;
} else {
Log.v("SmoothieActivity", "No free smoothie this time.");
}
Log.v("SmoothieActivity", "You currently have " + numberOfSmoothiesTillPrize + " out of 10 smoothies needed for your next free
@khkred
khkred / strings.xml
Last active November 10, 2020 14:09
Spanish
<?xml version="1.0" encoding="utf-8"?>
<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
<!-- Title for the application. [CHAR LIMIT=12] -->
<string name="app_name">Sólo Java</string>
<!-- Hint text display in the empty field for the user's name [CHAR LIMIT=20] -->
<string name="name">Nombre</string>
<!-- Hint text display in the empty field for the user's name [CHAR LIMIT=20] -->
<string name="toppings">Ingredientes</string>
@khkred
khkred / MainActivity.java
Created June 29, 2018 06:01
calculate price method updated with toppings
private int calculatePrice(int quantity) {
boolean whippedCreamStatus = whippedCreamCheckBox.isChecked();
boolean chocolateStatus = chocolateCheckBox.isChecked();
int whippedCreamTopping = 0;
int chocolateTopping =0;
if(whippedCreamStatus)
public class MainActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
whippedCreamCheckBox = findViewById(R.id.whipped_cream_check_box);
chocolateCheckBox = findViewById(R.id.chocolate_check_box);
<TextView
style="@style/HeaderTextStyle"
android:padding="8dp"
android:text="TOPPINGS" />
<CheckBox
android:id="@+id/whipped_cream_check_box"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingLeft="24dp"
/*
* Copyright (C) 2016 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