경고 대화 상자에 사용자 지정보기를 적용하려고합니다. 이런 식으로하고 있지만 경고 상자를 표시하려고 할 때 nullpointer 예외가 있습니다.내 사용자 지정 경고 대화 상자 코드가 충돌하는 이유는 무엇입니까?
은 내가 layout.xml과 같이 작성합니다
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/themescreen"
android:gravity="center"
android:orientation="horizontal"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
>
<TableLayout
android:padding="45dip"
android:layout_width="wrap_content"
android:layout_height="wrap_content">
<RadioGroup
android:gravity="center">
<TableRow>
<RadioButton
android:id="@+id/rdthemeBlue"
android:button="@drawable/radio_custom">
</RadioButton>
<ImageView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:src="@drawable/bluebackgroundicon"
android:paddingLeft="10dip"
android:paddingBottom="10dip"
></ImageView>
</TableRow>
<TableRow>
<RadioButton
android:id="@+id/rdthemeGolden"
android:button="@drawable/radio_custom"></RadioButton>
<ImageView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:src="@drawable/goldenredbackgroundicon"
android:paddingLeft="10dip"
android:paddingBottom="10dip"
></ImageView>
</TableRow>
<TableRow>
<RadioButton
android:id="@+id/rdthemeBlack"
android:button="@drawable/radio_custom">
</RadioButton>
<TextView
android:gravity="center"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:paddingLeft="10dip"
android:text="None"
>
</TextView>
</TableRow>
</RadioGroup>
<TableRow
android:paddingTop="25dip"
android:paddingLeft="10dip"
>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center"
>
<Button
android:id="@+id/btnthemesave"
android:background="@drawable/btn_custom"
android:layout_width="100dip"
android:layout_height="wrap_content"
android:paddingLeft="10dip"
android:text="Save"
android:textSize="15sp"
></Button>
<Button
android:id="@+id/btnthemecancel"
android:background="@drawable/btn_custom"
android:layout_width="100dip"
android:layout_height="wrap_content"
android:paddingLeft="10dip"
android:text="Cancel"
android:textSize="15sp"
></Button>
</LinearLayout>
</TableRow>
</TableLayout>
</LinearLayout>
이 코드를 통해 alertbox을 신청.
LayoutInflater factory = LayoutInflater.from(BackupRestoreActivityContext);
final View textEntryView = factory.inflate(R.layout.layout,null);
AlertDialog.Builder alert = new AlertDialog.Builder(BackupRestoreActivityContext);
alert.setTitle("Configuration Setting");
alert.setView(textEntryView);
alert.setPositiveButton("Ok", new DialogInterface.OnClickListener()
{
public void onClick(DialogInterface dialog, int whichButton) {
return;
}
});
alert.setNegativeButton("Cancel", new DialogInterface.OnClickListener()
{
public void onClick(DialogInterface dialog, int which) {
// TODO Auto-generated method stub
return;
}
});
alert.show();
null 포인터 예외의 원인이 될 수있는 것은 무엇입니까?