Android Open Source - FastBudget3 Category List Dialog

From Project

Back to project page FastBudget3.


The source code is released under:

GNU General Public License

If you think the Android project FastBudget3 listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

package de.splitstudio.fastbudget3;
//from  w w w . j  ava2s.  c om
import static de.splitstudio.fastbudget3.enums.Extras.CategoryName;
import static de.splitstudio.fastbudget3.enums.Extras.Uuid;
import android.content.DialogInterface;
import android.content.DialogInterface.OnClickListener;
import android.os.Bundle;
import de.splitstudio.fastbudget3.db.CategoryDao;
import de.splitstudio.utils.db.Database;

public class CategoryListDialog extends DialogFragment {

  interface CategoryListDialogListener {
    public void onDone();

  public Dialog onCreateDialog(Bundle savedInstanceState) {
    AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
    final CategoryDao categoryDao = new CategoryDao(Database.getInstance(getActivity()));
    final CharSequence[] categoryNames = categoryDao.getCategoryNames();
    builder.setItems(categoryNames, new OnClickListener() {
      public void onClick(DialogInterface dialog, int which) {
        String newCategoryName = categoryNames[which].toString();
        String oldCategoryName = getArguments().getString(;
        String expenseUuid = getArguments().getString(;
        categoryDao.moveExpense(expenseUuid, oldCategoryName, newCategoryName);
    return builder.create();

  protected CategoryListDialogListener getListener() {
    return (CategoryListDialogListener) getActivity();


Java Source Code List