【发布时间】:2013-10-07 15:46:00
【问题描述】:
我试图从“Androidapi.JNI.App.pas”(TJservice)扩展一个类/接口,我需要扩展这个类来提供服务。是否可以?怎么样?
some example of java/android service
我需要重写方法,例如:oncreate、onbind、ondestroy。但我不知道怎么做。
我尝试过这样的事情:
type Tandroidservice= class(TJService)
function onBind(intent: JIntent): JIBinder; override;
procedure onCreate; override;
procedure onDestroy; override;
procedure onStart(intent: JIntent; startId: Integer); override;
end;
出现此错误:
[DCC Error] Unit1.pas(13): E2137 Method 'onBind' not found in base class
[DCC Error] Unit1.pas(14): E2137 Method 'onCreate' not found in base class
[DCC Error] Unit1.pas(15): E2137 Method 'onDestroy' not found in base class
[DCC Error] Unit1.pas(16): E2137 Method 'onStart' not found in base class
[DCC Error] Unit1.pas(13): E2065 Unsatisfied forward or external declaration: 'Tandroidservice.onBind'
[DCC Error] Unit1.pas(14): E2065 Unsatisfied forward or external declaration: 'Tandroidservice.onCreate'
[DCC Error] Unit1.pas(15): E2065 Unsatisfied forward or external declaration: 'Tandroidservice.onDestroy'
[DCC Error] Unit1.pas(16): E2065 Unsatisfied forward or external declaration: 'Tandroidservice.onStart'
【问题讨论】:
-
CTRL+CLICK TJService,看看哪些方法被标记为virtual
标签: java android delphi class delphi-xe5