Tuesday, 20 December 2016

Android Studio Retrieve Data from a Firebase Database

In this tutorial I show you how to retrieve realtime data from a Firebase Database using Android Studio. The Firebase database stores the information as a JSON file and I show you how to retrieve each branch of information from that tree.


Saturday, 10 December 2016

In this tutorial I show you how to build a multiple choice quiz with Android Studio from the ground up. In the first part of this tutorial we build the user interface, then we design a class to store our questions, choices and our correct answer then we create our logic.

You can visit my github page to download the completed project:

https://github.com/skooltch84/MultipleChoiceQuiz.git



Saturday, 26 November 2016

Adding a Map to a Fragment in Android Studio

Adding a map to an activity in android studio is a piece of cake if you follow the documentation. However adding a map to a fragment is a different story. Once you have your fragment you need to:


  • Obtain your api key. and paste this information into your manifest. 
  • Set the version of gl Es in the manifest
  • Set permissions in the manifest
  • Create a frame layout in your xml file
  • Add a mapView to this layout
  • Implement onMapReadyCallBack in your java file and add methods
  • Configure your map.
All of this can be done in under 8 mins. Just watch the video below.



Tuesday, 18 October 2016

Adding a Custom CalendarView Using Android Studio to Highlight Event Dates

For the past six months or so I have been trying to add a calendar to my android app without success. I have the calendar widget that comes with Android Studio but that has limited functionality. I googled Custom CalendarView and found that Caldroid was the recommended custom calendar to use. However its not that easy to implement especially for a novice like myself. Then I stumbled upon CompactCalendarView by SundeepK which was easier to implement. It can be found at the link below:

https://github.com/SundeepK/CompactCalendarView

It only took 4 steps:

  • Add the dependency to the build.gradle app file
  • Add the CompactCalendarView widget to your XML layout file
  • Add the gist below to your main activity file
  • Run your program.




Below is a youtube video that helps you with the steps.





Monday, 10 October 2016

Converting From One Data Type to Another

Convert.ToXXX

XXX can be replaced by the .NET name of the type that we want to convert to.

Examples:

string age = "13"

int ageToInt = Convert.ToInt32(age);

when we check the value of ageToInt it should be 13;

We also have:

  • Convert.ToDouble();
  • Convert.ToBoolean();
  • Convert.ToInt16();
  • Convert.ToInt64();

Sunday, 9 October 2016

C# Objects part 1

Did you know that C# is an object oriented programming language (OOP)?


Computer programs are made up of objects that usually interact with each other. For example in a game you have an object called "hero" and this object "hero" may have to interact with an object called "villain". 

  • Objects have different attributes and behaviors.
  • When one is about to build software he should consider all the objects that he/she may need.
  • It is even possible that some of these objects could be reused in other programs.


Types of Objects:

  • int e.g 1, 2, 3, 100, 1000, -10000 (positive and negative whole numbers.
  • double e.g 2.234, 6.878, 75.55 (decimals)
  • string e.g "Hello World" (text enclosed by quotation marks)

Classes:

A class is a blueprint for making objects of a particular type. Doubles, ints and strings are examples of classes.

Classes contain attributes or things we call fields. Every field has an accessibility level which determines if it can be accessed outside of the class. A public keyword means that a field can be accessed from outside the class whereas a private keyword means that it cannot.

These fields can be accessed using dot notation.
e.g 

class Car {
public int NumberOfWheels;
private int NumberOfDoors

}

//Creating a car object
Car car = new Car();

//Using dot notation to give that car 4 wheels
car.NumberOfWheels = 4

Instances:

An instance of that class is an individual object of that particular class.

Lets say we had a class Car and we wanted to create a car object.





That is all there is to it!.


  • "Hello World" is an object of type string;
  • 4 is an object of type int;
  • 3.142 is an object of type double;

Constructors:

Constructor methods ensure that the fields in a class are filled out when we create an object by using a constructor method. Constructor methods are used to create instances of a class and they have the same name as the class that they are in(they are used to initialize an object).





Constructors do not return any values.

Monday, 12 September 2016

Designing the Stator

These videos may provide some insight on how to design a wind turbine /axial flux alternator stator.

Building a coil winder
https://www.youtube.com/watch?v=h5KxIVtr_4U

Casting the Coils in fiberglass resin
https://www.youtube.com/watch?v=BBAGJuiC45o

Sunday, 31 January 2016

IOS vs Android

As a new IOS/ Android developer I have to admit that IOS is superior to the Android operating system. Why would someone design an operating system that is incompatible with phones that are less than three years old. I purchased my Samsung galaxy s iii in January 2013 about 7 months after it's release. This phone came with Android 4.04 and was upgraded to android 4.3. Android 6.0 has been released but this phone doesn't support that OS. The phone has pretty decent specs:

samsung galaxy i9300

and it still works but it will not support a legit version of android 6.0.

When building apps, you want to design apps that are compatible with as many phones as possible. Most phones running android use android 4.04. When designing an app one has to use the less advanced features of Android 4.04. This is not the case with IOS. Apple supports all of its devices. Their apps can work on all the devices that they were designed to work on. If android wants to compete with IOS they may have to start supporting older devices.


Android Studio is used to build apps for Android and Xcode is used to build apps for IOS. Both are free but Xcode will only work on a Mac. I designed the same app "Fun Facts" as part of training for an online course. It was easier to work with Xcode than Android Studio. Android studio had many rendering problems that may discourage beginners. However once it is setup it runs decent albeit a few rendering problems here and there. Xcode may run a little sluggish at times but I believe it may run better on a macbook pro(A mac-mini (1.4 GHz dual core i5, 4 GB Ram) was used to run both Android Studio and Xcode).