Ejemplo n.º 1
0
CJNISurfaceTextureOnFrameAvailableListener::CJNISurfaceTextureOnFrameAvailableListener()
: CJNIBase(CJNIContext::getPackageName() + ".XBMCOnFrameAvailableListener")
{
  CJNIMainActivity *appInstance = CJNIMainActivity::GetAppInstance();
  if (!appInstance)
    return;

  // Convert "the/class/name" to "the.class.name" as loadClass() expects it.
  std::string dotClassName = GetClassName();
  std::replace(dotClassName.begin(), dotClassName.end(), '/', '.');
  m_object = new_object(appInstance->getClassLoader().loadClass(dotClassName));
  m_object.setGlobal();

  m_listenerInstance = this;
}
Ejemplo n.º 2
0
CJNIBroadcastReceiver::CJNIBroadcastReceiver(const std::string &className) : CJNIBase(className)
{
  CJNIMainActivity *appInstance = CJNIMainActivity::GetAppInstance();
  if (!appInstance || className.empty())
    return;

  // Convert "the/class/name" to "the.class.name" as loadClass() expects it.
  std::string dotClassName = GetClassName();
  for (std::string::iterator it = dotClassName.begin(); it != dotClassName.end(); ++it)
  {
    if (*it == '/')
      *it = '.';
  }
  m_object = new_object(appInstance->getClassLoader().loadClass(dotClassName));
  m_receiverInstance = this;
  m_object.setGlobal();
}