我有一个名为“tabActivity”的选项卡活动,在选项卡活动中我想要一个按钮“butDetail”在“saveImageActivity”来显示一个自定义对话框“detail.xml”。这是我显示对话框的代码
public void butDetail(View v){
final Dialog dialog = new Dialog(saveImageActivity.this);
dialog.setContentView(R.layout.detail);
dialog.setTitle("Detail Image");
TextView filepath = (TextView)findViewById(R.id.txtfilepath);
TextView resolution = (TextView)findViewById(R.id.txtresolution);
filepath.setText("File Path : ");
resolution.setText("Resolution : ");
dialog.setCancelable(true);
dialog.show();
}
为什么如果我添加“文件路径”和“分辨率”它总是给出“java.lang.NullPointerException”,如果我删除这两个变量,对话框就会出现,,这种情况的任何解决方案?