如何在一个活动中显示两个自定义对话框。当我单击一个请求培训时,它必须导航到gmail,而过程必须导航到自定义列表页面。请参见下图。
public void showProcedureDialog(最终ArrayList) 程序列表){
final Dialog dialog = new Dialog(activity);
dialog.requestWindowFeature(Window.FEATURE_NO_TITLE);
dialog.setContentView(R.layout.procedure_dialog_layout);
dialog.setCanceledOnTouchOutside(true);
procedureListView = (ListView) dialog.findViewById(R.id.procedureList);
procedureListView.setAdapter(new ProcedureAdapter(procedurelist));
procedureListView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
String selectedurl =procedurelist.get(position).getURL();
Bundle bundle = new Bundle();
bundle.putString("url",selectedurl);
Intent intent = new Intent(getApplicationContext(),ProcedureActivity.class);
intent.putExtras(bundle);
startActivity(intent);
if(dialog!=null){
dialog.dismiss();
}
}
});
dialog.show();
公共无效的showRequestTrainingDialog(最终ArrayList过程列表){
final Dialog dialog = new Dialog(activity);
dialog.setContentView(R.layout.training_dialog_layout);
dialog.setCanceledOnTouchOutside(true);
Bundle bundle = new Bundle();
bundle.putString("url","https://info.orendatech.com/orenda-training");
Intent intent = new Intent(getApplicationContext(), RequestTrainingActivity.class);
intent.putExtras(bundle);
startActivity(intent);
if (dialog!=null){
dialog.dismiss();
}
dialog.show();
公共类ProcedureAdapter扩展了BaseAdapter {
private ArrayList<ProcedureRootDto> procedurelist;
private LayoutInflater inflater;
private TextView procedurename;
public ProcedureAdapter(ArrayList<ProcedureRootDto> procedurelist){
this.procedurelist = procedurelist;
inflater = LayoutInflater.from(activity);
}
@Override
public int getCount() {
return (procedurelist == null) ? 0 : procedurelist.size();
}
@Override
public Object getItem(int position) {
return procedurelist.get(position);
}
@Override
public long getItemId(int position) {
return position;
}
@Override
public View getView(int position, View convertView, ViewGroup parent) {
if(convertView==null){
convertView = inflater.inflate(R.layout.procedure_item_layout,parent,false);
}
procedurename = (TextView) convertView.findViewById(R.id.procedurename);
procedurename.setText(procedurelist.get(position).getName());
return convertView;
}
程序运行正常,但是单击请求培训也可以导航到程序链接
答案 0 :(得分:0)
尝试一下,
已编辑:
yarn install