Android Open Source - sensorreadout Export Task






From Project

Back to project page sensorreadout.

License

The source code is released under:

Apache License

If you think the Android project sensorreadout 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.onyxbits.sensorreadout;
//  w ww. j a  v  a 2 s  .c o m
import org.achartengine.model.XYMultipleSeriesDataset;
import org.achartengine.model.XYSeries;

import android.content.Intent;
import android.os.AsyncTask;

/**
 * Builds the CSV dump for sharing.
 * 
 * @author patrick
 * 
 */
class ExportTask extends AsyncTask<XYMultipleSeriesDataset, Integer, String> {

  private ReadoutActivity activity;

  public ExportTask(ReadoutActivity activity) {
    this.activity = activity;
  }

  @Override
  protected String doInBackground(XYMultipleSeriesDataset... params) {
    StringBuilder sb = new StringBuilder();
    XYSeries series[] = params[0].getSeries();
    int samples = series[0].getItemCount();
    for (int i = 0; i < samples; i++) {
      sb.append(i);
      sb.append(", ");
      sb.append(series[0].getY(i));
      if (series.length > 1) {
        sb.append(", ");
        sb.append(series[1].getY(i));
        if (series.length > 2) {
          sb.append(", ");
          sb.append(series[2].getY(i));
        }
      }
      sb.append("\n");
      publishProgress(10000 * i / samples);
    }
    return sb.toString();
  }

  @Override
  public void onPreExecute() {
    activity.setProgressBarVisibility(true);
  }

  @Override
  public void onProgressUpdate(Integer... values) {
    activity.setProgress(values[0]);
  }

  @Override
  public void onPostExecute(String result) {
    activity.setProgressBarVisibility(false);
    Intent sendIntent = new Intent();
    sendIntent.setAction(Intent.ACTION_SEND);
    sendIntent.putExtra(Intent.EXTRA_TEXT, result);
    sendIntent.setType("text/plain");
    activity.startActivity(Intent.createChooser(sendIntent, activity
        .getResources().getText(R.string.send_to)));
  }
}




Java Source Code List

de.onyxbits.sensorreadout.AppRater.java
de.onyxbits.sensorreadout.ExportTask.java
de.onyxbits.sensorreadout.OverviewActivity.java
de.onyxbits.sensorreadout.ReadoutActivity.java
de.onyxbits.sensorreadout.SensorAdapter.java
de.onyxbits.sensorreadout.Ticker.java
org.achartengine.ChartFactory.java
org.achartengine.GraphicalActivity.java
org.achartengine.GraphicalView.java
org.achartengine.ITouchHandler.java
org.achartengine.TouchHandlerOld.java
org.achartengine.TouchHandler.java
org.achartengine.chart.AbstractChart.java
org.achartengine.chart.BarChart.java
org.achartengine.chart.BubbleChart.java
org.achartengine.chart.ClickableArea.java
org.achartengine.chart.CombinedXYChart.java
org.achartengine.chart.CubicLineChart.java
org.achartengine.chart.DialChart.java
org.achartengine.chart.DoughnutChart.java
org.achartengine.chart.LineChart.java
org.achartengine.chart.PieChart.java
org.achartengine.chart.PieMapper.java
org.achartengine.chart.PieSegment.java
org.achartengine.chart.PointStyle.java
org.achartengine.chart.RangeBarChart.java
org.achartengine.chart.RangeStackedBarChart.java
org.achartengine.chart.RoundChart.java
org.achartengine.chart.ScatterChart.java
org.achartengine.chart.TimeChart.java
org.achartengine.chart.XYChart.java
org.achartengine.model.CategorySeries.java
org.achartengine.model.MultipleCategorySeries.java
org.achartengine.model.Point.java
org.achartengine.model.RangeCategorySeries.java
org.achartengine.model.SeriesSelection.java
org.achartengine.model.TimeSeries.java
org.achartengine.model.XYMultipleSeriesDataset.java
org.achartengine.model.XYSeries.java
org.achartengine.model.XYValueSeries.java
org.achartengine.renderer.BasicStroke.java
org.achartengine.renderer.DefaultRenderer.java
org.achartengine.renderer.DialRenderer.java
org.achartengine.renderer.SimpleSeriesRenderer.java
org.achartengine.renderer.XYMultipleSeriesRenderer.java
org.achartengine.renderer.XYSeriesRenderer.java
org.achartengine.tools.AbstractTool.java
org.achartengine.tools.FitZoom.java
org.achartengine.tools.PanListener.java
org.achartengine.tools.Pan.java
org.achartengine.tools.ZoomEvent.java
org.achartengine.tools.ZoomListener.java
org.achartengine.tools.Zoom.java
org.achartengine.util.IndexXYMap.java
org.achartengine.util.MathHelper.java
org.achartengine.util.XYEntry.java