Connect with us

Computer Software

Android Programming for beginners guide

Published

on

Android Programming for beginners guide

Android Programming for beginners: Smartphones and tablets on Android are increasingly found in our bags and pockets, and Android Programming for beginners is also becoming more popular. This is an excellent platform for development – the API is well documented and easy to use, and just interesting to create something that you can run on your smartphone. Initially, you can do without it, by creating and testing the code using an emulator on your Linux PC. The first of two parts of this introduction explains how to create a simple application with a timer, as well as give the initial information about the Android API. The course implies the availability of initial ideas about Java, XML and programming technologies, but nevertheless feel free to try even if you have a very vague idea about it.

Getting started and development environment

A little bit about the versions: the latest version of Android is 4.2 (Jelly Bean), but, as you can see on this diagram, it is still not widely distributed. It’s best to start development under one of the versions: 4.0 (Ice Cream Sandwich) or 2.3 (Gingerbread), especially considering that Android versions support backward compatibility (ie your code for version 2.3 will work on 4.2), and Applications developed for a later version will not always work on the old one. The code shown here should work on versions 4.0 and 2.3.
The easiest way to get the development environment is to install the Android Bundle, which can be downloaded here. You will also need JDK 6 (not only JRE). Do not forget that Android is not compatible with gcj. If you already use Eclipse or another IDE, then you can try to configure it for Android. How to do this is described here. Now create a project called Countdown with Eclipse, or from the command line. I installed in BuildSDK 4.0.3 and minimum SDK 2.2, and (in Eclipse) I used the BlankActivity template.

My first Android project: interface

Our first program for Android will be a timer, showing a countdown from 10 seconds after pressing the button. Before you write code, you need to create an interface – something that the user sees by running our application. You need to open res/layout / activity_countdown.xml and create an XML template – use the Eclipse editor or the text / XML editor to enter the following:

<RelativeLayoutxmlns:android=”http://schemas.android.com/apk/res/android”

xmlns:tools=”http://schemas.android.com/tools”

android:layout_width=”match_parent”

android:layout_height=”match_parent”>

<TextView

android:id=”@+id/time_display_box”

android:layout_width=”wrap_content”

android:layout_height=”wrap_content”

android:layout_alignParentTop=”true”

android:layout_centerHorizontal=”true”

android:layout_marginTop=”60dp”

android:text=”@string/_00_30″

android:textAppearance=”?android:attr/textAppearanceLarge”/>

<Button

android:id=”@+id/startbutton”

android:layout_width=”wrap_content”

android:layout_height=”wrap_content”

android:layout_below=”@+id/time_display_box”

android:layout_centerHorizontal=”true”

android:layout_marginTop=”41dp”

android:text=”@string/start” />

 

</RelativeLayout>

Notice the string / start and string / __ 00_30. Their values will be located in res / values / strings.xml:

<string name=”start”>Start</string>

<string name=”_00_30″>00:30</string>

 

This is a common way to access resources in Android: it’s better to use references to string variables than hard-coded strings.

My first Android project: code

Now open the file CountdownActivity.java in the editor – and we are ready to write the code of our application. You should see the automatically generated “stub” of the onCreate () method. It is always called as soon as an Activity object is created, and you can place any functions in it, which should be executed when the application is launched. (Eclipse can also create an empty method onCreateOptionsMenu (), but we will not pay attention to it yet). Enter the following code:

publicclassCountdownActivityextendsActivity {

 

privatestaticfinalint MILLIS_PER_SECOND = 1000;

privatestaticfinalint SECONDS_TO_COUNTDOWN = 30;

privateTextViewcountdownDisplay;

privateCountDownTimer timer;

@Override

publicvoidonCreate(Bundle savedInstanceState) {

super.onCreate(savedInstanceState);

setContentView(R.layout.activity_countdown);

 

countdownDisplay = (TextView) findViewById(R.id.time_display_box);

Button startButton = (Button) findViewById(R.id.startbutton);

startButton.setOnClickListener(newView.OnClickListener() {

publicvoidonClick(View view) {

try {

showTimer(SECONDS_TO_COUNTDOWN * MILLIS_PER_SECOND);

} catch (NumberFormatException e) {

// method ignores invalid (non-integer) input and waits

// for something it can use

}

}

});

}

}

Android Programming for beginners: You see how simple it was to create our first project: the Android API includes CountDownTimer, which we can use. We declared it and the countdown display field as private properties of the Activity class. In the onCreate () method, we used the setContentView method to attach our XML template. This R.foo.bar syntax is the standard way of accessing XML resources in Android, and we will meet with it many more times.
findViewById is another method that you will often use. Here it returns references to the timer output field and the Start button, described in the XML template. For the button, so that we can process its pressing, the “interceptor” OnClickListener, and its onClick () method must be specified. Here it simply calls the showTimer () method with a specified number of milliseconds (now hard-coded in the code).

So, what does showTimer () do:

privatevoidshowTimer(intcountdownMillis) {

if(timer != null) { timer.cancel(); }

timer = newCountDownTimer(countdownMillis, MILLIS_PER_SECOND) {

@Override

publicvoidonTick(longmillisUntilFinished) {

countdownDisplay.setText(“counting down: ” +

millisUntilFinished / MILLIS_PER_SECOND);

}

@Override

publicvoidonFinish() {

countdownDisplay.setText(“KABOOM!”);

}

}.start();

}

The class CountDownTimer does almost all the work for us, which is very nice. In the beginning, we check if the timer already exists, and if it is, then we reset it. Next, we create a new timer with a specified number of milliseconds for the countdown (from the parameter of the showTimer () method) and with a specified number of milliseconds between the sample intervals. After the time elapses between the intervals, the onTick () method is called.

CountDownTimer is an abstract class, and the __onTick () and __onFinish () methods must be implemented in its subclass. We override the onTick () method, which reduces the output number by one at the end of each interval, and the onFinish () method, which displays a message about the end of the countdown. Then start () starts the timer.

Using the “Run” command in Eclipse, you can run the created application, and the Android emulator will automatically start. Look at the Android documentation if you want to learn more about setting up the emulator, or launching applications from the command line .

Congratulations, you just created your first Android application. In the second part of this introduction, we will take a closer look at the structure of the Android application, and make some improvements to our program: entering the countdown time, the Stop button and the menu. We will also run it on a real device, not on the emulator.

 

Continue Reading
Advertisement
Click to comment

You must be logged in to post a comment Login

Leave a Reply

Computer Software

20 Computer Essential Software & Tools Free Download

Published

on

By

20 Computer Essential Software & Tools Free Download

20 Computer Essential Software: This is paid tools and we are given you free of cost you download this computer software and tools and use it free it if you have any question then comment in the box, and if you need any computer software you can also comment which tool & software do you need.

these are all software is very usable for computer and you can use this software for learning programs and when you learned this software then you can earn so many dollars from this software,

Download tools just one click all links are direct links.

20 Computer Essential Software:




Camtasia Studio 7.1.1
https://goo.gl/4fBnrx
Camtasia Studio 8.4.3
https://goo.gl/rUopVw
Camtasia 9
https://goo.gl/NUqoD2
Adobe Premiere Pro CS6 6.0.0
https://goo.gl/KOXEUo
Adobe Premiere pro cc 2015
https://goo.gl/gjX183
Adobe After Effect CC 2016
https://goo.gl/Hl1qnU
Sony Vegas pro 13 32 bit/64 bit
https://goo.gl/0pzmPE
4k Downloader
https://goo.gl/k7uJS7
Explaindio Pro 3
https://goo.gl/7HVHsi
IDM 6.25 Life time Registered
https://goo.gl/VgOJnx






Ivona Reader + voices Password: fuh
https://goo.gl/4uIFLS
Sparkol Videoscribe
https://goo.gl/kQzHCJ
Videoscribe Pro v2.3.6
Download: https://goo.gl/gYqpsx
Wondershare Filmore 6.8.0.15 Final + Serials
https://goo.gl/Y8Nwa6
Senuke x latest version
https://goo.gl/gmmsqd
Adobe Illustrator CC Portable 32/64
https://goo.gl/uZymVX
Office 2013 activated 32 bit
https://goo.gl/hjQgUe
Office 2013 activate 64 bit
https://goo.gl/NWSVVC
MS Office 2007 with Product key
https://goo.gl/izzgqz
Unity 5.4 pro with crack or patch
https://goo.gl/rFjbCP
Nitro.Pro.11.0.1.16.x86
https://goo.gl/MW1MQM
Nitro.Pro.11.0.1.16.x64
https://goo.gl/LCcoMD
In page 100% working
https://goo.gl/BK2z5k






nitro pro 9 pdf registered
http://install.nitropdf.com/pro9/en/retail/nitro_pro9.exe

I also learned these software and my earning is 1000$ plus this is the best way to learn and get free computer software,

if you don’t know how to install computer software then type in Youtube “how to install (your software name) on computer or windows (7,8,10) etc”.

if you need any help with computer software or computer programs than comment on your issue I can try to solve your problem. thank you.

 

Continue Reading

Computer Software

Photoshop CC 2017 Free Download With Crack

Published

on

Photoshop CC 2017 Free Download

Photoshop CC 2017 Free Download With Crack

adobe photoshop cc free full version adobe photoshop free download full version, and here is Photoshop CC 2017 Download it easy to download and install free but if you need real then go to photoshop website and install it.
Free Download

Photoshop CC 2017 Free Download With Crack

More Searching:

Photoshop 2017 Free Download With Crack adobe photoshop cc free download adobe photoshop free download adobe photoshop cc free download adobe photoshop cs6
adobe photoshop free download full version for windows 7
adobe photoshop cc 2018
photoshop free download for windows 10
photoshop download free windows 7
Continue Reading

Computer Software

Camtasia Studio 9 for FREE Download & Install 2017! Free Activation For lifetime

Published

on

Download Camtasia Studio 9 free setup for windows.

This Camtasia Studio is an effective media application that enables clients to make

proficient quality recordings with capable screen recording and video altering devices.

Camtasia Studio 9 Overview

Something that made Camtasia Studio well known first and foremost was the way quick and simple it is to make proficient quality recordings with effective screen recording. The Camtasia Studio is completely stacked with most recent video altering and making highlights. With the assistance of this expert device, clients can record PC screen and after that alter those recordings into proficient recordings. This instrument is first decision for making instructive recordings, programming audit, introduction recordings of sites and items and conveying the greatest just in little video. It additionally enables clients to share the made or altered recordings specifically from inside the application to YouTube, Google Drive, and Screencast.

There are numerous new components are included this ninth rendition like Keystroke callouts, Enhanced callouts and Sketch movement callouts and a great deal more. The fundamental video altering and screen recording highlights like zooming, cutting, including title and content for more clarification are very straightforward and simple with this magnificent apparatus. At the season of settling the recorded recordings, clients can take points of interest of the diverse free instruments like numerous move choices, voice portrayal, zoom and dish impacts, cursor impacts, inscriptions and more to make them more expert and alluring.

Components of Camtasia Studio 9

Stacked with most recent screen recording highlights
Appealing and efficient UI
Effective video altering toolbox
Backings all well known video groups
Most recent cursor impacts
New voice portrayal and various moves
Best apparatus for making web based coaching recordings
Framework

Requirements for Camtasia Studio 9

Working Systems (win 7, win 8, win 8.1 and win 10)
Introduced Memory (RAM): 2 GB Recommended For Best Performance
1 GB HDD
Document Name: Camtasia-Studio-9.zip

         Download

How To Install Camtasia Studio 9 and activate? Watch Video

Incoming Searching:
camtasia 9 download
camtasia 9 free download
camtasia 9 crack
camtasia studio 9 crack
camtasia 9 price
camtasia 9 tutorials
camtasia studio 9 32 bit

camtasia 9

Continue Reading
Advertisement

Recent Posts

Trending

%d bloggers like this: