List of usage examples for android.support.v4.app DialogFragment show
public int show(FragmentTransaction transaction, String tag)
From source file:com.techjoynt.android.nxt.activity.RemoteControl.java
private void selectDevice() { DialogFragment fragment = new DeviceSwitchFragment(); fragment.show(getSupportFragmentManager(), "device_switch"); }
From source file:io.upnext.beaconcontrol.app.LoginActivity.java
private void showCreateAccountDialog() { DialogFragment dialogFragment = CreateAccountDialogFragment.newInstance(); dialogFragment.show(getSupportFragmentManager(), CREATE_ACCOUNT_DIALOG_TAG); }
From source file:hku.fyp14017.blencode.ui.ProjectActivity.java
public void handleAddButton(View view) { if (!viewSwitchLock.tryLock()) { return;// w ww.j ava2 s. com } FragmentTransaction fragmentTransaction = getSupportFragmentManager().beginTransaction(); Fragment previousFragment = getSupportFragmentManager() .findFragmentByTag(NewSpriteDialog.DIALOG_FRAGMENT_TAG); if (previousFragment != null) { fragmentTransaction.remove(previousFragment); } DialogFragment newFragment = new NewSpriteDialog(); newFragment.show(fragmentTransaction, NewSpriteDialog.DIALOG_FRAGMENT_TAG); }
From source file:it.mb.whatshare.Dialogs.java
/** * Shows a dialog informing the user that the QR code she's taken a picture * of is not valid./*from w w w . j a v a 2 s.c om*/ * * @param activity * the caller activity */ public static void onQRFail(final FragmentActivity activity) { DialogFragment failDialog = new PatchedDialogFragment() { public Dialog onCreateDialog(Bundle savedInstanceState) { return getBuilder(activity).setMessage(R.string.qr_code_fail) .setPositiveButton(R.string.qr_code_retry, new OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { // do nothing } }).create(); } }; failDialog.show(activity.getSupportFragmentManager(), "fail"); }
From source file:de.damdi.fitness.activity.MainActivity.java
/** Shows a dialog for choosing a {@link Workout} */ private void showSelectWorkoutDialog() { IDataProvider dataProvider = new DataProvider(this); // get all Workouts final List<Workout> workoutList = dataProvider.getWorkouts(); Log.d(TAG, "Number of Workouts: " + workoutList.size()); switch (workoutList.size()) { // show error message, if there is no Workout case 0://from w ww . j a va 2 s . co m Toast.makeText(MainActivity.this, getString(R.string.no_workout), Toast.LENGTH_LONG).show(); break; // choose Workout, if there is/are one or more Workout(s) default: FragmentTransaction ft = getSupportFragmentManager().beginTransaction(); Fragment prev = getSupportFragmentManager().findFragmentByTag("dialog"); if (prev != null) { ft.remove(prev); } ft.addToBackStack(null); // Create and show the dialog. DialogFragment newFragment = SelectWorkoutDialogFragment.newInstance(); newFragment.show(ft, "dialog"); } }
From source file:com.anjalimacwan.fragment.WelcomeFragment.java
@TargetApi(Build.VERSION_CODES.KITKAT) @Override//w ww .j a v a2 s .c o m public boolean onOptionsItemSelected(MenuItem item) { // Handle presses on the action bar items switch (item.getItemId()) { /* case R.id.action_settings: Intent intentSettings = new Intent(getActivity(), SettingsActivity.class); startActivity(intentSettings); return true; case R.id.action_import: Intent intent = new Intent(Intent.ACTION_OPEN_DOCUMENT); intent.addCategory(Intent.CATEGORY_OPENABLE); intent.putExtra(Intent.EXTRA_ALLOW_MULTIPLE, true); intent.putExtra(Intent.EXTRA_MIME_TYPES, new String[] {"text/plain", "text/html", "text/x-markdown"}); intent.setType("*//*//"); try { getActivity().startActivityForResult(intent, 42); } catch (ActivityNotFoundException e) { showToast(R.string.error_importing_notes); } return true;*/ case R.id.action_about: DialogFragment aboutFragment = new AboutDialogFragment(); aboutFragment.show(getFragmentManager(), "about"); return true; default: return super.onOptionsItemSelected(item); } }
From source file:edu.rosehulman.grocerydroid.MainActivityNonTouch.java
/** Called when the activity is first created. */ @Override/* w ww. j a v a2s . co m*/ public void onCreate(Bundle savedInstanceState) { setTheme(R.style.Theme_Sherlock_ForceOverflow); // ABS, must come first super.onCreate(savedInstanceState); setContentView(R.layout.main); getSupportActionBar().setIcon(R.drawable.ic_list); // needs to be in // hdpi folder getSupportActionBar().setDisplayHomeAsUpEnabled(true); getSupportActionBar().setSubtitle("Welcome"); initializeDatabase(); initializeShoppingLists(); ListView lv = (ListView) findViewById(R.id.main_shopping_list_view); mAdapter = new MainShoppingListAdapter(this, R.layout.main_list, mShoppingLists); lv.setAdapter(mAdapter); lv.setOnItemClickListener(new OnItemClickListener() { @Override public void onItemClick(AdapterView<?> parent, View v, int pos, long id) { mSelectedList = MainActivityNonTouch.this.mShoppingLists.get(pos); DialogFragment df = ChooseActionDialogFragment.newInstance(); df.show(getSupportFragmentManager(), "choose_action"); } }); }
From source file:br.pro.menotti.opus.pt.MainActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); db = new SQLiteHelper(getApplicationContext()); String listStr[] = getResources().getStringArray(R.array.listString); ListView lv = (ListView) findViewById(android.R.id.list); lv.setAdapter(new ArrayAdapter<String>(this, android.R.layout.simple_list_item_1, listStr)); lv.setOnItemClickListener(new OnItemClickListener() { @Override//from ww w .j a va 2 s. c o m public void onItemClick(AdapterView<?> parent, View view, int position, long id) { SQLiteHelper db; switch (position) { case 0: showBooks(); break; case 1: AlertDialog.Builder builder = new AlertDialog.Builder(view.getContext()); builder.setTitle(R.string.display_search); final EditText input = new EditText(view.getContext()); builder.setView(input); builder.setPositiveButton("OK", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int whichButton) { String search_key = input.getEditableText().toString().trim(); if (!search_key.equals("")) { showPoints(search_key); } } }); AlertDialog alertDialog = builder.create(); alertDialog.show(); break; case 2: db = new SQLiteHelper(getBaseContext()); db.openDataBase(); showFavorites(); db.close(); break; case 3: db = new SQLiteHelper(getBaseContext()); db.openDataBase(); BookPoint bp = db.getBookPoint(); DialogFragment newFragment = new DialogPoint(bp); newFragment.show(getSupportFragmentManager(), bp.toString()); db.close(); break; default: Toast.makeText(getApplicationContext(), ((TextView) view).getText(), Toast.LENGTH_SHORT).show(); } } }); try { db.createDataBase(); } catch (IOException ioe) { throw new Error("Unable to create database"); } try { db.openDataBase(); db.close(); } catch (SQLException sqle) { throw sqle; } }
From source file:com.firsttry.mumbaiparking.ReminderActivity.java
public void showDatePicker(View v) { int buttonPressed = v.getId(); String tag = null;/*www. j av a 2 s . c om*/ if (buttonPressed == R.id.doneTagButton) { tag = "PUC"; Log.i(LOGTAG, "tag is PUC "); } else if (buttonPressed == R.id.cancelTagButton) { tag = "INSURANCE"; Log.i(LOGTAG, "tag is Insurance "); } else { tag = "LICENSE"; Log.i(LOGTAG, "tag is license "); } android.support.v4.app.DialogFragment newFragment = new DatePickerHelper(); newFragment.show(getSupportFragmentManager(), tag); }
From source file:com.farmerbb.notepad.fragment.WelcomeFragment.java
@TargetApi(Build.VERSION_CODES.KITKAT) @Override//w ww. j ava 2s .c om public boolean onOptionsItemSelected(MenuItem item) { // Handle presses on the action bar items switch (item.getItemId()) { case R.id.action_settings: Intent intentSettings = new Intent(getActivity(), SettingsActivity.class); startActivity(intentSettings); return true; case R.id.action_import: Intent intent = new Intent(Intent.ACTION_OPEN_DOCUMENT); intent.addCategory(Intent.CATEGORY_OPENABLE); intent.putExtra(Intent.EXTRA_ALLOW_MULTIPLE, true); intent.putExtra(Intent.EXTRA_MIME_TYPES, new String[] { "text/plain", "text/html", "text/x-markdown" }); intent.setType("*/*"); try { getActivity().startActivityForResult(intent, 42); } catch (ActivityNotFoundException e) { showToast(R.string.error_importing_notes); } return true; case R.id.action_about: DialogFragment aboutFragment = new AboutDialogFragment(); aboutFragment.show(getFragmentManager(), "about"); return true; default: return super.onOptionsItemSelected(item); } }