What is .NET?

Windows Developers Usually Use Microsoft .NET When Writing Programs

If you are new to writing software for Windows personal computers (PCs) it is not long before you come across Microsoft .NET (pronounced “dot net”). What is .NET? The simplest answer is to say that .NET is used to build and run programs on a computer. (For the complete beginner who knows nothing about computer programs read our article What is Computer Programming?) In this post we attempt to provide a brief explanation to .NET in they way of an introduction. Microsoft .NET is an important Windows technology to ease the development of computer programs.

.NET Provides a Framework to Help Write Complex Programs

Steel Building FrameworkWhenever you see a building, such as an office block or skyscraper, being constructed you will notice that a steel frame is used to provide the basic structure. On to this frame is fixed walls, windows, floors, ceilings and everything else that makes up a building. The framework is made of steel beams, rivets and welds. Everything that is attached to it is made from common building materials and components. It is the architects and builders that determine the final look of the building using standard components.

A similar thing occurs when computer programs are written, the software developer (a.k.a. computer programmer) decides the final functionality and look of a program but will use an existing set of components to help achieve the end requirement.

Microsoft .NET Libraries and Runtime Engine

Microsoft .NET is a computer framework that contains hundreds of useful components. The components are gathered together into libraries to organize them into categories. Libraries that contain components to draw on the screen, read input, talk to the Internet, etc. This allows the programmer to concentrate on producing the functionality of the software and not have to work on the code that controls the hardware. Modern software programs are written with a tool called an Integrated Development Environment (IDE). An IDE allows the programmer to write the code in an editor, run the code to test it and use a debugger to fix any errors found during testing. Many IDEs come with a set of common existing components to use, such as text boxes, buttons and image containers.

Visual Studio IDE

An Intergrated Development Environment

With the .NET framework and an IDE it only takes a few lines of code to get a simple program working. The speed of software development using .NET makes it a very useful framework for developers writing Windows programs. Continue reading

Context Menu Example for Android

Take Your First Steps in Implementing Context Menus in Android

In this tutorial we provide an Android context menu example, using the aptly named ContextMenu class. On a Windows PC system the context menu is sometimes referred to as the right-click menu. (Though using this term is no recommended in case the user is left handed and has switched the mouse, in which case the context menu requires the left-click!)

Android Calendar Context MenuA context menu is a menu of options that apply to the item immediately under the pointer (mouse or finger). For example in the Android Calendar the context menu can be used to add an event to the diary, for the selected hour press and hold until the menu appears. The parts required to implement a simple context menu are:

  1. Define the menu captions, usually in a string resource file.
  2. Define the menu layout in an XML file.
  3. Tell Android a View is using a context menu.
  4. When the context menu is requested show it.
  5. React to the selected menu item.

The example code presented here is going to call the setColorFilter method of an ImageView using a context menu. This will be used to add a basic image effect to a bitmap graphic by applying a red, blue or green filter. In this tutorial we are assuming that you have a working project in Eclipse to use as a base. If not see the article Displaying a Bitmap in Android to generate one. Continue reading

Running an Android SDK Sample App

How to Load and Run a Sample Program from the Android SDK

The Android Robot LogoThe Android Software Development Kit (SDK) gets updated with new version platforms for each new release of the Operating System (OS). Each version platform can be loaded onto your development machine with SDK Manager.exe. There are available sample Applications (Apps) to showcase Android features and provide example code that allows developers to see how to use the Android Application Programming Interface (API).

Getting Hold of the Android Samples

Each SDK platform version provides Android sample source code project, however, they must be selected for installation on your development machine using the SDK Manager program. Run SDK Manager and wait for it to finish doing it’s checks. Expand the required Android Version folder to see and select the Samples for SDK option.

Exmaple Apps can be Loaded with the SDK Manager

Once the samples have been installed they will be found in the android-sdk/samples folder in the Android SDK’s install directory. (On Windows this may be under the Local Settings/Application Data folder, e.g. C:\Documents and Settings\John Doe\Local Settings\Application Data\Android, or wherever you chose to install it.) There will be a folder for each Android API version for which you chose to install the samples, called android-x where x is the API version.

Android SDK Samples

See our article Use Android SDK Samples for Guidance to see a list, and brief description, of the example Apps supplied with the various Android versions. Continue reading

Changing the Font for Android TextViews and EditTexts

Easy Font Modifications to Get Different Text Styles in Android

Setting a new font when developing an Android App puts your own style onto the user interface (UI) and can help it stand out from the crowd. For many Activity screens the interface is usually constructed using Android layouts and interface widgets. The interface widgets, such as CheckBoxes and TextViews, have various properties that can be easily modified to change their look. Changing properties is done via the Properties list when viewing an Activity in the Graphical Layout screen in Eclipse, by editing the layout XML directly, or finally by using code to set property values.

This article mainly covers changing the look of a widget’s font using the Properties list. You can follow this article as a tutorial by starting a new Android Application Project in Eclipse and playing with widget properties as we go. (See our article Your First Android Java Program if you do not now how to create a basic App project. Here we have called the new App and project Android Fonts and given the package name biz.tekeye.fonts but you will be using you own package name.)

Edit Text Properties with the Android Development Tools Graphical Layout

Drag and drop a medium Android TextViewWith the activity_main.xml layout open and the Graphical Layout shown (click the tab at the bottom of the edit area if required) drag and drop some Medium TextViews onto the first activity’s screen. Click on the Form Widgets tab if needed to find the TextViews. With a TextView selected its properties can be changed in the Outline pane. If the Outline pane is not visible use the Eclipse Window and Show View menu option to select Outline to display it. Continue reading