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.

C# – First steps with C# and .NET – part 003 .

This tutorial show you how to deal with a C# and forms using Visual Studio Community 2017.
You need to start your project with C# – Windows Form Apps (.NET Framework).
On this default form window project you can change title and some settings like size, colors .
After that , you need to add editbox and label for each area from country , city street and number to window form.
In my example I used text_country for the name of editbox and I let default label1 for the label. The text from label1 I changed to Country to see it on form.
Make this changes for each editbox and label.
You need to have one button named search map point and one webbrowser area to show the location on map.
Next, press on button and make the changes into source code to work with webbrowser area.
The source code is simple – see bellow sorce code and the application screenshot.
The application can be found here:

Go – about errors .

The golang come with a fair amount of functions end up returning errors like values.
The golang errors functions looking like this:

You can use the errors package and that implements functions to manipulate errors.
The official golang example:

You can see how is created the new custom errors using the New function:

The fmt package formats an error value by calling its Errorf() string method, see example:

You can add more information about the error using struct type and fields.
The error type is an interface type and can be used into this way.

And an error variable represents any value that can describe itself as a string, see example: