간단한 프로그램에서 질문이요; 초보자입니다.

EditText 하나랑 Button 하나랑 View가 있습니다.

EditText에서 적은 후 Button Click 하면 적은대로 그래프가 그려지게 하고 싶습니다.

그니까 지금은 y = (float) ((float) 0.01*Math.pow(x, 2)); 라고 정의해논 그래프밖에 안그려지는데요;

실행 후 EditText에서 적은 걸로 그리려면 어떻게 해야 하나요;

그리는 방법이 아니라 다른 클래스로 어떻게 불러오는지;

// MathGraph.java

package com.android.mathgraph;

import android.app.Activity;
import android.os.Bundle;
import android.text.Editable;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.EditText;


public class MathGraph extends Activity{


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

  setContentView(R.layout.main);

  EditText t1 = (EditText)findViewById(R.id.EditText01);
  t1.setText("");

  String input = t1.getText().toString();                                                                                          //요런식으로 저장해서
  
  Button btn = (Button)findViewById(R.id.Button01);
  
  btn.setText("create a graph!");
  
  View DrawGraph = (View) findViewById(R.id.View01);
  final DrawGraph tv = new DrawGraph(this);
  
  btn.setOnClickListener(new View.OnClickListener() {
   
   @Override
   public void onClick(View arg0) {
    // TODO Auto-generated method stub
    setContentView(tv);
   }
  });
 }
}

//DrawGraph.java

package com.android.mathgraph;

import android.content.Context;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Paint;
import android.view.View;

 


class DrawGraph extends View {
 public DrawGraph(Context context) {
  super(context);
 }

 public void onDraw(Canvas canvas) {
  Paint p = new Paint(); // 그래프의 색
  p.setColor(Color.WHITE);

  Paint p1 = new Paint(); // 기준선의 색, X축, Y축
  p1.setColor(Color.WHITE);

  float startingX = 160.0f; // 원점 X좌표
  float startingY = 240.0f; // 원점 Y좌표

  canvas.drawLine(0, startingY, 320, startingY, p1);
  canvas.drawLine(startingX, 0, startingX, 480, p1);

  float x = -160f, y;
  y = (float) ((float) 0.01*Math.pow(x, 2));                                                                                       //여기다 써먹고 싶어요

  
  float x1 = x, y1 = y;

  for (; x <= 160.0f; x++)

  {
   y = (float) ((float) 0.01*Math.pow(x, 2));

   canvas.drawLine(x1 + startingX, -y1 + startingY, x + startingX, -y
     + startingY, p);

   x1 = x;
   y1 = y;
  }
 }
}