Sunday, December 6, 2015


Wedding PLANNER


This is an android application developed using Android Studio.This is a simple app to help user plan the perfect wedding. Manage user's guest list, to-do list, budget and vendors all in one place.

I have done the budget and expenses part for this app,where the user can maintain their budget and expenses for each and every category.Notification will popup,when the user exceeds his expenses than the budget.

I have done the pie chart for the expenses too,via pie-chart user can easily analyse their expenses by category.

Pie-chart  in android





This pie chart will display the amount of expense,that user spend for each category.
Its'easy to draw pie chart using achartengine.


// Pie Chart Section Names
        ArrayList<category> bud = new DBhelper(this).getCategories();
        String[] code = new String[bud.size()];
        System.out.println(code);
        for (int i = 0; i < bud.size(); i++) {
            code[i] = bud.get(i).getName();
        }

 // Pie Chart Section Value
        double[] distribution = new double[code.length];
        for (int i = 0; i < distribution.length; i++) {
          System.out.println(i);
          ArrayList<Expence> expences = new DBhelper(this).getCategoryExpences(code[i]);
          if (expences != null) {
            double total = 0.0;
             for (Expence ex : expences) {
             total = total + Double.parseDouble(ex.getAmount());
             }
            distribution[i] = total;
          } else {
              distribution[i] = 0.0;
        }
       }


// Colour of each Pie Chart Sections
        int[] colors = getResources().getIntArray(R.array.rainbow);

        // Instantiating CategorySeries to plot Pie Chart
        CategorySeries distributionSeries = new CategorySeries("Expenses Graph");
        for (int i = 0; i < distribution.length; i++) {
            // Adding a slice with its values and name to the Pie Chart
            distributionSeries.add(code[i], distribution[i]);
        }

// Instantiating a renderer for the Pie Chart
        DefaultRenderer defaultRenderer = new DefaultRenderer();
        for (int i = 0; i < distribution.length; i++) {
            SimpleSeriesRenderer seriesRenderer = new SimpleSeriesRenderer();
            seriesRenderer.setColor(colors[i]);
            seriesRenderer.setDisplayChartValues(true);
            // Adding a renderer for a slice
            defaultRenderer.addSeriesRenderer(seriesRenderer);
        }

        defaultRenderer.setChartTitle("Expenses Graph");
        defaultRenderer.setChartTitleTextSize(50);
        defaultRenderer.setLabelsTextSize(40);
        defaultRenderer.setLegendTextSize(50);
        defaultRenderer.setShowLegend(true);
        defaultRenderer.setDisplayValues(true);
        defaultRenderer.setApplyBackgroundColor(true);
        defaultRenderer.setBackgroundColor(Color.WHITE);
        defaultRenderer.setLabelsColor(Color.BLACK);
        defaultRenderer.setZoomButtonsVisible(true);

       LinearLayout chartContainer = (LinearLayout) findViewById(R.id.chart);
// drawing pie chart
        mChart = ChartFactory.getPieChartView(getBaseContext(),
                distributionSeries, defaultRenderer);
// adding the view to the linearlayout
        chartContainer.addView(mChart);


No comments:

Post a Comment