При вызове приложения появляется AlertDialog. Когда закрываю его он появляется еще раз. Во второй раз он закрывается. В чем ошибка? | Код | public static class DummySectionFragment extends Fragment { /** * The fragment argument representing the section number for this * fragment. */ public static final String ARG_SECTION_NUMBER = "section_number"; private ListView list; private String[] st; private Button bt; private ProgressBar pr; String title; Intent intent; public DummySectionFragment() { } @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { final View rootView = inflater.inflate(R.layout.fragment_main_dummy, container, false); //list = (ListView) rootView.findViewById(R.id.listView1); st = getResources().getStringArray(R.array.punkts); ArrayAdapter<String> adapter = new ArrayAdapter<String>(this.getActivity(), R.layout.fragment_list_item, st); //list.setAdapter(adapter); intent = this.getActivity().getIntent(); bt = (Button) rootView.findViewById(R.id.button1); pr = (ProgressBar) rootView.findViewById(R.id.progressBar1); pr.setMax(100); bt.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { // TODO Auto-generated method stub new DownloadFileFromURL().execute(""); } }); if (intent.getAction().equals("android.intent.action.VIEW")){ View view = LayoutInflater.from(this.getActivity()).inflate(R.layout.ask, null); EditText editText = (EditText) view.findViewById(R.id.editText1); Uri uri = intent.getData(); editText.setText(uri.getLastPathSegment()); AlertDialog.Builder builder = new AlertDialog.Builder(this.getActivity()); builder.setTitle(R.string.sett); builder.setView(view); builder.setCancelable(false); builder.setPositiveButton(R.string.down, new DialogInterface.OnClickListener(){ @Override public void onClick(DialogInterface dialog, int which) { dialog.dismiss(); } }); AlertDialog dialog = builder.create(); dialog.show(); } return rootView; }
|
|