pedrocarrillo / expense-tracker-app Goto Github PK
View Code? Open in Web Editor NEWExpense Tracker
License: MIT License
Expense Tracker
License: MIT License
When I try to edit an expense in the expense detail view, I get the following exception:
01-08 12:32:57.335 16432-16432/com.pedrocarrillo.expensetracker E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.pedrocarrillo.expensetracker, PID: 16432
java.lang.IllegalStateException: Fragment NewExpenseFragment{a0b3326 #0 EDIT_EXPENSE} declared target fragment ExpenseDetailFragment{5be8b67 #0 id=0x7f0f0090 ExpenseDetailFragment} that does not belong to this FragmentManager!
at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1352)
at android.support.v4.app.FragmentManagerImpl.moveFragmentToExpectedState(FragmentManager.java:1740)
at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1809)
at android.support.v4.app.BackStackRecord.executeOps(BackStackRecord.java:799)
at android.support.v4.app.FragmentManagerImpl.executeOps(FragmentManager.java:2580)
at android.support.v4.app.FragmentManagerImpl.executeOpsTogether(FragmentManager.java:2367)
at android.support.v4.app.FragmentManagerImpl.removeRedundantOperationsAndExecute(FragmentManager.java:2322)
at android.support.v4.app.FragmentManagerImpl.execPendingActions(FragmentManager.java:2229)
at android.support.v4.app.FragmentManagerImpl$1.run(FragmentManager.java:700)
at android.os.Handler.handleCallback(Handler.java:751)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:241)
at android.app.ActivityThread.main(ActivityThread.java:6274)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:886)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:776)
The error is in the onEditExpense method of ExpenseDetailFragment.
import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;
class Expense {
private String category;
private double amount;
public Expense(String category, double amount) {
this.category = category;
this.amount = amount;
}
public String getCategory() {
return category;
}
public double getAmount() {
return amount;
}
}
class ExpenseTracker {
private List expenses;
public ExpenseTracker() {
expenses = new ArrayList<>();
}
public void addExpense(String category, double amount) {
Expense expense = new Expense(category, amount);
expenses.add(expense);
}
public double getTotalExpenses() {
double total = 0;
for (Expense expense : expenses) {
total += expense.getAmount();
}
return total;
}
public void printExpenses() {
for (Expense expense : expenses) {
System.out.println("Category: " + expense.getCategory() + ", Amount: " + expense.getAmount());
}
}
}
public class Main {
public static void main(String[] args) {
ExpenseTracker expenseTracker = new ExpenseTracker();
Scanner scanner = new Scanner(System.in);
boolean isRunning = true;
while (isRunning) {
System.out.println("Enter category (or 'q' to quit):");
String category = scanner.nextLine();
if (category.equalsIgnoreCase("q")) {
isRunning = false;
break;
}
System.out.println("Enter amount:");
double amount = scanner.nextDouble();
scanner.nextLine(); // Consume the newline character
expenseTracker.addExpense(category, amount);
}
System.out.println("Total expenses: " + expenseTracker.getTotalExpenses());
System.out.println("Expense breakdown:");
expenseTracker.printExpenses();
scanner.close();
}
}
As its an open source app, it would be cool to publish it on F-Droid, a short introduction is here
what about a progressive codebase update to Kotlin ๐ค
So far we have export to CSV. I will be expanding the exporting and do the following:
When I scroll down, the floating Add button disappear and never return back.
It would be a nice feature to export and import the data!
Short overview for an implementation example: https://medium.com/glucosio-project/example-class-to-export-import-a-realm-database-on-android-c429ade2b4ed
When I try to export data, the button text for the permission description is white on white background, therefore not visible.
Steps to reproduce:
Go to History -> Export
Alert Dialog has no visible buttons
I think this is because of the line in styles.xml:
<item name="android:dialogTheme">@style/DialogTheme</item>
So it uses the DialogTheme which has a white text, but it somehow does not apply the blue padding for this alert dialog.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.