从 edittext 调用函数
calling a function from edittext
我正在尝试从 edittext 调用函数。我在使用 extend activity
时没有问题,但是当我在 extending AppCompatActivity
上使用 edittext onClick 方法时出现错误
我怎么称呼它 -
<EditText
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:inputType="textPersonName"
android:hint="@string/date_hint"
android:ems="10"
android:id="@+id/editTextDate"
android:layout_gravity="center_horizontal"
android:background="@android:drawable/edit_text"
android:onClick="buttonPlanYourWeek"
android:focusable="false"
android:clickable="true"/>
public void buttonPlanYourWeek(View view) {
Intent i = new Intent(this, ListOfAgentActivity.class);
finish();
startActivity(i);
}
我遇到一个错误:
Could not find a method planing_an_week(View) in the activity class android.support.v7.internal.widget.TintContextWrapper for onClick handler on view class android.support.v7.widget.AppCompatEditText with id 'buttonPlanYourWeek'
使用此代码
public void buttonPlanYourWeek() {
finish();
Intent i = new Intent(this, ListOfAgentActivity.class);
startActivity(i);
}
我正在尝试从 edittext 调用函数。我在使用 extend activity
时没有问题,但是当我在 extending AppCompatActivity
上使用 edittext onClick 方法时出现错误
我怎么称呼它 -
<EditText
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:inputType="textPersonName"
android:hint="@string/date_hint"
android:ems="10"
android:id="@+id/editTextDate"
android:layout_gravity="center_horizontal"
android:background="@android:drawable/edit_text"
android:onClick="buttonPlanYourWeek"
android:focusable="false"
android:clickable="true"/>
public void buttonPlanYourWeek(View view) {
Intent i = new Intent(this, ListOfAgentActivity.class);
finish();
startActivity(i);
}
我遇到一个错误:
Could not find a method planing_an_week(View) in the activity class android.support.v7.internal.widget.TintContextWrapper for onClick handler on view class android.support.v7.widget.AppCompatEditText with id 'buttonPlanYourWeek'
使用此代码
public void buttonPlanYourWeek() {
finish();
Intent i = new Intent(this, ListOfAgentActivity.class);
startActivity(i);
}