Skip to content

Android sandbox project configuration

Francisco edited this page Aug 4, 2015 · 3 revisions

The Android sample app lives under Charts/TRChartsAndroidSandbox and has been tested with devices as low as API16 with low specs, yielding performance of 60+ frames per second.

Building

The project uses gradle as its build system with android-tools pre-1.3, prior to the official C++ support. We're accepting pull requests to update it. Usage of Android Studio is recommended. The project requires Android NDK downloaded and available on your computer. The C++ library will recompile itself for all platforms after every C++ file change.

Last Update - 07/2015

  1. To import the project, go to Android Studio -> File -> New... -> Import Project...
  2. From there, navigate to Charts/TRChartsAndroidSandbox in your repository, and accept on the dialog.
  3. Your project may need a new gradle wrapper, so accept in the following dialog to create an updated one.
  4. At this point your gradle build will fail, because of the missing ndk configuration. Open your local.properties and add your ndk path as ndk.dir=/Users/MYUSER/android-ndk-r10c or your OS equivalent.
  5. Sync your project with the gradle files now, and watch the project build on the gradle console.
  6. Your project should build now.

File structure

The C++ library needs to be loaded as early as possible, either from the initial Activity, or by the Application class.

The package com.thomsonreuters.charts.trchartsandroidsandbox.chartlib contains an approximation of how a library would be structured. TRChartsView is an extension of GLView you can put on your layout files, and it uses a TRChartsAbsRenderer to update its state. The renderer handles internal update of the C++ model via native calls.

Under the com.thomsonreuters.charts.trchartsandroidsandbox.chart package you can find an example of an implemented renderer called LineChartRenderer, and a fully styled chart factory called ChartExample.

Clone this wiki locally