Android - Achartengine -stepsの使用方法
-
26-10-2019 - |
質問
私はAndroid、Java、そしてもちろんAchartengineに初めてです。ユーザーがいくつかのデータを入力するアプリケーションを完了し、これらのデータを使用してラインプロットを作成したいと考えています。私が従わなければならないステップは何ですか?
- Achartengine Jarファイルをインポートします。
- 私のアプリケーションでAbstractDemochart.classファイルを使用します。
- 私のアプリケーションでTrigonometricFunctionSchartファイルを使用します。
- 私のデータを使用するために、trigonometricfunctionschartファイルを編集します。
上記が正しいかどうかはわかりません。また、TrigonomeTricFunctionSchartファイルを編集する必要がある場合、number_cores.classにある変数(データ)を処理するにはどうすればよいですか?
これが計算を行うnumber_cores.classです。ユーザーは、num_cores、ハーフタイム、タイムコア(時間)に入ります。
時間とfcores(cores_funcから以下のコアの数)でプロットをやりたいです。
(そして、ユーザーが入力する時間から0になりたい場合はどうなりますか。)
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);
}
ありがとうございました!
解決
指示に従うことができます ここ IDEでACEデモを実行するために。次に、そこからものをコピーしてアプリケーションの構築を開始できます。
所属していません StackOverflow