Basically template matching is the matching of a single descriptor versus a huge database of descriptors, called a codebook, which is rather computational expensive. Considering that your android application is probably running on a mobile device, also consider that mobile devices do not have the computational power of a desktop PC. Hardware is not as strong, processing power is lower, interfaces require more time, ... it is the downside of mobile devices.
If you want to speed up your template matching then several approaches can be applied, but don't expect to large improvements. Template matching will take long.
- Try to create a codebook with just enough samples to get good matches for your case. This means that you do not want to get a codebook as large as possible, since more matching will need to be done, increasing your time.
- Reduce the size of your input windows --> will lead to more compact descriptors of the images and patches, which will reduce computational time.