title: android -- make calculations with input data (numeric) -- (show graphs?)
body: <p>I am starting to learn android and i have a few questions.
  I have my main program as:</p>
  
  <pre><code>public class Radiation_overflowActivity  extends Activity implements OnClickListener {
  
      EditText init_cores;
          View final_cores;
  
      /** Called when the activity is first created. */
      @Override
      public void onCreate(Bundle savedInstanceState) {
  
  
          super.onCreate(savedInstanceState);
          setContentView(R.layout.main);
  
      //Set up click listeners
      init_cores=(EditText) findViewById(R.id.init_cores);
      //init_cores.setOnClickListener(this);
      final_cores=(View) findViewById(R.id.final_cores);
      final_cores.setOnClickListener(this);
  
       }
  
      //called when a button is clicked
      public void onClick(View v) {
  
          switch (v.getId()){
  
          case R.id.final_cores:
              //int r = Integer.parseInt(init_cores.getText().toString().trim());
              double initcores=Double.parseDouble(init_cores.getText().toString().trim());
              double l=2,t=2;
              double fcores=initcores*Math.exp(-l*t);
              Intent i=new Intent(this,calcs.class);
              i.putExtra("value",fcores);
              startActivity(i);
              break;
           }
  
         }
        }
  </code></pre>
  
  <p>Also, my main.xml:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
  android:layout_width="fill_parent"
  android:layout_height="fill_parent"
  android:orientation="vertical" &gt;
  
  &lt;TextView
      android:layout_width="fill_parent"
      android:layout_height="wrap_content"
      android:text="@string/initial_cores" /&gt;
  &lt;EditText
      android:layout_width="fill_parent"
      android:layout_height="wrap_content"
      android:id="@+id/init_cores"
      android:inputType="numberDecimal" /&gt;
  &lt;Button
      android:layout_width="fill_parent"
      android:layout_height="wrap_content"
      android:id="@+id/final_cores"
      android:text="@string/calculate" /&gt;
  &lt;/LinearLayout&gt;
  </code></pre>
  
  <p>My calcs.java:</p>
  
  <pre><code>public class calcs extends Activity{
  
      TextView calcs_final;
  
      public void onCreate(Bundle savedInstanceState) {
  
          super.onCreate(savedInstanceState);
          setContentView(R.layout.calcs);
  
          calcs_final=(TextView) findViewById(R.id.calcs_final);
  
          double f=getIntent().getExtras().getDouble("value");
  
          calcs_final.setText(Double.toString(f));
  
  
  }
  
  }
  </code></pre>
  
  <p>My calcs.xml:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
      android:layout_width="fill_parent"
      android:layout_height="fill_parent"
      android:orientation="vertical" &gt;
  
      &lt;TextView
          android:layout_width="fill_parent"
          android:layout_height="wrap_content"
          android:id="@+id/calcs_final" 
          android:text="@string/result" /&gt;
  
  
  &lt;/LinearLayout&gt;
  </code></pre>
  
  <p>I want to do this:</p>
  
  <p>The user enters data into the edittext (init_cores) and then i want to make some calculations to compute the final_cores and show it to the user.</p>
  
  <p>I have trouble for showing the results.I am  starting another activity (calcs.class and calcs.xml).
  Where i must do the calculations?To the calcs.class?
  Right now,the user enters a number ,presses the "Calculate" button and then it shows the text (from the strings.xml) "Number of cores"" ,but not the result.</p>
  
  <p>Also, can i use the input from the data and from my calculations and make a plot?If you could give me some directions to this.</p>
  
  <p>Finally,is my approach right?</p>
  
  <p>Thank you!</p>