Extende Native Activity and override KeyEvent.Callback interface

30 views
Skip to first unread message

Pietro

unread,
Feb 6, 2015, 11:00:04 AM2/6/15
to andro...@googlegroups.com
Hi everyone,

I having problem with a NativeActivity subclass I am working on, my goal would be to catch and handle key events from the Java code instead of
 native code (this is mainly due because this), unfortunately I can not see the Log() present in the onKeyDown method though the
onCreate() log is being printed and the log prints I have placed in the native code are as well. It seems that the onKeyDown of my NativeActivity subclass is never called.

Any idea ?

public class CNativeActivity extends NativeActivity{                                                                                                                                    
                                                                                                                                                                                             
       
private final static String TAG = "CNativeActivity";                                                                                                                            
                                                                                                                                                                                             
       
protected void onCreate(Bundle savedInstanceState) {                                                                                                                                  
           
Log.v(TAG, "onCreate");                                                                                                                                                          
           
super.onCreate(savedInstanceState);                                                                                                                                              
       
}                                                                                                                                                                                    
                                                                                                                                                                                             
       
@Override                                                                                                                                                                            
       
public boolean onKeyDown(int keyCode, KeyEvent event) {                                                                                                                              
           
Log.v(TAG, "onKeyDown");                                                                                                                                                          
           
return true;                                                                                                                                                                      
       
}                                                                                                                                                                                    
                                                                                                                                                                                             
}                                                                                                                                                                                          
~    


Reply all
Reply to author
Forward
0 new messages