Question

I am new to android,to java and of course to achartengine. I have complete an application where the user enters some data and i want with these data to make a line plot. What are the steps i must follow?

  1. Import the achartengine jar file.
  2. Use the abstractdemochart.class file in my application.
  3. Use the trigonometricfunctionschart file in my application.
  4. Edit the trigonometricfunctionschart file in order to use my data.

I don't know if the above are correct.Also,if i must edit trigonometricfunctionschart file,how can i handle my variables (data) that are in the number_cores.class?

Here is the number_cores.class which does the calculations. User enters the num_cores,halftime and timecores (time).

I want to do a plot with time vs fcores( number of cores below from the cores_func).

(And what if i want time to be from 0 to the time which the user enters.)

public class number_cores extends Activity implements OnClickListener 
 { 
         EditText num_cores; 
         EditText halftimecores; 
         EditText timecores; 
         View core_calcs; 

         /** Called when the activity is first created. */ 
     @Override 
     public void onCreate(Bundle savedInstanceState) { 

        super.onCreate(savedInstanceState); 
         setContentView(R.layout.numbercores); 

        num_cores=(EditText) findViewById(R.id.num_cores); 
         halftimecores=(EditText) findViewById(R.id.halftimecores); 
         timecores=(EditText) findViewById(R.id.timecores); 
         core_calcs=(View) findViewById(R.id.core_calcs); 
         core_calcs.setOnClickListener(this); 

    } 

        public void onClick(View v) { 
                 switch (v.getId()){ 
                 case R.id.core_calcs: 
                         if(isNumeric(num_cores.getText().toString()) && 
 isNumeric(halftimecores.getText().toString()) && 
 isNumeric(timecores.getText().toString())) 
                 { 
                                 cores_func(); 
                 } 
                 else 
                 { 
                     Toast.makeText(number_cores.this, "Please provide 
 a number", Toast.LENGTH_SHORT).show(); 
                 } 
                 break; 
     } 
         } 

        public static boolean isNumeric(String str) 
         { 
           try 
           { 
             double d = Double.parseDouble(str); 
           } 
           catch(NumberFormatException nfe) 
           { 
             return false; 
           } 
           return true; 
         } 
         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); 

             Intent i=new Intent(this,core_calcs.class); 
                  i.putExtra("value",fcores); 
              startActivity(i); 
          }

Thank you!

Was it helpful?

Solution

You can follow the instructions here in order to get the ACE demo run in your IDE. Then, you can start building your application by copying stuff from there.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top