Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- * Copyright (C) 2013 Code Here Now - A subsidiary of Mobs & Geeks
- *
- * 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 distributed under the
- * License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
- * either express or implied. See the License for the specific language governing permissions and
- * limitations under the License.
- */
- package com.codeherenow.sicalculator;
- import android.app.Activity;
- import android.os.Bundle;
- import android.view.View;
- import android.widget.Button;
- import android.widget.EditText;
- import android.widget.TextView;
- import android.widget.SeekBar;
- import android.widget.Toast;
- import android.view.View.OnClickListener;
- public class SICalculatorActivity extends Activity
- implements SeekBar.OnSeekBarChangeListener, View.OnClickListener{
- private TextView YT;
- public String pvalue;
- public String ivalue;
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
- setContentView(R.layout.sicalculator);
- EditText principal = (EditText) findViewById(R.id.PA_field);
- EditText interest = (EditText) findViewById(R.id.IR_field);
- SeekBar bar = (SeekBar) findViewById(R.id.seekBar);
- YT = (TextView) findViewById(R.id.Years);
- bar.setOnSeekBarChangeListener(this);
- pvalue = principal.getText().toString();
- ivalue = interest.getText().toString();
- Button button = (Button) findViewById(R.id.calc_btn);
- button.setOnClickListener(new OnClickListener());
- }
- @Override
- public void onProgressChanged (SeekBar seekBar,int i, boolean b){
- int years = i;
- YT.setText(years + " Year(s)");
- }
- @Override
- public void onStartTrackingTouch (SeekBar seekBar){
- }
- @Override
- public void onStopTrackingTouch (SeekBar seekBar){
- }
- {
- }
- @Override
- public void onClick(View view) {
- TextView fTextView = (TextView) findViewById(R.id.finalText);
- fTextView.setText("test");
- Toast.makeText(SICalculatorActivity.this, "Button Clicked", Toast.LENGTH_SHORT).show();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement