How to use Native Activity and View from Java

by lorydi » Thu, 10 Mar 2011 09:46:32 GMT

Sponsored Links
 I have a game developed in Java with the SDK. Now I have to track the
events from Xperia Play touchpad which are only available in native
code. What is the most simple solution to do this? I want to keep the
Java code and only change the Activity into NativeActivity . The
problem that I face is that I don't know how to make the paint on the
my normal SurfaceView class, the screen remains black.


Re: How to use Native Activity and View from Java

by jaafar zbeiba » Sat, 12 Mar 2011 04:21:55 GMT

 I use a JPasswordField but I have a problem with java.awt.event java.swing
and that can help me
com.example.tuto package;

import javax.swing .*;
import java.awt .*;
import java.awt.event .*;

public class Input extends JFrame implements ActionListener {

JPasswordField pass;
JButton test = new JButton ("get");

public Password () {
JPanel pane = new JPanel ();
test.addActionListener (this);
pane.setLayout (new FlowLayout ());
pane.add (pass = new JPasswordField (15));
pane.add (test);
setContentPane (pane);
setVisible (true);


Sponsored Links

Other Threads

1. Is it possible for me to install Java Application(.java) on Android?

    im new here. I am familiar with java programming. However, i am
not sure if i can create application using Java SE instead of using
the Android SDK and installed it on Android Phone?

I have found out a website on this stating :

"But Android programs are written in Java, using Java-oriented IDEs
(it also comes with an Eclipse plugin)it just doesn compile the
java code into java bytecode but (ops, Sun didn see this one coming)
into Dalvik bytecode.

So, Android uses the syntax of the Java platform (the Java anguage
if you wish, which is enough to make java programmers feel at home and
IDEs to support the editing smoothly) and the java SE class library
but not the Java bytecode or the Java virtual machine to execute it on
the phone (and, note, Android implementation of the Java SE class
library is, indeed, Apache Harmony!)"

Does that mean I can use only Java syntax to do my programming in
ANDROID SDK but i cannot directly execute a java application using

Android has this R.Java file, follows a Layout Structure using XML.
These are different from Java SE. If Android can really support a new
compiled Java Application, How should i installed it on Android

Thanks for attention and help :)


2. Trouble installing from SDK and AVD Manager: access denied unzipping

I have successfully installed and am using sdk API's 2-5 and google
api level 5 from within eclipse.  However, I am unable to install
other updates (such as API 6 and, more importantly, the USB driver
package) with errors such as "Unzip failed: C:\Program Files\eclipse
\ExtraPackage.new01\i386\WinUSBCoInstaller.dll (Access is denied)".

Has anyone seen this before?  I don't know what, if anything would be
preventing access to these files.  I am not out of disk space or
running multiple IDE's or anything like that.  I am running under
Windows 7, but I have seen issues like this on another XP machine as


3. Menu problems in emulator

4. How to show menu item automatically?

5. Contacts onActivityResult

6. MD5 Hash is wrong

7. When a MediaPlayer object is just created using new ? 3 part question