imgTest.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
final AlertDialog.Builder mBuilder = new AlertDialog.Builder(getApplicationContext());
mBuilder.setTitle("Location Available!");
LayoutInflater inflater = getLayoutInflater();
View convertView = inflater.inflate(R.layout.reclycer_data, null);
RecyclerView list = convertView.findViewById(R.id.recView);
list.setLayoutManager(new LinearLayoutManager(getApplicationContext()));
list.setAdapter(adapter);
AlertDialog dialog = mBuilder.create();
dialog.show();
}
});
我想在AlertDialog中展示我的Recyclerview,就像这段代码一样。我相信我已经按照视频中的步骤操作了,但是当我打开我的AlertDialog时却总是出现强制关闭的情况。你们能帮我解决吗?我刚开始使用Android Studio。