Advertisement
MtDewFella

SI Calc Code 5

Mar 6th, 2015
192
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 2.49 KB | None | 0 0
  1. /*
  2.  * Copyright (C) 2013 Code Here Now - A subsidiary of Mobs & Geeks
  3.  *
  4.  * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file
  5.  * except in compliance with the License. You may obtain a copy of the License at
  6.  *
  7.  *      http://www.apache.org/licenses/LICENSE-2.0
  8.  *
  9.  * Unless required by applicable law or agreed to in writing, software distributed under the
  10.  * License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
  11.  * either express or implied. See the License for the specific language governing permissions and
  12.  * limitations under the License.
  13.  */
  14. package com.codeherenow.sicalculator;
  15.  
  16. import android.app.Activity;
  17. import android.os.Bundle;
  18. import android.view.View;
  19. import android.widget.Button;
  20. import android.widget.EditText;
  21. import android.widget.TextView;
  22. import android.widget.SeekBar;
  23. import android.widget.Toast;
  24. import android.view.View.OnClickListener;
  25.  
  26.  
  27. public class SICalculatorActivity extends Activity
  28.         implements SeekBar.OnSeekBarChangeListener, View.OnClickListener{
  29.     private TextView YT;
  30.     public String pvalue;
  31.     public String ivalue;
  32.  
  33.  
  34.     @Override
  35.     protected void onCreate(Bundle savedInstanceState) {
  36.         super.onCreate(savedInstanceState);
  37.         setContentView(R.layout.sicalculator);
  38.         EditText principal = (EditText) findViewById(R.id.PA_field);
  39.         EditText interest = (EditText) findViewById(R.id.IR_field);
  40.         SeekBar bar = (SeekBar) findViewById(R.id.seekBar);
  41.         YT = (TextView) findViewById(R.id.Years);
  42.         bar.setOnSeekBarChangeListener(this);
  43.         pvalue =  principal.getText().toString();
  44.         ivalue = interest.getText().toString();
  45.         Button button = (Button) findViewById(R.id.calc_btn);
  46.         button.setOnClickListener(new OnClickListener());
  47.  
  48.  
  49.     }
  50.         @Override
  51.         public void onProgressChanged (SeekBar seekBar,int i, boolean b){
  52.             int years = i;
  53.             YT.setText(years + " Year(s)");
  54.  
  55.         }
  56.  
  57.         @Override
  58.         public void onStartTrackingTouch (SeekBar seekBar){
  59.  
  60.         }
  61.  
  62.         @Override
  63.         public void onStopTrackingTouch (SeekBar seekBar){
  64.  
  65.         }
  66.  
  67.  
  68.  {
  69.  
  70.  
  71.  
  72.     }
  73.  
  74.         @Override
  75.         public void onClick(View view) {
  76.  
  77.             TextView fTextView = (TextView) findViewById(R.id.finalText);
  78.  
  79.             fTextView.setText("test");
  80.  
  81.             Toast.makeText(SICalculatorActivity.this, "Button Clicked", Toast.LENGTH_SHORT).show();
  82. }
  83.  
  84.  
  85.  
  86. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement