Android Studio – using photo camera.

This tutorial is a good example how to use photo camera with Android Studio.
Start the default project named BitCam and change this files:
The BitCam.java file:

The activity_bit_cam.xml file:

The result is a android application with a button.
When you press the button the photo camera start.

Android Studio – the calendar widget .

This is a simple example about using widget calendar under Andoid OS.
Can be easy to do it if you know the basic of the programming.
First you need to make one application ( I use Android Studio – version 0.5.1).
Let’s see my example:
My application use:
the class is :
public class MainActivity extends ActionBarActivity
the project is set with this :
com.example.calendar.app
the widget is : CalendarView
I make this changes into this source files :

  • MainActivity,java
  • AndroidManifest.xml
  • activity_main.xml
  • main.xml
  • strings.xml

The source code for this files come with default source code and change is CalendarView :
The result working well. Also you can see in this picture the calendar result :

android_calendar_001

Android Studio – using SensorEventListener.

This tutorial is about programming android hardware sensors service: TYPE_ACCELEROMETER.
You can start by using last version of Android Studio version 3.1.1 with the default project Empty Activity.
Is very simple to use accelerometer with Android Studio by read the values and show us into the text view area.
The SensorEventListener is used to read this values.
The MainActivity will need work with: … implements SensorEventListener.
This example can be used also like a good way to learn about this issues.
Note:

  • the implements is a keyword specific to interfaces, whereas extends is used to inherit classes;
  •  a class must implement all methods of an interface, unless the class is declared as abstract.

You need to change the default text Hello World from activity_main.xml file with this:

Make changes into MainActivity.java file
The functions: onSensorChanged and onAccuracyChanged is not created by I.D.E. and can be created by code inspections when you write the source code.

The result is a text with the values of accelerometer of your hardware.

JavaScript – Processing.js 2D library – part 004.

The Processing.js is available for Linux, Mac OS X, and Windows and come with the last version 3.3.7 (13 March 2018).
Today I tested processing.js for android. They say us about this issue:
Use Processing for Android to create Android apps with ease, including live wallpapers, watch faces, and VR apps. You can run your Processing sketches on Android devices (phones, tablets, watches) with little or no changes in the code, and without worrying about installing SDK files or editing layout files. Processing for Android also lets you accessing the Android API to read sensor data, and exporting your sketch as a signed package ready to upload to the Google Play Store.
To use processing.js for android you need to follow this links:

They tell us about new android processing :
The version 4.0 brings several improvements to the Android mode, incuding new functionality for creating live wallpapers, watch faces, and VR apps.

Go – Testing Golang with android application – part 001 .

This is my first tutorial in a long series about Go and Android programming. In the limit of my free time I will try to show you how to do simple applications with the Go programming language (or known as Golang).
You need to install the Go programming language using MSI installer from here.
I set the folder with this path – C:\Go\ but my windows also put some go files under Users folder.
If you want you can to add the Go path into windows environment.
You will have this path in this case: C:\Users\your_account\go\.
The next step is to install the Android NDK from here.
I install the Windows 64-bit into Users folder. You need to install at: C:\Users\your_account\go\.
Because I don’t have a good go programming android example I used the basic default example from golang mobile.
Let’s see the commands to install and used it:

About the gomobile command then the help tell us:

If you have the adb command installed on your machine, you can use gomobile command with the argument install to push the APK to your mobile device.
I used Bluestacks emulator for android and the basic example working well.