Skip to main content

Posts

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: l

Transferring user to new web page automatically

<META HTTP-EQUIV="Refresh" CONTENT="2;URL=http://eazyprogramming.blogspot.in/"> Use the code above inside your head tag and your web page will be redirected to "http://eazyprogramming.blogspot.in/" 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="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/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"

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 android.app.Activity; 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 android.app.TabActivity; 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(android.R.id.tabhost); 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="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:id="@android:id/tabhost" android:layout_width="fill_parent" android:l

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;}

Taking Random Values in Corona

Syntax for taking random numbers or values in corona has been given below. Download the code and try it... Syntax         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 strin

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 repea

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 header My second stylish header My paragraph </body> </html> Get the sample source code for "newstyles.css". body { background-color: #00FF00; } h1 { color: #990099; backgro

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 "

Basic CSS Syntax

selector { property: value; } Here, 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 = io.open( 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 set   direction 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 text This 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 Key Keyboard Key Home HOME Menu (left softkey) F2  or  Page-up button Star (right softkey) Shift-F2  or  Page Down Back ESC Call/dial button F3 Hangup/end call button F4 Search F5 Power button F7 Audio volume up button KEYPAD_PLUS, Ctrl-F5 Audio volume down button KEYPAD_MINUS, Ctrl-F6 Camera button Ctrl-KEYPAD_5, Ctrl-F3 Switch to previous layout orientation (for example, portrait, landscape) KEYPAD_7, Ctrl-F11 Switch to next layout orientation (for example, portrait, landscape) KEYPAD_9, Ctrl-F12 Toggle cell networking on/off F8 Toggle code profiling F9 (only with  -trace  startup option) Toggle fullscreen mode Alt-Enter Toggle trackball mode F6 Enter trackball mode temporarily (while key is pressed) Delete DPad left/up/right/down KEYPAD_4/8/6/2 DPad center click KEYPAD_5 Onion alpha increase/decrease KEYPAD_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 tab

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(R.id.webView1); myWebView.loadUrl("file:///android_asset/Noun.htm"); } Copy and download the code and try your self.

HTML Tag - Scripting

<script> This tag is used to define a client-side script, such as a javascript. <noscript> 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

<form> This tag is used to create a HTML form for user input. <input> This tag specifies an input field where the user can enter data. <textarea> This tag defines a multi-line input control. <select> This tag is used to create a drop-down list. <option> This tag defines a option in a select list. <optgroup> This tag is used to group related options in a drop-down list. <button> This tag defines a clickable button. <label> This tag defines a label for an input element. <fieldset> This tag is used to group related elements in a form. <legend> This tag defines a caption foe the <fieldset> element. <html> <body> First name: Last name: Male Fill these details and submit it it.....!!!!!!!!!!! Personal Details: User Name: Email: Date of birth: ABC PQR XYZ SRT Submit it! </body> </html>

HTML Tag - Tables

<table> This defines the HTML table.This tag has elements like <tr>,<th>,<td>. <tr> This defines a row in the HTML table. <td> This defines a cell in the HTML table. <tbody> This tag is used to group the body content in a HTML table. <thead> This tag is used to group header in an HTML table <tfoot> This tag is used to group footer content in an HTML table. <col> This tag specifies properties for each column within a <colgroup> element. <colgroup> This tag specifies a group of one or more columns in a table for formatting <caption> This tag defines a table caption. <html> <body> 1 2 Sum $180 Day Events Monday conference Wednesday meeting </body> </html>

HTML Tag - Lists

<ul> This defines the unordered list. <ol> This defines the ordered list. <li> This defines the lst items. <dl> This defines the description list. <dt> This defines the name or item in description list. <dd> This defines a term or name in a description list. <html> <head> <body> angel mark coding palyground angel mark coding palyground Android easy to learn html hyper textmarkup language </body> </head> </html>

HTML Tag - Images and Objects

<img> This defines an image in a HTML page.They require attributes:src and alt. <area> This defines an area inside an image-map.Image-map is an image with clickable areas.This is always nested inside a <map> tag. <map> This is used to define a client-side image-map. <param> This is used to define a parameters for plugins embedded with an  <object> element. <object> 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

<a> 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. <base> 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="http://eazyprogramming.blogspot.in/" > </head> <body> blog </body> </html>

HTML Tags - Text

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

HTML Tag - Meta Information

<!DOCTYPE> 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. <link> This defines the relationship between a document and an external resource.Mostly used to link with style sheets. <title> 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 toolbar provides 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. <metadata> 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

<html>.....</html> 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. <head>.....</head> 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. <body>.....</body> 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. <div>.....</div> 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. <span>.....</span> 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&

HTML Basics

HTML (Hypertext Markup Language) is the set of   markup   symbols or codes inserted in a file intended for display on a World Wide Web   browser   page. 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 page The text between <body> and </body> is the visible page content HTML is a language for describing web pages. HTML stands for H yper T ext M arkup L anguage HTML is a markup language A markup language is a set of markup tags The tags describe document content HTML documents contain HTML tags and plain text HTML documents are also called web pages HTML markup tags are usually called HTML tags HTML tags are keywords (tag names) surrounded by angle brackets like <html> HTML tags normally come in pairs like <b> and </b

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

Types and Values In Corona

Lua is a dynamically typed language. This means that variables do not have types; only values do. There are no type definitions in the language. All values carry their own type. All values in Lua are first-class values. This means that all values can be stored in variables, passed as arguments to other functions, and returned as results. nil   — it usually represents the absence of a useful value. boolean   — represents two conditions 'false' or 'true' number   — represents real (double-precision floating-point) numbers. string   — represents arrays of characters. Lua is 8-bit clean: strings can contain any 8-bit character,   including embedded zeros. function   — click here to get more details table   — the sole data structuring mechanism in Lua.