Note that there are some explanatory texts on larger screens.

plurals
  1. POhow to fill array between two points with data from another activity
    text
    copied!<p>-------UPDATED-------------------------------------</p> <p>In this class i do the calculations:</p> <pre><code>... ArrayList&lt;Double&gt; final_cores =new ArrayList&lt;Double&gt;(); ... public void cores_func(){ double initcores=Double.parseDouble(num_cores.getText().toString().trim()); double half_time=Double.parseDouble(halftimecores.getText().toString().trim()); double ttime=Double.parseDouble(timecores.getText().toString().trim()); double l=Math.log(2)/half_time; double fcores=initcores*Math.exp(-l*ttime); for (int i=0;i&lt;=ttime;i++){ final_cores.add(initcores*Math.exp(-l*ttime)); } //convert ArrayList to double[] double[] mydata = new double[final_cores.size()]; for(int i = 0; i &lt; final_cores.size(); i++) { mydata[i] = final_cores.get(i); } Intent i=new Intent(this,core_calcs.class); i.putExtra("value",fcores); i.putExtra("value2",initcores); i.putExtra("value3",ttime); i.putExtra("final_cores",mydata); startActivity(i); } ... </code></pre> <p>and in the linegraph class :</p> <pre><code>... private double [] final_cores =new double [100]; public double [] getFinal_cores(){ return this.mydata;} public void setFinal_cores( double [] final_cores){ this.mydata=mydata;} public void onCreate(Bundle savedInstanceState){ super.onCreate(savedInstanceState); Bundle extras=getIntent().getExtras(); ... double [] mydata = extras.getDoubleArray("final_cores"); setFinal_cores(mydata); public Intent getIntent(Context context){ ... double []mydata=getFinal_cores(); ArrayList&lt;Double&gt; x =new ArrayList&lt;Double&gt;(); ArrayList&lt;Double&gt; y =new ArrayList&lt;Double&gt;(); // ArrayList&lt;Double&gt; data =new ArrayList&lt;Double&gt;(); //fill x,y values for (int i=0;i&lt;=10;i++){ x.add(ttime / 10.0 * i); } for (int i=0;i&lt;=10;i++){ y.add(initcores + ((mydata[i]) / 10.0 * i)); } TimeSeries series = new TimeSeries("Decay"); for (int i=0;i&lt;x.size();i++){ series.add(x.get(i),y.get(i)); } </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload