Android - How To Make Plot With User Data
I have a program which makes some calculations according to user data. The program works fine ,but when i try to use achartengine in order to make the plot ,it crashes.(doesn't do
Solution 1:
Bundle approach:
Intent searchIntent = new Intent();
searchIntent.setClassName("com.mypackage",searrchActivity.class.getName());
searchIntent.putExtra("value", initcores); // key/value pair, where key needs current package prefix.
searchIntent.putExtra("value2", fcores);
thisactivity.startActivity(searchIntent);
and in your LineGraph activity:
class LineGraph extends Activity{
private Double initcores;
private Double fcores;
public Double getInitcores(){ return this.initcores;}
public void setInitcores(Double initcores){ this.initcores=initcores;}
public Double getFcores(){ return this.fcores;}
public void setFcores(Double fcores){ this.fcores=fcores;}
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
......
Bundle extras = getIntent().getExtras();
Double initcores= extras.getDouble("value");
setInitcores(initcores);
Double fcores= extras.getDouble("value2"));
setFcores(fcores);
}
public Intent getIntent(...){
Double initcores= getInitcores();
Double fcores= getFcores();
//yourcode
}
}
SharedPreferences approach:
SharedPreferences sp =PreferenceManager.getDefaultSharedPreferences(this);
SharedPreferences.Editor ed= sp.edit();
ed.putInt("screen_width", 480);
ed.commit();
and in your next activity
SharedPreferences sp = PreferenceManager.getDefaultSharedPreferences(this);
int width = sp.getInt("screen_width",default_int_value);
hope this helps abit
Post a Comment for "Android - How To Make Plot With User Data"