Skip to main content


Showing posts from 2013

Formatting and Styling Text in CSS

Text indention [text-indent]
The property text-indent allows you to add an elegant touch to text paragraphs by applying an indent to the first line of the paragraph. p { text-indent: 10px; } Text alignment [text-align]
The CSS property text-align corresponds to the attribute align used in old versions of HTML. Text can either be aligned to the left, to the right or centred. In addition to this, the value justify will stretch each line so that both the right and left margins are straight. p { text-align: left; } h1{ text-align: right; } h2{ text-align: center; } b { text-align: justify; } Text decoration [text-decoration]
The property text-decoration makes it is possible to add different "decorations" or "effects" to text. Some properties are underline, overline, line-through. h1 { text-decoration: underline; } h2 { text-decoration: overline; } h3 { text-decoration: line-thr…

Transferring user to new web page automatically

<META HTTP-EQUIV="Refresh" CONTENT="2;URL="> Use the code above inside your head tag and your web page will be redirected to "" within 2 seconds.
Change the value of CONTENT="2" to some other integer to decrease or increase the delay of redirection of webpage.If "0" is given the change will be seen immediately.

How to align your TabHost at the bottom of the screen

There is a simplest way to align Tabbar at the bottom of the page.
The code is given below copy and download the code and try it...

In the previous example we learned a simple example to add Tabs to our application.Only a small change can give you tabs at the bottom of the page.

In the previous example the xml was like this...
<TabHost xmlns:android="" xmlns:tools="" android:id="@android:id/tabhost" android:layout_width="fill_parent" android:layout_height="fill_parent" tools:context=".MainActivity" > <LinearLayout android:layout_width="fill_parent" android:layout_height="fill_parent" android:orientation="vertical" > <TabWidget android:id="@android:id/tabs" android:layout_width="fill_parent" a…

How to create a full screen activity in Android

In this tutorial we are going to learn how to create a full screen Activity..
Copy and download the code and try yourself..
import android.os.Bundle; import android.view.Window; import android.view.WindowManager; import; public class FullscreenActivities extends Activity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); //removes the unwanted contents..... requestWindowFeature(Window.FEATURE_NO_TITLE); getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN); //...................... setContentView(R.layout.activity_fullscreen_activities); } 

Change Tabbar Text (title) dynamically in Android - a simple example

Changing title of tabbar is bit easier in android
Copy and download the code below and try it....

Basic tabbar tutorials see here...
import android.os.Bundle; import android.view.View; import android.view.View.OnClickListener; import android.widget.TabHost; import android.widget.TabHost.TabSpec; import android.widget.TabWidget; import android.widget.TextView; import; import android.content.Intent; public class MainActivity extends TabActivity { TabWidget tw; TabHost tabHost; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); /** TabHost will have Tabs */ tabHost = (TabHost)findViewById(; TabSpec firstTabSpec = tabHost.newTabSpec("tab_id1"); TabSpec secondTabSpec = tabHost.newTabSpec("tab_id2"); TabSpec thirdTabSpec = tabHost.newTabSpec("tab_id3"); …

Using TabHost to create a simple Tabbar application - An Android Example

For creating a tabbar application first create a tabhost object to create tabs
In activity_main.xml we create TabHost and specify a layout where we are going to insert the tabs.
Copy and download the code and try it yourself....

Now we are going to create three tabs.
Lets us now first make the xml for it

activity_main.xml :
TabHost provided flexibility of managing data in different views by providing tabbed interface(compared to TabLayout). TabHost basically a container, where you need to put tab widget, which will host tabbed interface and FrameLayout, within which the different views are presented.
TabHost ( main container of tab view ) TabWidget ( used to navigate between tabs ) FrameLayout ( for tab content ) <TabHost xmlns:android="" xmlns:tools="" android:id="@android:id/tabhost" android:layout_width="fill_parent" android:layout_height="…

Using Font in CSS

Font family [font-family]
The property font-family is used to set a prioritized list of fonts to be used to display a given element or web page.
h1 {font-family: arial, verdana, sans-serif;} h2 {font-family: "Times New Roman", serif;} Font style [font-style]
The property font-style defines the chosen font either in normal, italic or oblique.
h2 {font-family: "Times New Roman", serif; font-style: italic;} Font variant [font-variant]
The property font-variant is used to choose between normal or small-caps variants of a font. A small-caps font is a font that uses smaller sized capitalized letters (upper case) instead of lower case letters.
h1 {font-variant: small-caps;} h2 {font-variant: normal;} Font weight [font-weight]
The property font-weight describes how bold or "heavy" a font should be presented. A font can either be normal or bold.
h1 {font-family: arial, verdana, sans-serif; font-weight: bold;} h2 {font-family: …

Taking Random Values in Corona

Syntax for taking random numbers or values in corona has been given below.
Download the code and try it...

        math.random()          math.random( m )          math.random( m, n )
math.random() ---> a number between 0 and 1
math.random(m) ---> an integer between 1 and n (inclusive)
math.random(m,n) ---> an integer between m and n (inclusive)
math.random() ---> a number between 0 and 1 math.random(20) ---> an integer between 1 and 20 (inclusive) math.random(20, 40) ---> an integer between 20 and 40 (inclusive)

Apple gets India in line: Massive queues to buy iPhone 5S and iPhone 5C on the day of launch

"There isn't much I would stand in line for," enthused 24-year-old Chaitanya Chainani from Wadala. After 2 hours of waiting in line, he finally held the iPhone 5S in his hand.
Mumbai's Phoenix Mills in Lower Parel was one of the selected venues of the launch. The event was supposed to start at 5pm. People were queuing up since 8am. Dhanteras was a smart occasion to launch the two new Apple devices.
read more click here.......

String Functions In Corona

Here is a list of string function which are very useful...

string.byte() Returns the internal numerical codes of the characters in a string.string.char()Returns a string in which each character has the internal numerical code equal to its corresponding argument. string.find() Looks for the first match of a pattern in a string. If found, it returns the indices where the occurrence starts and ends; otherwise, returns nil. string.format()Returns a formatted string following the description given in its arguments. string.gmatch()Returns a pattern-finding iterator. string.gsub()Replaces all occurrences of a pattern in a string. string.len()Returns the length of a string (number of characters). string.lower()Changes uppercase characters in a string to lowercase. string.match()Extracts substrings by matching patterns in a string. string.rep()Replicates a string by returning a string that is the concatenation of n copies of a specified string. string.reverse()Reverses a string.string.sub()Ret…

Properties with Colors and Backgrounds in CSS

Foreground color: the 'color' property
The color property describes the foreground color of an element.
Sample code is given below copy and try it out...
h1 { color: #990099; } h3{ color: #999999; } p { color: #990099; } 'background-color' property
The background-color property describes the background color of elements.
Sample code is given below copy and try it out...
h1 { background-color: #990099; } h3{ background-color: #999999; } p { background-color: #990099; } Background images [background-image]
The CSS property background-image is used to insert a background image.
Sample code is given below copy and try it out...
body { background-color: #FFCC66; background-image: url("016.jpg"); } Repeat background image [background-repeat]
This property describes whether background image has to repeat or not,because if given by default it will repeat horizontally.
background-repeat: repeat - image will be repeated both horizon…

Storage Options in Android

Android provides several options for you to save persistent application data. The solution you choose depends on your specific needs, such as whether the data should be private to your application or accessible to other applications (and the user) and how much space your data requires.

Your data storage options are the following:
Shared Preferences
Store private primitive data in key-value pairs.Internal Storage
Store private data on the device memory.External Storage
Store public data on the shared external storage.SQLite Databases
Store structured data in a private database.Network Connection
Store data on the web with your own network server.

Calling an External CSS to HTML document

An external style sheet is simply a text file with the extension .css. Suppose our CSS file is inside the folder named "style" and the CSS file with file name "newstyles.css".The the code to link the html with CSS is given below .. <link rel="stylesheet" type="text/css" href="style/newstyles.css" /> The line of code must be inserted in the header section of the HTML code.

And if you have to give different style to different attribute you can see the sample code below..
Get the sample source code for "test.html" which is connected to an external CSS named "newstyles.css". <html> <head> My sample document </head> <body> My first stylish headerMy second stylish header My paragraph </body> </html> Get the sample source code for "newstyles.css". body { background-color: #00FF00; } h1 { color: #990099; background-color: #FC9804; …

Applying CSS to an HTML document - 3 Methods

There are three ways you can apply CSS to an HTML document.

In-line (the attribute style)

One way to apply CSS to HTML is by using the HTML attribute style.
<html> <head> Sample </head> <body style="background-color: #00FF00;"> The background color is green </body> </html> Internal (the tag style)

Another way is to include the CSS codes using the HTML tag <style>.
<html> <head> <title>Example</title> <style type="text/css"> body {background-color: #00FF00;} </style> </head> <body> <p>The background color is green </p> </body> </html> External (link to a style sheet)

The last method is to link to an external CSS file.An external style sheet is simply a text file with the extension .css. Suppose our CSS file is inside the folder named "style" and the CSS file with file name "newstyles.css&…

Basic CSS Syntax

selector { property: value; }

selector : Says what HTML tag does property apply to
property : Says about the property or functionality applied
value : Set property attributes

eg :
body {background-color: #00FF00;}

Introduction - Cascading Style Sheets - CSS

Cascading Style Sheets (CSS) is a fantastic tool to add layout to your websites. It can save you a lot of time and it enables you to design websites in a completely new way. CSS is a must for anyone working with web design.

CSS is a style language that defines layout of HTML documents. For example, CSS covers fonts, colours, margins, lines, height, width, background images, advanced positions and many other things.CSS is supported by all browsers today.

The main difference between HTML and CSS is that - HTML is used to structure content. CSS is used for formatting structured content.

CSS was a revolution in the world of web design. The benefits of CSS include:
control layout of many documents from one single style sheet;more precise control of layout;apply different layout to different media-types (screen, print, etc.);numerous advanced and sophisticated techniques.

Read A Text File in Corona

Reading a text file in corona is very eazy.First get the file path and using the file path read the content in the file. Check the code below.
display.setStatusBar( display.HiddenStatusBar ) -- read the file path local filePath = system.pathForFile( "myFile.txt", system.ResourceDirectory ) local file = filePath, "r" ) if file then -- read all contents of file into a string local contents = file:read( "*a" ) print( "The file path is" .. filePath ) print( contents ) io.close( file ) end
Copy and download the code and try your self.

Corona - Display Groups

local Group1 = display.newGroup() This creates a new display group by the name of Group1. You can then add display objects to it.You should declare them near the top of your Lua document.You should create display groups in a specific order. The first declared group will actually reside behind the next group in visually layered order. local farBackground = display.newGroup() local nearBackground = display.newGroup() --this will overlay 'farBackground' local foreground = display.newGroup() --and this will overlay 'nearBackground'

Special Effects in HTML - Marquee

If you want your text to move with in the screen, use the tag  <marquee>. The text in between the tags will move horizontally.

<marquee bgcolor=pink> will give background color to marquee texts.
<marquee bgcolor=orange width=100 height=20> will set height and width for marquee text.
<marquee bgcolor="orange" direction="right" height="20" width="100"> will setdirection to marquee text. <html> <body> This is a scrolling text This is a scrolling text with background color This is a scrolling text This is a scrolling textThis is a scrolling text </body> </html>
Copy and download the code and try your self.

What is the difference between Services, Thread and an AsyncTask in Android?

Thread Example n ANDROID -- Timer Thread Example
Non Runnable States in Multithreading - Different states while thread is in runnable states
What is a thread in java ?
How to write interfaces in java or Android?
More on Android ?

Service is like an Activity but has no interface. Probably if you want to fetch the weather for example you won’t create a blank activity for it, for this you will use a Service.

A Thread is a Thread, probably you already know it from other part. You need to know that you cannot update UI from a Thread. You need to use a Handler for this, but read further.
An AsyncTask is an intelligent Thread that is advised to be used. Intelligent as it can help with it’s methods, and there are two methods that run on UI thread, which is good to update UI components.

Using Html Styles And Colors

Using html Styles and Colors :
This post will help you to understand the use of div element and using styles and color elements perfectly.
Copy the code and try... <html> <body> HTML STYLES AND COLORS Text with space Spannable Text </body> </html>

Android using Bundle for sharing variables

Sharing variables between Activities is quite important point during development time of your Application. This  Example suppose Activity1 from where you run up other Activity2 .  
We gonna share variable myValue.

In Activity1 : myValue="string values"; Intent intent = new Intent(MainActivity.this,NewClass.class); Bundle bundle = new Bundle(); bundle.putString("myValue", myValue); intent.putExtras(bundle); startActivity(intent); or

Intent intent = new Intent(MainActivity.this,NewClass.class); intent.putExtra("myValue",AnyValue); startActivity(intent);
In Activity2 :
Bundle bundle = getIntent().getExtras(); String value= bundle.getString(“myValue“); or

Intent intent=getIntent(); Bundle bundle=intent.getExtras(); String value= bundle.getString(“myValue“);

Android Emulator Shortcuts

Emulated Device KeyKeyboard KeyHomeHOMEMenu (left softkey)F2 or Page-up buttonStar (right softkey)Shift-F2 or Page DownBackESCCall/dial buttonF3Hangup/end call buttonF4SearchF5Power buttonF7Audio volume up buttonKEYPAD_PLUS, Ctrl-F5Audio volume down buttonKEYPAD_MINUS, Ctrl-F6Camera buttonCtrl-KEYPAD_5, Ctrl-F3Switch to previous layout orientation (for example, portrait, landscape)KEYPAD_7, Ctrl-F11Switch to next layout orientation (for example, portrait, landscape)KEYPAD_9, Ctrl-F12Toggle cell networking on/offF8Toggle code profilingF9 (only with -trace startup option)Toggle fullscreen modeAlt-EnterToggle trackball modeF6Enter trackball mode temporarily (while key is pressed)DeleteDPad left/up/right/downKEYPAD_4/8/6/2DPad center clickKEYPAD_5Onion alpha increase/decreaseKEYPAD_MULTIPLY(*) / KEYPAD_DIVIDE(/)

Android JellyBean new features

# WI-Fi Direct
# 1080p video recording for stock Android devices
# Improved error correction on the keyboard
# You can directly access the apps from the lock screen
# Upgraded copy and paste functionality
# Support for the WebP image format
# Hardware acceleration of the universal Interface
# Soft buttons from Android 3.x are now available for use on phones
# Widgets in a new tab can be separated, listed in a similar manner to apps
# Folders can easily be created with a drag-and-drop style
# Launcher Customizer
# Enhanced visual voicemail with the ability to speed up or slow down voicemail messages
# Pinch-to-zoom functionality in the calendar
# Integrated screenshot capture (accomplished by holding down the Power and Volume-Down buttons)
# Improved voice integration and continuous, real-time speech to text dictation
# Face Unlock, a feature that allows users to unlock handsets using facial recognitionsoftware
# New tabbed web browser under Google’s Chrome brand, allowing up to 16 tabs
# Automatic sy…

Tables In Corona

The table constructor is written using braces
(curly brackets) as in { }
t = {} -->create a table k = "x" t[k] = "tabvalue" --new table entry, -->with key="x" and value=2.4 print( t[k] ) --> 2.4 print( t["x"] ) --> 2.4 print( t.x ) --> 2.4 t[2] = "tabval2" --new table entry, -->with key=2 and value="tabval2" t[3]= 2.4 print( t[2] ) --> "tabval2" print( t[3] )

Load html file to WebView from assets in Android

Put the html file inside asset folder and
use the code given below :
public class MainActivity extends Activity { WebView myWebView; TextView tv; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); myWebView=(WebView) findViewById(; myWebView.loadUrl("file:///android_asset/Noun.htm"); }
Copy and download the code and try your self.

HTML Tag - Scripting

This tag is used to define a client-side script, such as a javascript.
This tag is used to define an alternate content for users that have disabled scripts in their browser or have a browser that doesn't support script.The <noscript> can be used in both <head> and <body>.

HTML Tag - Forms

This tag is used to create a HTML form for user input.
This tag specifies an input field where the user can enter data.
This tag defines a multi-line input control.
This tag is used to create a drop-down list.
This tag defines a option in a select list.
This tag is used to group related options in a drop-down list.

This tag defines a clickable button.

This tag defines a label for an input element.

This tag is used to group related elements in a form.

This tag defines a caption foe the <fieldset> element.
<html> <body> First name:
Last name:

Fill these details and submit it it.....!!!!!!!!!!!
Personal Details: User Name:
Date of birth:
ABCPQRXYZSRTSubmit it! </body> </html>

HTML Tag - Tables

This defines the HTML table.This tag has elements like <tr>,<th>,<td>.
This defines a row in the HTML table.
This defines a cell in the HTML table.
This tag is used to group the body content in a HTML table.
This tag is used to group header in an HTML table
This tag is used to group footer content in an HTML table.
This tag specifies properties for each column within a <colgroup> element.
This tag specifies a group of one or more columns in a table for formatting
This tag defines a table caption.
<html> <body> 12Sum$180DayEventsMondayconferenceWednesdaymeeting </body> </html>

HTML Tag - Lists

This defines the unordered list.
This defines the ordered list.
This defines the lst items.
This defines the description list.
This defines the name or item in description list.
This defines a term or name in a description list.
<html> <head> <body> angelmarkcodingpalygroundangelmarkcodingpalygroundAndroideasy to learnhtmlhyper textmarkup language </body> </head> </html>

HTML Tag - Images and Objects

This defines an image in a HTML page.They require attributes:src and alt.
This defines an area inside an image-map.Image-map is an image with clickable areas.This is always nested inside a <map> tag.
This is used to define a client-side image-map.
This is used to define a parameters for plugins embedded with an 
<object> element.
This is used to define an embedded object within an HTML document.Use this element to embed multimedia (like audio,video,pdf etc..)in your web pages. <html> <body> </body> </html>

HTML Tags - Links

This defines a hyperlink,which is used to link from one page to another.The most important attribute of the <a>element is the href attribute,which indicates the link's destination.

The <base> tag specifies the base URL/target for all relative URLs in a document.

<html> <head> <body> Visit angel mark for more codes </body> </head> </html> <html> <head> <base href="" > </head> <body> blog </body> </html>

HTML Tags - Text

This defines a paragraph.
These are used to define html headings.<h1> defines the most important heading and <h6> defines the least important heading.
This defines the most important text.
This defines a emphasized text or italic text.
This defines an abbreviation or an acronym.
This defines an acronym.
This defines the contact information of the document.Mostly they produce italic text with line breaks.
This means bi-directional override.It is used to override the current text direction.
This defines a section that is quoted from another source.
This defines the title of a work.
This defines a short quotation.
This is a phrase tag which defines a piece of computer code.
This tag defines a text that has been inserted into a document.
This is a phrase tag which defines a definition term.
This tag …

HTML Tag - Meta Information

This is the first thing to be included in a html document,before <html> tag.Actually, this is not a html tag,it is simply given to expain to the web browser which version of html is being used.

This defines the relationship between a document and an external resource.Mostly used to link with style sheets.

This tag is required in all html documents and it defines the title of the document.
The <title> element:defines a title in the browser toolbarprovides a title for the page when it is added to favorites displays a title for the page in search-engine results <style>
This tag is used to define style information for a html document.

It is a data about data.This will not be displayed on the page.
Mainly used to specify page description,keywords,author of the document,last modified, nd other metadata.

HTM Tag - Structure

The <html> tag tells the browser that this is an HTML document.It represents the root of an HTML document.This tag is the container for all other HTML elements.

The <head> tag is a container for all the head elements.The <head> element must include a title for the document, and can include scripts, styles, meta information, and more.

The <body> tag defines the document's body.The <body> element contains all the contents of an HTML document, such as text, hyperlinks, images, tables, lists, etc.

The <div> tag defines a division or a section in an HTML document.The <div> tag is used to group block-elements to format them with CSS.

The <span> tag is used to group inline-elements in a document.They provides a way to add a hook to a part of a text or a part of a document. <html> <hea…

HTML Basics

HTML (Hypertext Markup Language) is the set ofmarkupsymbols or codes inserted in a file intended for display on a World Wide Webbrowserpage. The markup tells the Web browser how to display a Web page's words and images for the user. Each individual markup code is referred to as an element or called a tag . Some simple things to remember The text between <html> and </html> describes the web pageThe text between <body> and </body> is the visible page content

HTML is a language for describing web pages.HTML stands for Hyper Text Markup LanguageHTML is a markup languageA markup language is a set of markup tagsThe tags describe document content HTML documents contain HTML tags and plain textHTML documents are also called web pages

HTML markup tags are usually called HTML tagsHTML tags are keywords (tag names) surrounded by angle brackets like <html>HTML tags normally come in pairs like <b> and </b>The first tag in a pair is the start tag, th…

Function in Corona

Using functions are very eazy in Lua.We can provide arguments as input (within the parentheses), the function performs some tasks, and the results can be returned.
Some ways to define functions are:
local function f () --body end local f = function() --body end function f () --body end f = function () --body end