Using the camera

Hi all,

I’m new to this community and to programming in software AG.
There for, the solution to my question can be easy but i realy don’t find it.

In my app, i need to take a picture with the camera.
But i have no idea how to open the camera view, and make the picture…

Is there a good example code anywhere…?

Thnx in advance.

Ken

check the Java API at:
com.softwareag.mobile.runtime.media.CameraHandler

getCameraSnapshot method etc.
the document is under:
_documentation\webMethods\Mobile_Designer\9-0-SP1_Mobile_Designer_Java_API_Reference

Correct me if im wrong.
But as far as i understand the API,

  • First i need te make a new object of the class “CameraHandler”
  • Then i need te connect te handler to my canvas.
  • Then i use the function “createCamera()” to set my camera

And then i shoud see the videostream of the camera on the screen…?

Because all i get is al black screen from the code below


public class CameraView extends nUIViewDisplay{
	public CameraView (MyCanvas controller, ExpenseItem current_expense)
	{
		super (Constants.NUIID_SETTINGS_VIEW);
		this.controller = controller;
		
		if(current_expense!=null)
			setHeadertext ("Photo: "+current_expense.getName());
		else
			setHeadertext ("Photo: New expense");
		
		CameraHandler camera = new CameraHandler();
		camera.initCamera(controller);
		camera.createCamera();
		camera.getCameraSnapshot("PNG", 100, 100);
		
		// Button to go back
		add(new nUINavbuttonElement(Constants.NUIID_BACK_PHOTO_VIEW, Util.getString(Parameters.TEXTID_BUTTON_BACK), nUINavbuttonElement.TYPE_BACK, null));
	}

	protected MyCanvas controller = null;
}

Or is this normal because i run this on my computer…

I can’t see anything wrong with your code. pls try to run it on a phone. I’m not sure if your simulator on computer will take control of its camera, most likely not.

Hello, Tong. I am also new here to do intership in Software AG. Are u still in here? I am chinese also. Now i do some Mobiel Development works, but I have some problems with the database and server connection. Can we exchange the contact way? Thank u a lot

Pigeon,
If you have questions/issues, post it to the forum.
I’m sure someone will help you.
Tong

Hey, hello,
I met a question. I know codes using cookbook. I used the HttpConnection.openHttpConnectionByteArrayData(String url, int encoding_format, byte data_to_send, String request_properties) this method to try a connect to server using Intergration Server. (localhost : 5555). So my questions are:

  1. I wanna know about the JDBC, Server, Client and Database the connection structure, because my cookbook author has already configured the structure, I do not need to do that any more, but I write the same codes like the cook book, and I run the cookbook original source programm, it runs, but my did not work, and It has also not problem about the logic.
    I want to know, how I can know, wether I already connect to the Server?
    Best Regards
    Pigeon

If you are connecting to a Integration Server, check the sessions on IS side, so you will know if your connection is working.

Also, try to do something with your opened connect, so you will know if it works.
HTH,

Hey, Wang Tong. How are you, thank you for ur replay. I have tried ur eay and i have solve the Problem I met befor about the server conncetion. I met some questions more unfortunetly, I have wrote it in the forum with some pictures, maybe it will be better to be understood. And I personally has a questoin, that is has Mobile Designer some WYSIWYG tool to design the UI for Applications, like “Droid-Draw” or “Xamarin” ?

Thank you Tong Wang and Thanks for everyone who maybe some tipps!
HU, Tiange