Android : start intent in setOnClickListener
- by Derek
I have a button, and this button is going to get the values from EditText, then using this value to start a new Intent
protected void onCreate(Bundle savedInstanceState)
{
textDay = (EditText) findViewById(R.id.textDay);
textMonth = (EditText) findViewById(R.id.textMonth);
textYear = (EditText) findViewById(R.id.textYear);
gen = (Button) findViewById(R.id.getGraph);
gen.setOnClickListener(new View.OnClickListener()
{
public void onClick(View v)
{
getthisIntent();
}
public Intent getthisIntent(Context context)
{
day = textDay.getText();
month = textMonth.getText();
year = textYear.getText();
date = day + "/" + month + "/" + year;
.
.// Plot graph using AchartEngine, then return an Intent //
.
}
}
});
but i get the error "The method getthisIntent(Context) in the type new View.OnClickListener(){} is not applicable for the arguments ()"
Can i get some help? or do i have another alternative solution, when i click the button, then the button pass the values to the new intent, and start it without having a new xxx.java file?
Edit
This is basically what I am doing now, i need to get the things inserted by user, and plot a graph, the only way i know how to plot graph using AchartEngine is create a new activity with define this
public Intent getthisIntent(Context context)
To be honest, i dont really know what the hell I am doing, please correct me...