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.

PowerShell tips – part 009.

Today I come with this simple tutorial about how to show logs from the last day.
The command is very simple and can be used with powershell and administrator command shell like this:

This command is build from Get-EventLog and parse by Get-Date, see options:

About AddDays is not only option you can use it.
You can get all of this options using this command: