Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- void createNewFolder( final int p_opt)
- {
- final AlertDialog.Builder builder = new AlertDialog.Builder(this);
- builder.setTitle("Title");
- // Set up the input
- final EditText m_edtinput = new EditText(this);
- // Specify the type of input expected;
- m_edtinput.setInputType(InputType.TYPE_CLASS_TEXT);
- // Set up the buttons
- builder.setPositiveButton("OK", new DialogInterface.OnClickListener() {
- @Override
- public void onClick(DialogInterface dialog, int which) {
- m_text = m_edtinput.getText().toString();
- if(p_opt == 1)
- {
- File m_newPath=new File(m_curDir,m_text);
- Log.d("cur dir",m_curDir);
- if(!m_newPath.exists()) {
- m_newPath.mkdirs();
- }
- }
- else
- {
- try {
- FileOutputStream m_Output = new FileOutputStream((m_curDir+File.separator+m_text), false);
- m_Output.close();
- } catch (FileNotFoundException e)
- {
- e.printStackTrace();
- } catch (IOException e)
- {
- e.printStackTrace();
- }
- }
- getDirFromRoot(m_curDir);
- }
- });
- builder.setNegativeButton("Cancel", new DialogInterface.OnClickListener() {
- @Override
- public void onClick(DialogInterface dialog, int which) {
- dialog.cancel();
- }
- });
- builder.setView(m_edtinput);
- builder.show();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement