【发布时间】:2014-01-27 01:00:30
【问题描述】:
我有这个代码:
<EditText
android:id="@+id/etC"
android:layout_height="wrap_content"
android:layout_width="fill_parent"
android:hint="@string/amount_credits"
android:inputType="number"
android:imeOptions="actionDone"
android:singleLine="true" />
和
AlertDialog.Builder creditsBox = new AlertDialog.Builder(this);
edC = (EditText) findViewById(R.id.etC);
creditsBox.setView(edC); //THIS LINE MAKES THE APP CRASH
creditsBox.setMessage("Enter amount of credits")
.setCancelable(false)
.setPositiveButton("Ok", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface arg0, int arg1) {
// TODO Auto-generated method stub
}
});
AlertDialog creditsBoxC = creditsBox.create();
creditsBoxC.show();
现在我不明白问题出在哪里。任何人都可以帮助我吗?谢谢。
【问题讨论】:
标签: java android android-edittext dialog