tag:blogger.com,1999:blog-37296598495368220472024-02-19T17:50:52.180+05:30Aish WithOut Cash Unknownnoreply@blogger.comBlogger84125tag:blogger.com,1999:blog-3729659849536822047.post-18550067102208915512015-08-02T23:34:00.000+05:302015-08-03T09:42:27.093+05:30Windows 10 for 32 Bit and 64 Bit Free Download<div dir="ltr" style="text-align: left;" trbidi="on">
<span style="color: #333333; font-family: Lato, serif;"><span style="line-height: 25px;"><b>Specifications of Windows 10</b></span></span><br />
<span style="color: #333333; font-family: Lato, serif;"><span style="line-height: 25px;"><br /></span></span>
<span style="color: #333333; font-family: Lato, serif;"><span style="line-height: 25px;">Windows 10 is available in 32 bit and 64 bit versions with multi language.</span></span><br />
<span style="color: #333333; font-family: Lato, serif;"><span style="line-height: 25px;">You can install it offline Installer and it is Full Standalone Setup:</span></span><br />
<div>
<br /></div>
<div>
<br /></div>
<div>
<span style="font-size: large;"><b>Its Totally Free</b> </span><br />
<span style="font-size: large;"><br /></span>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgjFyr10KVWA8ZpdmrGDYzbMzKvjIznasRCRJM8vk9xbIuPmgbMZ2Zro4NbafDSU6yJlNHdKmXdaFEDIi3aSdXXyIeFgWloYIS5k88_JIT5bvp5YeHeXLjW8eV7X4CMm5XsZY583cnEsss/s1600/windows+10.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="240" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgjFyr10KVWA8ZpdmrGDYzbMzKvjIznasRCRJM8vk9xbIuPmgbMZ2Zro4NbafDSU6yJlNHdKmXdaFEDIi3aSdXXyIeFgWloYIS5k88_JIT5bvp5YeHeXLjW8eV7X4CMm5XsZY583cnEsss/s320/windows+10.png" width="320" /></a></div>
<span style="font-size: large;"><br /></span></div>
<div>
<br /></div>
<div>
<br /></div>
<div>
<b>Requirements for Windows 10</b></div>
<div>
<br /></div>
<div>
1 GHz Processor Speed.</div>
<div>
<br /></div>
<div>
1GB RAM (Memory) for 32 Bit and 2GB for 64 Bit OS. </div>
<div>
<br /></div>
<div>
16 GB Free Hard Disk </div>
<div>
<br /></div>
<div>
<br /></div>
<div>
<b>Download Windows 10 for 32 Bit and 64 Bit:</b></div>
<div>
<b><br /></b></div>
<a href="http://go.microsoft.com/fwlink/?LinkId=616935" target="_blank">Click Here to download the 32 bit version</a><br />
<div>
<br />
<a href="http://go.microsoft.com/fwlink/?LinkId=616936" target="_blank">Click Here to Download the 64 bit version</a><br />
<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh18fohBXuU0OoY_Wbt1qCx-BvLA8VbuPyoYQf68I6HwNCVvjj57Q67qEvQzJSi189DNYJBhUpuj4OSTBcbXmpg-vqP8uSBMdhLn2fH_Ih_iMy_OEL9_qdV6Pthm0nXnxdCORbC7pdsWgA/s1600/windows+10+with+start+button.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="240" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh18fohBXuU0OoY_Wbt1qCx-BvLA8VbuPyoYQf68I6HwNCVvjj57Q67qEvQzJSi189DNYJBhUpuj4OSTBcbXmpg-vqP8uSBMdhLn2fH_Ih_iMy_OEL9_qdV6Pthm0nXnxdCORbC7pdsWgA/s320/windows+10+with+start+button.png" width="320" /></a></div>
<br /></div>
</div>
Unknownnoreply@blogger.comtag:blogger.com,1999:blog-3729659849536822047.post-21893544220382186272014-12-09T16:38:00.001+05:302014-12-09T16:38:51.521+05:30Watch and Download Action Jackson Movie<div dir="ltr" style="text-align: left;" trbidi="on">
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgl02LMjuLLL-8SkWSA5VLL5zWe2F-SpOBu6SqMqlWTWqZSbsqiiLtZLd98c9He9M8oBNaDcpoigAtXUnyrZpP5c9bd1OeZEdFPO5eq3Zs2vcPv7ffBwJpEo1f7kpjILz8i1KlLwICR-9Sq/s1600/9JkzLkS.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgl02LMjuLLL-8SkWSA5VLL5zWe2F-SpOBu6SqMqlWTWqZSbsqiiLtZLd98c9He9M8oBNaDcpoigAtXUnyrZpP5c9bd1OeZEdFPO5eq3Zs2vcPv7ffBwJpEo1f7kpjILz8i1KlLwICR-9Sq/s400/9JkzLkS.jpg" /></a></div>
<div style="text-align: center;">
<b style="background-color: #fafafa; font-family: Verdana, Arial, Tahoma, Calibri, Geneva, sans-serif; font-size: 13px;"><span style="color: blue;"><br /></span></b>
<b style="background-color: #fafafa; font-family: Verdana, Arial, Tahoma, Calibri, Geneva, sans-serif; font-size: 13px;"><span style="color: blue;"><br /></span></b>
<b style="background-color: #fafafa; font-family: Verdana, Arial, Tahoma, Calibri, Geneva, sans-serif; font-size: 13px;"><span style="color: blue;">Watch Online - DailyMotion</span></b></div>
<a href="http://tvmaza.es/daily.php?file=x2bt666" style="background-color: #fafafa; color: #417394; font-family: Verdana, Arial, Tahoma, Calibri, Geneva, sans-serif; font-size: 13px; text-align: center; text-decoration: none;" target="_blank">Action Jackson (2014) Watch Online Dvd Scr Rip - Part 1</a><br />
<a href="http://tvmaza.es/daily.php?file=x2bt67i" style="background-color: #fafafa; color: #417394; font-family: Verdana, Arial, Tahoma, Calibri, Geneva, sans-serif; font-size: 13px; text-align: center; text-decoration: none;" target="_blank">Action Jackson (2014) Watch Online Dvd Scr Rip - Part 2</a><br />
<a href="http://tvmaza.es/daily.php?file=x2bt68m" style="background-color: #fafafa; color: #417394; font-family: Verdana, Arial, Tahoma, Calibri, Geneva, sans-serif; font-size: 13px; text-align: center; text-decoration: none;" target="_blank">Action Jackson (2014) Watch Online Dvd Scr Rip - Part 3</a><br />
<br style="background-color: #fafafa; color: #333333; font-family: Verdana, Arial, Tahoma, Calibri, Geneva, sans-serif; font-size: 13px; text-align: center;" />
<b style="background-color: #fafafa; font-family: Verdana, Arial, Tahoma, Calibri, Geneva, sans-serif; font-size: 13px; text-align: center;"><span style="color: blue;">Watch Online - Cloudy</span></b><br />
<a href="http://desitvs.com/cl.php?file=e4e5584703984" style="background-color: #fafafa; color: #417394; font-family: Verdana, Arial, Tahoma, Calibri, Geneva, sans-serif; font-size: 13px; text-align: center; text-decoration: none;" target="_blank">Action Jackson (2014) Watch Online Dvd Scr Rip - Part 1</a><br />
<a href="http://desitvs.com/cl.php?file=985a5220fcb4b" style="background-color: #fafafa; color: #417394; font-family: Verdana, Arial, Tahoma, Calibri, Geneva, sans-serif; font-size: 13px; text-align: center; text-decoration: none;" target="_blank">Action Jackson (2014) Watch Online Dvd Scr Rip - Part 2</a><br />
<a href="http://desitvs.com/cl.php?file=15c7b7287c7db" style="background-color: #fafafa; color: #417394; font-family: Verdana, Arial, Tahoma, Calibri, Geneva, sans-serif; font-size: 13px; text-align: center; text-decoration: none;" target="_blank">Action Jackson (2014) Watch Online Dvd Scr Rip - Part 3</a><br />
<br style="background-color: #fafafa; color: #333333; font-family: Verdana, Arial, Tahoma, Calibri, Geneva, sans-serif; font-size: 13px; text-align: center;" />
<b style="background-color: #fafafa; font-family: Verdana, Arial, Tahoma, Calibri, Geneva, sans-serif; font-size: 13px; text-align: center;"><span style="color: blue;">Watch Online - Videohut</span></b><br />
<a href="http://desitvs.com/hut.php?file=147c60c3414d4" style="background-color: #fafafa; color: #417394; font-family: Verdana, Arial, Tahoma, Calibri, Geneva, sans-serif; font-size: 13px; text-align: center; text-decoration: none;" target="_blank">Action Jackson (2014) Watch Online Dvd Scr Rip - Part 1</a><br />
<a href="http://desitvs.com/hut.php?file=04ff08f66867d" style="background-color: #fafafa; color: #417394; font-family: Verdana, Arial, Tahoma, Calibri, Geneva, sans-serif; font-size: 13px; text-align: center; text-decoration: none;" target="_blank">Action Jackson (2014) Watch Online Dvd Scr Rip - Part 2</a><br />
<a href="http://desitvs.com/hut.php?file=eed13227051ea" style="background-color: #fafafa; color: #417394; font-family: Verdana, Arial, Tahoma, Calibri, Geneva, sans-serif; font-size: 13px; text-align: center; text-decoration: none;" target="_blank">Action Jackson (2014) Watch Online Dvd Scr Rip - Part 3</a><br />
<br />
<span style="color: blue;"><b><u>Download Links :-</u></b></span><br />
<br />
http://hostingbulk.com/bmmsk7f5ikh3.html or http://www.multiup.org/download/d2e3d1f3e915c376b0e3876be19d3b7f/AJ.vob or http://www.nowdownload.ch/dl/16eb4da549f27</div>
Unknownnoreply@blogger.comtag:blogger.com,1999:blog-3729659849536822047.post-61316689936235637212014-12-03T09:42:00.000+05:302014-12-03T09:43:39.757+05:30Proper Patola(2014) part 1<iframe frameborder="0" width="480" height="270" src="//www.dailymotion.com/embed/video/k680n3MunoxfdX9tvD3" allowfullscreen></iframe><br /><a href="" target="_blank">Proper Patola(2014)</a> Unknownnoreply@blogger.comtag:blogger.com,1999:blog-3729659849536822047.post-28044121558186408762014-12-03T09:28:00.002+05:302014-12-03T09:30:58.374+05:30Tips for Using UI-Router<div dir="ltr" style="text-align: left;" trbidi="on">
<h2 id="linking-to-states
" style="background-color: white; box-sizing: border-box; color: #3e3f3a; font-family: 'Proxima Nova'; font-size: 32px; line-height: 1.1; margin-bottom: 30px; margin-top: 0px; position: relative;">
Linking To States</h2>
<div>
<br /></div>
<div>
<div>
Angular provides the</div>
<div>
<br /></div>
<div>
ngHref directive which allows us to bind variables to URLs. UI-Router provides us with ui-sref which allows us to link to states. This is different than linking to a normal URL. When using UI-Router you want to link to a state, not a URL.</div>
<div>
<br /></div>
<div>
<br /></div>
<div>
Examples:- </div>
<div>
Let’s say we have a state like so:<br />
<br />
<br />
$stateProvider<br />
<br />
.when('party', {<br />
url: '/party',<br />
template: '<h1>This Is A State</h1>'<br />
});<br />
<br />
Now to link to it in one of our views:<br />
<a ui-sref="party">Go To Party</a><br />
This will turn into<br />
<a href="/party" ui-sref="party">Go To Party</a> in our browser. Notice how the href is generated for us.</div>
<div>
<code class=" language-javascript" style="background-color: transparent; border-bottom-left-radius: 0px; border-bottom-right-radius: 0px; border-top-left-radius: 0px; border-top-right-radius: 0px; box-sizing: border-box; direction: ltr; font-family: Consolas, Monaco, 'Andale Mono', monospace; font-size: inherit; padding: 0px; tab-size: 4; text-shadow: rgba(0, 0, 0, 0.298039) 0px 1px; word-break: normal; word-spacing: normal;"><span class="token punctuation" style="box-sizing: border-box;">
</span></code></div>
</div>
</div>
Unknownnoreply@blogger.comtag:blogger.com,1999:blog-3729659849536822047.post-29681961561026914372014-12-01T14:36:00.000+05:302014-12-01T14:36:17.542+05:30Why Java is Secure and Portable ?<div dir="ltr" style="text-align: left;" trbidi="on">
<div style="background-color: white; color: #222222; font-family: 'Droid Serif'; font-size: 22px; line-height: 30.799999237060547px;">
<div>
The answer is</div>
<b><span style="color: purple; font-size: 28px;">BYTECODE.!</span></b></div>
<br style="background-color: white; color: #222222; font-family: 'Droid Serif'; font-size: 22px; line-height: 30.799999237060547px;" />
<div style="background-color: white; color: #222222; font-family: 'Droid Serif'; font-size: 22px; line-height: 30.799999237060547px;">
Bytecode it the key that makes Java language most secure and Portable.</div>
<br style="background-color: white; color: #222222; font-family: 'Droid Serif'; font-size: 22px; line-height: 30.799999237060547px;" />
<div style="background-color: white; color: #222222; font-family: 'Droid Serif'; font-size: 22px; line-height: 30.799999237060547px;">
When you compile your java program then on successful compilation , java compiler (javac) generates a class file with .class extension which contains the Bytecodes of your java program. Now the Bytecodes which are generated are secure and they can be run on any machine (portable) which has JVM.</div>
<br style="background-color: white; color: #222222; font-family: 'Droid Serif'; font-size: 22px; line-height: 30.799999237060547px;" /></div>
Unknownnoreply@blogger.comtag:blogger.com,1999:blog-3729659849536822047.post-7831459830338457032014-12-01T14:34:00.001+05:302014-12-01T14:34:33.836+05:30Progress Bar Tutorial in Android<div dir="ltr" style="text-align: left;" trbidi="on">
<div class="MsoNormal" style="background-color: white; color: #222222; font-family: 'Droid Serif'; font-size: 22px; line-height: 30.799999237060547px;">
<span style="font-family: 'Times New Roman', serif; font-size: 16pt; line-height: 24.533334732055664px;">In this tutorial I am using my previous project (you can see the <a href="http://javalanguageprogramming.blogspot.in/2014/09/fetch-data-from-website-using-jsoup-in.html" style="color: #1850da; text-decoration: none;" target="_blank">post here</a>) in which I fetched the data from my blog using <b>JSOUP library</b>. In this project, I made a <b>progress dialog</b> till the network operation occur.<o:p></o:p></span></div>
<div class="MsoNormal" style="background-color: white; color: #222222; font-family: 'Droid Serif'; font-size: 22px; line-height: 30.799999237060547px;">
<br /><div class="MsoNormal" style="color: black; font-family: 'Times New Roman'; font-size: medium; line-height: normal;">
<div style="margin: 0px;">
<span style="font-family: 'Times New Roman', serif; font-size: 16pt; line-height: 24.53333282470703px;">In progress dialog there is a dialog with the message and a spinner which revolves till the network operation or any background task.</span></div>
<div style="margin: 0px;">
<span style="font-family: 'Times New Roman', serif; font-size: 16pt; line-height: 24.53333282470703px;"><br /></span></div>
<div style="margin: 0px;">
<span style="font-family: 'Times New Roman', serif; font-size: 16pt; line-height: 24.53333282470703px;"><br /></span></div>
<div style="margin: 0px;">
<div class="MsoNormal" style="color: #222222; font-family: 'Droid Serif'; font-size: 22px; line-height: 30.799999237060547px;">
<span style="font-family: 'Times New Roman', serif; font-size: 16pt; line-height: 24.533334732055664px;">During the data is fetched in the background, progress dialog is used to give the user a better interaction in the android application.<o:p></o:p></span></div>
<div class="MsoNormal" style="color: #222222; font-family: 'Droid Serif'; font-size: 22px; line-height: 30.799999237060547px;">
<br /></div>
<div class="MsoNormal" style="color: #222222; font-family: 'Droid Serif'; font-size: 22px; line-height: 30.799999237060547px;">
<span style="font-family: 'Times New Roman', serif; font-size: 16pt; line-height: 24.533334732055664px;">Create new project in Eclipse : <b>File</b> => <b>New</b> => <b>Android Application Project</b> and give any package name.<o:p></o:p></span></div>
<div class="MsoNormal" style="color: #222222; font-family: 'Droid Serif'; font-size: 22px; line-height: 30.799999237060547px;">
<span style="font-family: 'Times New Roman', serif; font-size: 16pt; line-height: 24.533334732055664px;"><br /></span></div>
<div class="MsoNormal" style="color: #222222; font-family: 'Droid Serif'; font-size: 22px; line-height: 30.799999237060547px;">
<span style="font-family: 'Times New Roman', serif; font-size: 16pt; line-height: 24.533334732055664px;">Code for <b>activity_main.xml</b> is same as previous tutorial and is shown below :<o:p></o:p></span></div>
<div class="MsoNormal" style="color: #222222; font-family: 'Droid Serif'; font-size: 22px; line-height: 30.799999237060547px;">
<span style="font-family: 'Times New Roman', serif; font-size: 16pt; line-height: 24.533334732055664px;"><br /></span></div>
<pre style="background: rgb(240, 240, 240); border: 1px dashed rgb(204, 204, 204); font-family: arial; font-size: 15px; height: auto; line-height: 20px; overflow: auto; padding: 0px; width: 564.296875px;"><code style="word-wrap: normal;"> <LinearLayout xmlns: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"
android:orientation="vertical"
>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal"
>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="TITLE :"
android:textSize="20sp"
android:textStyle="bold"
android:layout_marginLeft="15px"
android:layout_marginTop="10px"
/>
<TextView
android:id="@+id/titleText"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="18sp"
android:layout_marginLeft="15px"
android:layout_marginTop="10px"
/>
</LinearLayout>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="POSTS TITLE :"
android:textSize="20sp"
android:textStyle="bold"
android:layout_marginLeft="15px"
android:layout_marginTop="10px"
/>
<TextView
android:id="@+id/postsText"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="15sp"
android:layout_marginLeft="15px"
android:layout_marginTop="10px"
/>
</LinearLayout>
</code></pre>
<div class="MsoNormal" style="color: #222222; font-family: 'Droid Serif'; font-size: 22px; line-height: 30.799999237060547px;">
<span style="font-family: 'Times New Roman', serif; font-size: 16pt; line-height: 24.533334732055664px;"><br /></span><br /><div class="MsoNormal">
<span style="font-family: 'Times New Roman', serif; font-size: 16pt; line-height: 24.533334732055664px;">Now code for</span><span style="font-family: 'Times New Roman', serif; font-size: 16pt; line-height: 24.533334732055664px;"> </span><b style="font-family: 'Times New Roman', serif; font-size: 16pt; line-height: 24.533334732055664px;">MainActivity.java</b><span style="font-family: 'Times New Roman', serif; font-size: 16pt; line-height: 24.533334732055664px;"> </span><span style="font-family: 'Times New Roman', serif; font-size: 16pt; line-height: 24.533334732055664px;">is shown below :</span></div>
<div class="MsoNormal">
<span style="font-family: 'Times New Roman', serif; font-size: 16pt; line-height: 24.533334732055664px;"><br /></span></div>
<pre style="background: rgb(240, 240, 240); border: 1px dashed rgb(204, 204, 204); color: black; font-family: arial; font-size: 15px; height: auto; line-height: 20px; overflow: auto; padding: 0px; width: 564.296875px;"><code style="word-wrap: normal;"> package com.javalanguageprogramming.jsoupdemo;
import org.jsoup.Jsoup;
import org.jsoup.nodes.Document;
import org.jsoup.select.Elements;
import android.app.Activity;
import android.app.ProgressDialog;
import android.os.Bundle;
import android.widget.TextView;
public class MainActivity extends Activity {
TextView titleText, postText;
String title, posts = "";
ProgressDialog progressDialog;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
//initialize variables
titleText = (TextView)findViewById(R.id.titleText);
postText = (TextView)findViewById(R.id.postsText);
//start progress dialog at the start of network operation
progressBarInitialize();
//run on new thread because we cannot do network operation on main thread
new Thread(new Runnable() {
@Override
public void run() {
try{
//get the Document object from the site. Enter the link of site you want to fetch
Document document = Jsoup.connect("http://javalanguageprogramming.blogspot.in/").get();
//Get the title of blog using title tag
title = document.select("h1.title").text().toString();
//set the title of text view
//Get all the elements with h3 tag and has attribute a[href]
Elements elements = document.select("div.post-outer").select("h3").select("a[href]");
int length = elements.size();
for(int i=0; i<length; i++){
//store each post heading in the string
posts += elements.get(i).text() + "\n\n";
}
//Run this on ui thread because another thread cannot touch the views of main thread
runOnUiThread(new Runnable() {
@Override
public void run() {
//set both the text views
titleText.setText(title);
postText.setText(posts);
//first check if the progress Dialog is already showing than dismiss it
if(progressDialog.isShowing())
progressDialog.dismiss();
}
});
}catch(Exception e){
e.printStackTrace();
//if any exception occurs than progress Dialog should be removed
if(progressDialog.isShowing())
progressDialog.dismiss();
}
}
}).start();
}
private void progressBarInitialize(){
//initialize the progress dialog during the start of network operation
progressDialog = ProgressDialog.show(MainActivity.this, "Loading...", "Fetching the data");
//set the progress dialog to indeterminate state
progressDialog.setIndeterminate(true);
//make the progress dialog not cancellable so that user cannot cancel the network operation
//or you can set it cancellable but for that you need to set the cancel mechanism for the network operation
progressDialog.setCancelable(false);
}
}
</code></pre>
<div class="MsoNormal">
<span style="font-family: 'Times New Roman', serif; font-size: 16pt; line-height: 24.533334732055664px;"><br /></span><br /><div class="MsoNormal">
<span style="font-family: 'Times New Roman', serif; font-size: 16pt; line-height: 24.533334732055664px;">In above activity I used show function of <b>ProgressDialog</b> object and through parameters the message and sub message is passed to show it on the Activity. I initialize the progress dialog when the network operation is started and cancel it when network operation finished.<o:p></o:p></span></div>
<div class="MsoNormal">
<span style="font-family: 'Times New Roman', serif; font-size: 16pt; line-height: 24.533334732055664px;">Do not forget to give the <b>uses permission : Internet</b> for the network operation in this application.</span></div>
</div>
</div>
</div>
</div>
</div>
</div>
Unknownnoreply@blogger.comtag:blogger.com,1999:blog-3729659849536822047.post-21194513767233423932014-12-01T14:32:00.000+05:302014-12-01T14:32:06.067+05:30Auto Complete Text View Tutorial in Android<div dir="ltr" style="text-align: left;" trbidi="on">
<div class="MsoNormal" style="background-color: white; color: #222222; font-family: 'Droid Serif'; font-size: 22px; line-height: 30.799999237060547px;">
<span style="font-family: 'Times New Roman', serif; font-size: 16pt; line-height: 24.533334732055664px;">In <b>Auto Complete Text View</b> whenever we start writing a text in the Edit View than it will automatically show the <b>available options</b>related to that text as you stored in an array or in a database. </span></div>
<div class="MsoNormal" style="background-color: white; color: #222222; font-family: 'Droid Serif'; font-size: 22px; line-height: 30.799999237060547px;">
<span style="font-family: 'Times New Roman', serif; font-size: 16pt; line-height: 24.533334732055664px;"><br /></span></div>
<div>
<div class="MsoNormal" style="background-color: white; color: #222222; font-family: 'Droid Serif'; font-size: 22px; line-height: 30.799999237060547px;">
<span style="font-family: 'Times New Roman', serif; font-size: 16pt; line-height: 24.533334732055664px;">In this example, I am storing the available options in the array and than just set the adapter for simple dropdown list available in android environment with that list.<o:p></o:p></span></div>
<div class="MsoNormal" style="background-color: white; color: #222222; font-family: 'Droid Serif'; font-size: 22px; line-height: 30.799999237060547px;">
<span style="font-family: 'Times New Roman', serif; font-size: 16pt; line-height: 24.533334732055664px;"><br /></span></div>
<div class="MsoNormal" style="background-color: white; color: #222222; font-family: 'Droid Serif'; font-size: 22px; line-height: 30.799999237060547px;">
<span style="font-family: 'Times New Roman', serif; font-size: 16pt; line-height: 24.533334732055664px;">To make this type of application you need to use the<b>AutoCompleteTextView</b> class available in android environment rather than simple TextView or EditView.<o:p></o:p></span></div>
<div class="MsoNormal" style="background-color: white; color: #222222; font-family: 'Droid Serif'; font-size: 22px; line-height: 30.799999237060547px;">
<span style="font-family: 'Times New Roman', serif; font-size: 16pt; line-height: 24.533334732055664px;"><br /></span></div>
<div class="MsoNormal" style="background-color: white; color: #222222; font-family: 'Droid Serif'; font-size: 22px; line-height: 30.799999237060547px;">
<span style="font-family: 'Times New Roman', serif; font-size: 16pt; line-height: 24.533334732055664px;">Let’s start coding by creating a project in Eclipse : <b>File</b> => <b>New</b> =><b>Android Application Project</b> and give a package name as<b>com.javalanguageprogramming.autocompletetextdemo.<o:p></o:p></b></span></div>
<div class="MsoNormal" style="background-color: white; color: #222222; font-family: 'Droid Serif'; font-size: 22px; line-height: 30.799999237060547px;">
<span style="font-family: 'Times New Roman', serif; font-size: 16pt; line-height: 24.533334732055664px;"><b><br /></b></span></div>
<div class="MsoNormal" style="background-color: white; color: #222222; font-family: 'Droid Serif'; font-size: 22px; line-height: 30.799999237060547px;">
<span style="font-family: 'Times New Roman', serif; font-size: 16pt; line-height: 24.533334732055664px;">Copy the code for <b>activity_main.xml</b> as shown below :</span></div>
</div>
<div class="MsoNormal" style="background-color: white; color: #222222; font-family: 'Droid Serif'; font-size: 22px; line-height: 30.799999237060547px;">
<span style="font-family: 'Times New Roman', serif; font-size: 16pt; line-height: 24.533334732055664px;"><br /></span></div>
<div class="MsoNormal" style="background-color: white; color: #222222; font-family: 'Droid Serif'; font-size: 22px; line-height: 30.799999237060547px;">
<pre style="background: rgb(240, 240, 240); border: 1px dashed rgb(204, 204, 204); color: black; font-family: arial; font-size: 12px; height: auto; line-height: 20px; overflow: auto; padding: 0px; width: 564.296875px;"><code style="word-wrap: normal;"> <LinearLayout xmlns: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"
>
<AutoCompleteTextView
android:id="@+id/autoText"
android:layout_width="220dp"
android:layout_height="50dp"
android:layout_marginLeft="40dp"
android:layout_marginTop="50dp"
/>
</LinearLayout> </code></pre>
<pre style="background: rgb(240, 240, 240); border: 1px dashed rgb(204, 204, 204); color: black; font-family: arial; font-size: 12px; height: auto; line-height: 20px; overflow: auto; padding: 0px; width: 564.296875px;"><code style="word-wrap: normal;"><div class="MsoNormal" style="background-color: white; color: #222222; font-family: 'Droid Serif'; font-size: 22px; line-height: 30.799999237060547px; white-space: normal;">
<span style="font-family: 'Times New Roman', serif; font-size: 16pt; line-height: 24.533334732055664px;">In this xml file I am using AutoCompleteTextView for completing of text automatically from String array.<o:p></o:p></span></div>
<div class="MsoNormal" style="background-color: white; color: #222222; font-family: 'Droid Serif'; font-size: 22px; line-height: 30.799999237060547px; white-space: normal;">
<span style="font-family: 'Times New Roman', serif; font-size: 16pt; line-height: 24.533334732055664px;">
</span></div>
<div class="MsoNormal" style="background-color: white; color: #222222; font-family: 'Droid Serif'; font-size: 22px; line-height: 30.799999237060547px; white-space: normal;">
<span style="font-family: 'Times New Roman', serif; font-size: 16pt; line-height: 24.533334732055664px;">Now consider the code for <b>Main.java</b> as shown below :</span></div>
<div class="MsoNormal" style="background-color: white; color: #222222; font-family: 'Droid Serif'; font-size: 22px; line-height: 30.799999237060547px; white-space: normal;">
<span style="font-family: 'Times New Roman', serif; font-size: 16pt; line-height: 24.533334732055664px;">
</span></div>
<div class="MsoNormal" style="background-color: white; color: #222222; font-family: 'Droid Serif'; font-size: 22px; line-height: 30.799999237060547px; white-space: normal;">
<span style="font-family: 'Times New Roman', serif; font-size: 16pt; line-height: 24.533334732055664px;">
</span></div>
<div class="MsoNormal" style="background-color: white; color: #222222; font-family: 'Droid Serif'; font-size: 22px; line-height: 30.799999237060547px; white-space: normal;">
<span style="font-family: 'Times New Roman', serif; font-size: 16pt; line-height: 24.533334732055664px;">
</span></div>
<div class="MsoNormal" style="background-color: white; color: #222222; font-family: 'Droid Serif'; font-size: 22px; line-height: 30.799999237060547px; white-space: normal;">
<span style="font-family: 'Times New Roman', serif; font-size: 16pt; line-height: 24.533334732055664px;">
</span></div>
<div class="MsoNormal" style="background-color: white; color: #222222; font-family: 'Droid Serif'; font-size: 22px; line-height: 30.799999237060547px; white-space: normal;">
<pre style="background: rgb(240, 240, 240); border: 1px dashed rgb(204, 204, 204); color: black; font-family: arial; font-size: 12px; height: auto; line-height: 20px; overflow: auto; padding: 0px; width: 564.296875px;"><code style="word-wrap: normal;">package com.javalanguageprogramming.autocompletetextdemo;
import android.app.Activity;
import android.os.Bundle;
import android.widget.ArrayAdapter;
import android.widget.AutoCompleteTextView;
public class MainActivity extends Activity {
AutoCompleteTextView autoText;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
//initialize auto complete text view
autoText = (AutoCompleteTextView)findViewById(R.id.autoText);
//make an array for the suggestions
String[] suggest = {"aa", "all", "auto", "ask", "bb", "bat", "bad", "back", "ball", "cat", "java", "Program", "tutorial"};
//make an array adapter for viewing string array
ArrayAdapter<String> adapter = new ArrayAdapter<String>(MainActivity.this, android.R.layout.simple_dropdown_item_1line, suggest);
//set the adapter to the auto complete text view
autoText.setAdapter(adapter);
}
}
</code></pre>
<pre style="background: rgb(240, 240, 240); border: 1px dashed rgb(204, 204, 204); color: black; font-family: arial; font-size: 12px; height: auto; line-height: 20px; overflow: auto; padding: 0px; width: 564.296875px;"><span style="background-color: white; color: #222222; font-family: 'Times New Roman', serif; font-size: 21px; line-height: 24.533334732055664px; white-space: normal;">
</span></pre>
<pre style="background: rgb(240, 240, 240); border: 1px dashed rgb(204, 204, 204); color: black; font-family: arial; font-size: 12px; height: auto; line-height: 20px; overflow: auto; padding: 0px; width: 564.296875px;"><span style="background-color: white; color: #222222; font-family: 'Times New Roman', serif; font-size: 21px; line-height: 24.533334732055664px; white-space: normal;">
</span></pre>
<pre style="background: rgb(240, 240, 240); border: 1px dashed rgb(204, 204, 204); color: black; font-family: arial; font-size: 12px; height: auto; line-height: 20px; overflow: auto; padding: 0px; width: 564.296875px;"><span style="background-color: white; color: #222222; font-family: 'Times New Roman', serif; font-size: 21px; line-height: 24.533334732055664px; white-space: normal;">In this Activity, a String array named as “suggest” is used to provide the available options and ArrayAdapter for providing the views to the drop down list</span></pre>
</div>
</code></pre>
</div>
</div>
Unknownnoreply@blogger.comtag:blogger.com,1999:blog-3729659849536822047.post-20515511337561330152014-12-01T14:25:00.000+05:302014-12-01T14:25:30.195+05:30How to call a web service from Android<div dir="ltr" style="text-align: left;" trbidi="on">
<span style="background-color: white; color: #555555; font-family: Verdana, 'BitStream vera Sans', Helvetica, sans-serif; font-size: 12px; line-height: 17.399999618530273px;">By far the easiest way is to use the </span><a href="http://code.google.com/p/ksoap2-android/" style="background-color: white; color: #2970a6; font-family: Verdana, 'BitStream vera Sans', Helvetica, sans-serif; font-size: 12px; line-height: 17.399999618530273px; margin: 0px; padding: 0px; text-decoration: none;" target="_blank">ksoap2-android</a><span style="background-color: white; color: #555555; font-family: Verdana, 'BitStream vera Sans', Helvetica, sans-serif; font-size: 12px; line-height: 17.399999618530273px;"> API. You need the ksoap2 jar file (with all dependencies) which can be found </span><a href="http://ksoap2-android.googlecode.com/svn/m2-repo/com/google/code/ksoap2-android/ksoap2-android-assembly/3.3.0/ksoap2-android-assembly-3.3.0-jar-with-dependencies.jar" style="background-color: white; color: #2970a6; font-family: Verdana, 'BitStream vera Sans', Helvetica, sans-serif; font-size: 12px; line-height: 17.399999618530273px; margin: 0px; padding: 0px; text-decoration: none;" target="_blank">here</a><span style="background-color: white; color: #555555; font-family: Verdana, 'BitStream vera Sans', Helvetica, sans-serif; font-size: 12px; line-height: 17.399999618530273px;"> and you need to add this to your classpath. In the following sample code we call a free web service, called </span><a href="http://www.webservicex.net/CurrencyConvertor.asmx" style="background-color: white; color: #2970a6; font-family: Verdana, 'BitStream vera Sans', Helvetica, sans-serif; font-size: 12px; line-height: 17.399999618530273px; margin: 0px; padding: 0px; text-decoration: none;" target="_blank">currency convertor</a><span style="background-color: white; color: #555555; font-family: Verdana, 'BitStream vera Sans', Helvetica, sans-serif; font-size: 12px; line-height: 17.399999618530273px;">, which has one operation (method) that is is called </span><code style="background-color: white; color: #555555; font-size: 12px; line-height: 17.399999618530273px; margin: 0px; padding: 0px;">ConversionRate</code><span style="background-color: white; color: #555555; font-family: Verdana, 'BitStream vera Sans', Helvetica, sans-serif; font-size: 12px; line-height: 17.399999618530273px;">. If you look at the </span><a href="http://www.webservicex.net/CurrencyConvertor.asmx?WSDL" style="background-color: white; color: #2970a6; font-family: Verdana, 'BitStream vera Sans', Helvetica, sans-serif; font-size: 12px; line-height: 17.399999618530273px; margin: 0px; padding: 0px; text-decoration: none;" target="_blank">service dscription</a><span style="background-color: white; color: #555555; font-family: Verdana, 'BitStream vera Sans', Helvetica, sans-serif; font-size: 12px; line-height: 17.399999618530273px;"> (the WSDL file), you will see that this operation takes two parameters, </span><code style="background-color: white; color: #555555; font-size: 12px; line-height: 17.399999618530273px; margin: 0px; padding: 0px;">FromCurrency</code><span style="background-color: white; color: #555555; font-family: Verdana, 'BitStream vera Sans', Helvetica, sans-serif; font-size: 12px; line-height: 17.399999618530273px;"> and</span><code style="background-color: white; color: #555555; font-size: 12px; line-height: 17.399999618530273px; margin: 0px; padding: 0px;">ToCurrency</code><span style="background-color: white; color: #555555; font-family: Verdana, 'BitStream vera Sans', Helvetica, sans-serif; font-size: 12px; line-height: 17.399999618530273px;">. Lets say that we want to find out the conversion rate from USD to EUR. We implement the following </span><code style="background-color: white; color: #555555; font-size: 12px; line-height: 17.399999618530273px; margin: 0px; padding: 0px;">Activity</code><br />
<code style="background-color: white; color: #555555; font-size: 12px; line-height: 17.399999618530273px; margin: 0px; padding: 0px;"><br /></code>
<code style="background-color: white; color: #555555; font-size: 12px; line-height: 17.399999618530273px; margin: 0px; padding: 0px;"><br /></code>
<code style="background-color: white; color: #555555; font-size: 12px; line-height: 17.399999618530273px; margin: 0px; padding: 0px;"><br /></code>
<span style="color: #555555; font-family: monospace;"><span style="font-size: 12px; line-height: 17.399999618530273px;">package gr.panos.caller;</span></span><br />
<br />
<span style="color: #555555; font-family: monospace;"><span style="font-size: 12px; line-height: 17.399999618530273px;">import java.io.IOException;</span></span><br />
<br />
<span style="color: #555555; font-family: monospace;"><span style="font-size: 12px; line-height: 17.399999618530273px;">import org.ksoap2.SoapEnvelope;</span></span><br />
<span style="color: #555555; font-family: monospace;"><span style="font-size: 12px; line-height: 17.399999618530273px;">import org.ksoap2.SoapFault;</span></span><br />
<span style="color: #555555; font-family: monospace;"><span style="font-size: 12px; line-height: 17.399999618530273px;">import org.ksoap2.serialization.SoapObject;</span></span><br />
<span style="color: #555555; font-family: monospace;"><span style="font-size: 12px; line-height: 17.399999618530273px;">import org.ksoap2.serialization.SoapPrimitive;</span></span><br />
<span style="color: #555555; font-family: monospace;"><span style="font-size: 12px; line-height: 17.399999618530273px;">import org.ksoap2.serialization.SoapSerializationEnvelope;</span></span><br />
<span style="color: #555555; font-family: monospace;"><span style="font-size: 12px; line-height: 17.399999618530273px;">import org.ksoap2.transport.HttpTransportSE;</span></span><br />
<span style="color: #555555; font-family: monospace;"><span style="font-size: 12px; line-height: 17.399999618530273px;">import org.xmlpull.v1.XmlPullParserException;</span></span><br />
<br />
<span style="color: #555555; font-family: monospace;"><span style="font-size: 12px; line-height: 17.399999618530273px;">import android.os.AsyncTask;</span></span><br />
<span style="color: #555555; font-family: monospace;"><span style="font-size: 12px; line-height: 17.399999618530273px;">import android.os.Bundle;</span></span><br />
<span style="color: #555555; font-family: monospace;"><span style="font-size: 12px; line-height: 17.399999618530273px;">import android.app.Activity;</span></span><br />
<span style="color: #555555; font-family: monospace;"><span style="font-size: 12px; line-height: 17.399999618530273px;">import android.widget.TextView;</span></span><br />
<br />
<span style="color: #555555; font-family: monospace;"><span style="font-size: 12px; line-height: 17.399999618530273px;">public class ConvertorCaller extends Activity {</span></span><br />
<br />
<span style="color: #555555; font-family: monospace;"><span style="font-size: 12px; line-height: 17.399999618530273px;"> public final static String URL = "http://www.webservicex.net/CurrencyConvertor.asmx";</span></span><br />
<span style="color: #555555; font-family: monospace;"><span style="font-size: 12px; line-height: 17.399999618530273px;"> public static final String NAMESPACE = "http://www.webserviceX.NET/";</span></span><br />
<span style="color: #555555; font-family: monospace;"><span style="font-size: 12px; line-height: 17.399999618530273px;"> public static final String SOAP_ACTION = "http://www.webserviceX.NET/ConversionRate";</span></span><br />
<span style="color: #555555; font-family: monospace;"><span style="font-size: 12px; line-height: 17.399999618530273px;"> private static final String METHOD = "ConversionRate";</span></span><br />
<span style="color: #555555; font-family: monospace;"><span style="font-size: 12px; line-height: 17.399999618530273px;"> private TextView textView;</span></span><br />
<span style="color: #555555; font-family: monospace;"><span style="font-size: 12px; line-height: 17.399999618530273px;"> </span></span><br />
<span style="color: #555555; font-family: monospace;"><span style="font-size: 12px; line-height: 17.399999618530273px;"> @Override</span></span><br />
<span style="color: #555555; font-family: monospace;"><span style="font-size: 12px; line-height: 17.399999618530273px;"> protected void onCreate(Bundle savedInstanceState) {</span></span><br />
<span style="color: #555555; font-family: monospace;"><span style="font-size: 12px; line-height: 17.399999618530273px;"> super.onCreate(savedInstanceState);</span></span><br />
<span style="color: #555555; font-family: monospace;"><span style="font-size: 12px; line-height: 17.399999618530273px;"> setContentView(R.layout.activity_convertor_caller);</span></span><br />
<span style="color: #555555; font-family: monospace;"><span style="font-size: 12px; line-height: 17.399999618530273px;"> textView = (TextView) findViewById(R.id.textView1);</span></span><br />
<span style="color: #555555; font-family: monospace;"><span style="font-size: 12px; line-height: 17.399999618530273px;"> AsyncTaskRunner runner = new AsyncTaskRunner();</span></span><br />
<span style="color: #555555; font-family: monospace;"><span style="font-size: 12px; line-height: 17.399999618530273px;"> runner.execute();</span></span><br />
<span style="color: #555555; font-family: monospace;"><span style="font-size: 12px; line-height: 17.399999618530273px;"> }</span></span><br />
<br />
<span style="color: #555555; font-family: monospace;"><span style="font-size: 12px; line-height: 17.399999618530273px;"> private class AsyncTaskRunner extends AsyncTask<String, String, String>{</span></span><br />
<br />
<span style="color: #555555; font-family: monospace;"><span style="font-size: 12px; line-height: 17.399999618530273px;"> private String resp;</span></span><br />
<br />
<span style="color: #555555; font-family: monospace;"><span style="font-size: 12px; line-height: 17.399999618530273px;"> @Override</span></span><br />
<span style="color: #555555; font-family: monospace;"><span style="font-size: 12px; line-height: 17.399999618530273px;"> protected String doInBackground(String... params) {</span></span><br />
<span style="color: #555555; font-family: monospace;"><span style="font-size: 12px; line-height: 17.399999618530273px;"> try {</span></span><br />
<span style="color: #555555; font-family: monospace;"><span style="font-size: 12px; line-height: 17.399999618530273px;"> SoapObject request = new SoapObject(NAMESPACE, METHOD);</span></span><br />
<span style="color: #555555; font-family: monospace;"><span style="font-size: 12px; line-height: 17.399999618530273px;"> request.addProperty("FromCurrency", "USD");</span></span><br />
<span style="color: #555555; font-family: monospace;"><span style="font-size: 12px; line-height: 17.399999618530273px;"> request.addProperty("ToCurrency", "EUR");</span></span><br />
<br />
<span style="color: #555555; font-family: monospace;"><span style="font-size: 12px; line-height: 17.399999618530273px;"> SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11);</span></span><br />
<span style="color: #555555; font-family: monospace;"><span style="font-size: 12px; line-height: 17.399999618530273px;"> envelope.dotNet = true;</span></span><br />
<span style="color: #555555; font-family: monospace;"><span style="font-size: 12px; line-height: 17.399999618530273px;"> envelope.setOutputSoapObject(request); </span></span><br />
<span style="color: #555555; font-family: monospace;"><span style="font-size: 12px; line-height: 17.399999618530273px;"> System.out.println("************ I AM SENDING: " + envelope.bodyOut);</span></span><br />
<span style="color: #555555; font-family: monospace;"><span style="font-size: 12px; line-height: 17.399999618530273px;"> </span></span><br />
<span style="color: #555555; font-family: monospace;"><span style="font-size: 12px; line-height: 17.399999618530273px;"> HttpTransportSE transport = new HttpTransportSE(URL);</span></span><br />
<span style="color: #555555; font-family: monospace;"><span style="font-size: 12px; line-height: 17.399999618530273px;"> try {</span></span><br />
<span style="color: #555555; font-family: monospace;"><span style="font-size: 12px; line-height: 17.399999618530273px;"> transport.call(SOAP_ACTION, envelope);</span></span><br />
<span style="color: #555555; font-family: monospace;"><span style="font-size: 12px; line-height: 17.399999618530273px;"> } catch (IOException e) {</span></span><br />
<span style="color: #555555; font-family: monospace;"><span style="font-size: 12px; line-height: 17.399999618530273px;"> e.printStackTrace();</span></span><br />
<span style="color: #555555; font-family: monospace;"><span style="font-size: 12px; line-height: 17.399999618530273px;"> } catch (XmlPullParserException e) {</span></span><br />
<span style="color: #555555; font-family: monospace;"><span style="font-size: 12px; line-height: 17.399999618530273px;"> e.printStackTrace();</span></span><br />
<span style="color: #555555; font-family: monospace;"><span style="font-size: 12px; line-height: 17.399999618530273px;"> }</span></span><br />
<span style="color: #555555; font-family: monospace;"><span style="font-size: 12px; line-height: 17.399999618530273px;"> if (envelope.bodyIn != null) {</span></span><br />
<span style="color: #555555; font-family: monospace;"><span style="font-size: 12px; line-height: 17.399999618530273px;"> if (envelope.bodyIn instanceof SoapFault) {</span></span><br />
<span style="color: #555555; font-family: monospace;"><span style="font-size: 12px; line-height: 17.399999618530273px;"> String s = ((SoapFault) envelope.bodyIn).faultstring;</span></span><br />
<span style="color: #555555; font-family: monospace;"><span style="font-size: 12px; line-height: 17.399999618530273px;"> System.out.println("************ ERROR: " + s);</span></span><br />
<span style="color: #555555; font-family: monospace;"><span style="font-size: 12px; line-height: 17.399999618530273px;"> resp = s;</span></span><br />
<span style="color: #555555; font-family: monospace;"><span style="font-size: 12px; line-height: 17.399999618530273px;"> } else if (envelope.bodyIn instanceof SoapObject) {</span></span><br />
<span style="color: #555555; font-family: monospace;"><span style="font-size: 12px; line-height: 17.399999618530273px;"> SoapObject obj = ((SoapObject) envelope.bodyIn); </span></span><br />
<span style="color: #555555; font-family: monospace;"><span style="font-size: 12px; line-height: 17.399999618530273px;"> System.out.println("**** RESPONSE: " +obj);</span></span><br />
<span style="color: #555555; font-family: monospace;"><span style="font-size: 12px; line-height: 17.399999618530273px;"> </span></span><br />
<span style="color: #555555; font-family: monospace;"><span style="font-size: 12px; line-height: 17.399999618530273px;"> SoapPrimitive root = (SoapPrimitive) obj.getProperty(0);</span></span><br />
<span style="color: #555555; font-family: monospace;"><span style="font-size: 12px; line-height: 17.399999618530273px;"> System.out.println("**** CONVERSION RATE: " +root.toString());</span></span><br />
<span style="color: #555555; font-family: monospace;"><span style="font-size: 12px; line-height: 17.399999618530273px;"> </span></span><br />
<span style="color: #555555; font-family: monospace;"><span style="font-size: 12px; line-height: 17.399999618530273px;"> resp = root.toString();</span></span><br />
<span style="color: #555555; font-family: monospace;"><span style="font-size: 12px; line-height: 17.399999618530273px;"> }</span></span><br />
<span style="color: #555555; font-family: monospace;"><span style="font-size: 12px; line-height: 17.399999618530273px;"> </span></span><br />
<span style="color: #555555; font-family: monospace;"><span style="font-size: 12px; line-height: 17.399999618530273px;"> }</span></span><br />
<span style="color: #555555; font-family: monospace;"><span style="font-size: 12px; line-height: 17.399999618530273px;"> } catch (Exception e) {</span></span><br />
<span style="color: #555555; font-family: monospace;"><span style="font-size: 12px; line-height: 17.399999618530273px;"> e.printStackTrace();</span></span><br />
<span style="color: #555555; font-family: monospace;"><span style="font-size: 12px; line-height: 17.399999618530273px;"> resp = e.getMessage();</span></span><br />
<span style="color: #555555; font-family: monospace;"><span style="font-size: 12px; line-height: 17.399999618530273px;"> }</span></span><br />
<span style="color: #555555; font-family: monospace;"><span style="font-size: 12px; line-height: 17.399999618530273px;"> return resp;</span></span><br />
<span style="color: #555555; font-family: monospace;"><span style="font-size: 12px; line-height: 17.399999618530273px;"> }</span></span><br />
<br />
<span style="color: #555555; font-family: monospace;"><span style="font-size: 12px; line-height: 17.399999618530273px;"> /**</span></span><br />
<span style="color: #555555; font-family: monospace;"><span style="font-size: 12px; line-height: 17.399999618530273px;"> * </span></span><br />
<span style="color: #555555; font-family: monospace;"><span style="font-size: 12px; line-height: 17.399999618530273px;"> * @see android.os.AsyncTask#onPostExecute(java.lang.Object)</span></span><br />
<span style="color: #555555; font-family: monospace;"><span style="font-size: 12px; line-height: 17.399999618530273px;"> */</span></span><br />
<span style="color: #555555; font-family: monospace;"><span style="font-size: 12px; line-height: 17.399999618530273px;"> @Override</span></span><br />
<span style="color: #555555; font-family: monospace;"><span style="font-size: 12px; line-height: 17.399999618530273px;"> protected void onPostExecute(String result) {</span></span><br />
<span style="color: #555555; font-family: monospace;"><span style="font-size: 12px; line-height: 17.399999618530273px;"> textView.setText(resp);</span></span><br />
<span style="color: #555555; font-family: monospace;"><span style="font-size: 12px; line-height: 17.399999618530273px;"> }</span></span><br />
<span style="color: #555555; font-family: monospace;"><span style="font-size: 12px; line-height: 17.399999618530273px;"> </span></span><br />
<span style="color: #555555; font-family: monospace;"><span style="font-size: 12px; line-height: 17.399999618530273px;"> /**</span></span><br />
<span style="color: #555555; font-family: monospace;"><span style="font-size: 12px; line-height: 17.399999618530273px;"> * </span></span><br />
<span style="color: #555555; font-family: monospace;"><span style="font-size: 12px; line-height: 17.399999618530273px;"> * @see android.os.AsyncTask#onPreExecute()</span></span><br />
<span style="color: #555555; font-family: monospace;"><span style="font-size: 12px; line-height: 17.399999618530273px;"> */</span></span><br />
<span style="color: #555555; font-family: monospace;"><span style="font-size: 12px; line-height: 17.399999618530273px;"> @Override</span></span><br />
<span style="color: #555555; font-family: monospace;"><span style="font-size: 12px; line-height: 17.399999618530273px;"> protected void onPreExecute() {</span></span><br />
<span style="color: #555555; font-family: monospace;"><span style="font-size: 12px; line-height: 17.399999618530273px;"> }</span></span><br />
<span style="color: #555555; font-family: monospace;"><span style="font-size: 12px; line-height: 17.399999618530273px;"> /**</span></span><br />
<span style="color: #555555; font-family: monospace;"><span style="font-size: 12px; line-height: 17.399999618530273px;"> * </span></span><br />
<span style="color: #555555; font-family: monospace;"><span style="font-size: 12px; line-height: 17.399999618530273px;"> * @see android.os.AsyncTask#onProgressUpdate(Progress[])</span></span><br />
<span style="color: #555555; font-family: monospace;"><span style="font-size: 12px; line-height: 17.399999618530273px;"> */</span></span><br />
<span style="color: #555555; font-family: monospace;"><span style="font-size: 12px; line-height: 17.399999618530273px;"> @Override</span></span><br />
<span style="color: #555555; font-family: monospace;"><span style="font-size: 12px; line-height: 17.399999618530273px;"> protected void onProgressUpdate(String... text) {</span></span><br />
<span style="color: #555555; font-family: monospace;"><span style="font-size: 12px; line-height: 17.399999618530273px;"> }</span></span><br />
<span style="color: #555555; font-family: monospace;"><span style="font-size: 12px; line-height: 17.399999618530273px;"> }</span></span><br />
<br />
<span style="color: #555555;"><span style="font-size: 12px; line-height: 17.399999618530273px;"><code style="background-color: white; margin: 0px; padding: 0px;"></code></span></span><br />
<span style="color: #555555; font-family: monospace;"><span style="font-size: 12px; line-height: 17.399999618530273px;">}</span></span><br />
<span style="color: #555555; font-family: monospace;"><span style="font-size: 12px; line-height: 17.399999618530273px;"><br /></span></span>
<span style="color: #555555; font-family: monospace;"><span style="font-size: 12px; line-height: 17.399999618530273px;"><br /></span></span>
<span style="color: #555555; font-family: monospace;"><span style="font-size: 12px; line-height: 17.399999618530273px;"><br /></span></span>
<div class="content" style="background-color: white; color: #555555; font-family: Verdana, 'BitStream vera Sans', Helvetica, sans-serif; font-size: 12px; line-height: 17.399999618530273px; margin: 0px; overflow: hidden; padding: 5px 5px 0px;">
<div style="margin-bottom: 10px; padding: 0px;">
You also need to define a text view in your layout as well as give the activity INTERNET permission in your manifest file.</div>
<div class="fixed" style="clear: both; margin: 0px; padding: 0px;">
</div>
</div>
<div class="under" style="background-color: white; clear: both; color: #555555; font-family: Verdana, 'BitStream vera Sans', Helvetica, sans-serif; font-size: 11px; line-height: 16px; margin: 0px 0px 20px; padding: 0px;">
<span style="float: left; margin: 0px; padding: 0px 0px 6px;"></span></div>
</div>
Unknownnoreply@blogger.comtag:blogger.com,1999:blog-3729659849536822047.post-134891430494824342014-11-25T15:46:00.000+05:302014-11-25T15:47:41.548+05:30Write a program with triangle star pattern<div dir="ltr" style="text-align: left;" trbidi="on">
<br />
<h1 style="margin: 0px; position: relative;">
<span style="background-color: white;">How to write a program with triangle star pattern. </span></h1>
<div>
<span style="background-color: white;"><br /></span></div>
<div>
<span style="background-color: white;"><br /></span></div>
<div style="text-align: center;">
<span style="background-color: white; font-size: x-large;"><b>*</b></span></div>
<div style="text-align: center;">
<span style="background-color: white; font-size: x-large;"><b>* *</b></span></div>
<div style="text-align: center;">
<span style="background-color: white; font-size: x-large;"><b>* * *</b></span></div>
<div>
<span style="background-color: white;"><br /></span></div>
<div>
<span style="background-color: white;"><br /></span></div>
<br />
<div style="text-align: left;">
public class triangle {</div>
<div style="text-align: left;">
<span class="Apple-tab-span" style="white-space: pre;"> </span>public static void main(String[] args) {</div>
<div style="text-align: left;">
<span class="Apple-tab-span" style="white-space: pre;"> </span>for(int i=1;i<=3;i++) {</div>
<div style="text-align: left;">
<span class="Apple-tab-span" style="white-space: pre;"> </span>for(int j=3;j>=i; j--) {</div>
<div style="text-align: left;">
<span class="Apple-tab-span" style="white-space: pre;"> </span>System.out.print(" ");</div>
<div style="text-align: left;">
<span class="Apple-tab-span" style="white-space: pre;"> </span>}<span class="Apple-tab-span" style="white-space: pre;"> </span></div>
<div style="text-align: left;">
<span class="Apple-tab-span" style="white-space: pre;"> </span>for(int k=1;k<=i; k++) {</div>
<div style="text-align: left;">
<span class="Apple-tab-span" style="white-space: pre;"> </span>System.out.print("* ");</div>
<div style="text-align: left;">
<span class="Apple-tab-span" style="white-space: pre;"> </span>}</div>
<div style="text-align: left;">
<span class="Apple-tab-span" style="white-space: pre;"> </span>System.out.print("\n");</div>
<div style="text-align: left;">
<span class="Apple-tab-span" style="white-space: pre;"> </span>}</div>
<div style="text-align: left;">
<span class="Apple-tab-span" style="white-space: pre;"> </span>}</div>
<div style="text-align: left;">
<span style="background-color: white;"></span><br /></div>
<div style="text-align: left;">
}</div>
<br /></div>
Unknownnoreply@blogger.comtag:blogger.com,1999:blog-3729659849536822047.post-18902654206679978822014-11-25T15:34:00.002+05:302014-11-25T15:40:43.896+05:30Write a program with L shape triangle pattern<div dir="ltr" style="text-align: left;" trbidi="on">
<h2>
<div style="text-align: justify;">
<b style="font-family: Verdana, sans-serif; font-size: xx-large; line-height: 12.266667366027832px;"><br /></b></div>
<div style="text-align: justify;">
<b style="font-family: Verdana, sans-serif; font-size: xx-large; line-height: 12.266667366027832px;">*</b></div>
<div style="font-family: Verdana, sans-serif; font-size: xx-large; text-align: justify;">
<b style="line-height: 12.266667366027832px;">* *</b></div>
<div style="font-family: Verdana, sans-serif; font-size: xx-large; line-height: 12.266667366027832px; text-align: justify;">
<b>* * *</b></div>
<div style="font-family: Verdana, sans-serif; font-size: xx-large; line-height: 12.266667366027832px; text-align: justify;">
<b><br /></b></div>
<div style="font-family: Verdana, sans-serif; font-size: xx-large; line-height: 12.266667366027832px; text-align: justify;">
<b><br /></b></div>
<div style="font-family: Verdana, sans-serif; font-size: xx-large; line-height: 12.266667366027832px; text-align: justify;">
<b><br /></b></div>
<br /><br />public class task1 {<br /><br /><br /> public static void main(String[] args) {<br /><br /><br /> for(int i=1;i<=3;i++) {<br /><br /><br /> for(int j=1;j<=i; j++) {<br /><br /><br /> System.out.print("*");<br /><br /><br /> }<br /><br />System.out.print("\n");<br /><br /> }<br /><br /> }<br />}
</h2>
</div>
Unknownnoreply@blogger.comtag:blogger.com,1999:blog-3729659849536822047.post-31683020108142156832014-11-25T13:54:00.001+05:302014-11-25T13:54:46.248+05:30Ways to Speed Up Your Website (Load speed up website or any web application)<div dir="ltr" style="text-align: left;" trbidi="on">
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEid7LR5QWithuoOwyQNIoZd4DQ6cux6IJbPO89yiDpuw1rYLRHC4xBrnJa3K6lZYkGrqIc2WNzM2jR6AP-Hxtx8agzjT6zFT4yjcB3rS3rP8oRMYvKWMv2sknzFEroWx3wL5fUw-DJthhU/s1600/speed+Up+website.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img alt="Ways to Speed Up Your Website" border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEid7LR5QWithuoOwyQNIoZd4DQ6cux6IJbPO89yiDpuw1rYLRHC4xBrnJa3K6lZYkGrqIc2WNzM2jR6AP-Hxtx8agzjT6zFT4yjcB3rS3rP8oRMYvKWMv2sknzFEroWx3wL5fUw-DJthhU/s1600/speed+Up+website.png" height="176" title="Ways to Speed Up Your Website" width="320" /></a></div>
<div class="separator" style="clear: both; text-align: center;">
</div>
<br />
<br />
<div align="center" class="MsoNormal" style="text-align: center;">
<br /></div>
<div align="center" class="MsoNormal" style="text-align: center;">
<br /></div>
<div class="MsoListParagraphCxSpFirst" style="margin-left: .25in; mso-add-space: auto; mso-list: l0 level1 lfo1; text-indent: -.25in;">
<!--[if !supportLists]--><b>1.<span style="font-size: 7pt; font-weight: normal;"> </span></b><!--[endif]--><b>Minimize HTTP Requests :- <o:p></o:p></b></div>
<div class="MsoListParagraphCxSpMiddle" style="text-align: justify;">
According to
Yahoo, 80% of a Web page’s load time is spent downloading the different
pieces-parts of the page: images, stylesheets, scripts, Flash, etc.</div>
<div class="MsoListParagraphCxSpMiddle" style="text-align: justify;">
<br /></div>
<div class="MsoListParagraphCxSpMiddle" style="margin-left: .25in; mso-add-space: auto; mso-list: l0 level1 lfo1; text-indent: -.25in;">
<!--[if !supportLists]--><b>2.<span style="font-size: 7pt; font-weight: normal;"> </span></b><!--[endif]--><b>Use CSS instead of images whenever possible.<o:p></o:p></b></div>
<div class="MsoListParagraphCxSpMiddle">
<br /></div>
<div class="MsoListParagraphCxSpMiddle" style="margin-left: .25in; mso-add-space: auto; mso-list: l0 level1 lfo1; text-indent: -.25in;">
<!--[if !supportLists]--><b>3.<span style="font-size: 7pt; font-weight: normal;"> </span></b><!--[endif]--><b>Combine multiple style sheets into one.<o:p></o:p></b></div>
<div class="MsoListParagraphCxSpMiddle">
<br /></div>
<div class="MsoListParagraphCxSpMiddle" style="margin-left: .25in; mso-add-space: auto; mso-list: l0 level1 lfo1; text-indent: -.25in;">
<!--[if !supportLists]--><b>4.<span style="font-size: 7pt; font-weight: normal;"> </span></b><!--[endif]--><b>Reduce scripts and put them at the bottom
of the page.<o:p></o:p></b></div>
<div class="MsoListParagraphCxSpMiddle">
<br /></div>
<div class="MsoListParagraphCxSpMiddle" style="margin-left: .25in; mso-add-space: auto; mso-list: l0 level1 lfo1; text-indent: -.25in;">
<!--[if !supportLists]--><b>5.<span style="font-size: 7pt; font-weight: normal;"> </span></b><!--[endif]--><b>Enable browser caching :-<o:p></o:p></b></div>
<div class="MsoListParagraphCxSpMiddle">
When you visit a website, the elements on
the page you visit are stored on your hard drive in a cache, or temporary
storage, so the next time you visit the site, your browser can load the page
without having to send another HTTP request to the server.</div>
<div class="MsoListParagraphCxSpMiddle">
Read this article to learn four methods for
<a href="http://betterexplained.com/articles/how-to-optimize-your-site-with-http-caching/">enabling
caching</a>.</div>
<div class="MsoListParagraphCxSpMiddle">
OR</div>
<div class="MsoListParagraphCxSpMiddle">
<b>Modify
the web application's :-<o:p></o:p></b></div>
<br />
<div class="MsoListParagraphCxSpLast">
<a href="http://community.jaspersoft.com/wiki/enabling-cache-filter-tomcat-7">http://community.jaspersoft.com/wiki/enabling-cache-filter-tomcat-7</a></div>
<div class="MsoListParagraphCxSpLast">
<br /></div>
<div class="MsoListParagraphCxSpLast">
</div>
<a name='more'></a><br /><br />
<div class="MsoListParagraphCxSpLast">
<br /></div>
<div class="MsoListParagraphCxSpFirst">
<br /></div>
<div class="MsoListParagraphCxSpMiddle" style="margin-left: .25in; mso-add-space: auto; mso-list: l0 level1 lfo1; text-indent: -.25in;">
<!--[if !supportLists]--><b>1.<span style="font-size: 7pt; font-weight: normal;"> </span></b><!--[endif]--><b>Minify Resources :-<o:p></o:p></b></div>
<div class="MsoListParagraphCxSpMiddle">
Since every unnecessary piece of code adds
to the size of your page, it’s important that you eliminate extra spaces, line
breaks, etc.</div>
<div class="MsoListParagraphCxSpMiddle" style="margin-left: .75in; mso-add-space: auto;">
To minify HTML, CSS and JS files Here’s Google’s recommendation:-</div>
<div class="MsoListParagraphCxSpMiddle" style="margin-left: 1.0in; mso-add-space: auto; mso-list: l1 level1 lfo2; text-indent: -.25in;">
<!--[if !supportLists]-->1.)<span style="font-size: 7pt;">
</span><!--[endif]-->To minify HTML, you can use <a href="https://developers.google.com/speed/docs/insights/using_chrome">PageSpeed
Insights Chrome Extension</a> to generate an optimized version of your HTML
code. Run the analysis against your HTML page and browse to the ‘Minify HTML’
rule. Click on ‘See optimized content’ to get the optimized HTML code.</div>
<div class="MsoListParagraphCxSpMiddle" style="margin-left: 1.0in; mso-add-space: auto; mso-list: l1 level1 lfo2; text-indent: -.25in;">
<!--[if !supportLists]-->2.)<span style="font-size: 7pt;">
</span><!--[endif]-->To minify CSS and javascript files, you can use <a href="http://gruntjs.com/">Grunt</a> and <a href="http://developer.yahoo.com/yui/compressor/">YUI Compressor</a>.</div>
<div class="MsoListParagraphCxSpMiddle">
<br /></div>
<div class="MsoListParagraphCxSpMiddle" style="margin-left: .25in; mso-add-space: auto; mso-list: l0 level1 lfo1; text-indent: -.25in;">
<!--[if !supportLists]--><b>2.<span style="font-size: 7pt; font-weight: normal;"> </span></b><!--[endif]--><b>Optimize images:- <o:p></o:p></b></div>
<div class="MsoListParagraphCxSpMiddle">
With images, you need to focus on three
things: size, format and the src attribute.</div>
<div class="MsoListParagraphCxSpMiddle" style="margin-left: 1.25in; mso-add-space: auto; mso-list: l2 level1 lfo3; text-indent: -.25in;">
<!--[if !supportLists]--><b>1.<span style="font-size: 7pt; font-weight: normal;"> </span></b><!--[endif]--><b>Image size :-<o:p></o:p></b></div>
<div class="MsoListParagraphCxSpMiddle" style="margin-left: 1.25in; mso-add-space: auto;">
Crop your images to the correct size.</div>
<div class="MsoListParagraphCxSpMiddle" style="margin-left: 1.25in; mso-add-space: auto;">
Set the width parameter (width=”570”).</div>
<div class="MsoListParagraphCxSpMiddle" style="margin-left: 1.25in; mso-add-space: auto;">
<br /></div>
<div class="MsoListParagraphCxSpMiddle" style="margin-left: 1.25in; mso-add-space: auto; mso-list: l2 level1 lfo3; text-indent: -.25in;">
<!--[if !supportLists]--><b>2.<span style="font-size: 7pt; font-weight: normal;"> </span></b><!--[endif]--><b>Image format :-<o:p></o:p></b></div>
<div class="MsoListParagraphCxSpMiddle" style="margin-left: 1.25in; mso-add-space: auto;">
JPEG is your best option. </div>
<div class="MsoListParagraphCxSpMiddle" style="margin-left: 1.25in; mso-add-space: auto;">
PNG is also good, though older browsers may not fully support it.</div>
<div class="MsoListParagraphCxSpMiddle" style="margin-left: 1.25in; mso-add-space: auto;">
GIFs should only be used for small or simple graphics (less than 10×10
pixels, or a color palette of 3 or fewer colors) and for animated images. </div>
<div class="MsoListParagraphCxSpMiddle" style="margin-left: 1.25in; mso-add-space: auto;">
Do not use BMPs or TIFFs.</div>
<div class="MsoListParagraphCxSpMiddle" style="margin-left: 1.25in; mso-add-space: auto;">
<br /></div>
<div class="MsoListParagraphCxSpMiddle" style="margin-left: 1.25in; mso-add-space: auto; mso-list: l2 level1 lfo3; text-indent: -.25in;">
<!--[if !supportLists]--><b>3.<span style="font-size: 7pt; font-weight: normal;"> </span></b><!--[endif]--><b>Src attribute :-<o:p></o:p></b></div>
<div class="MsoListParagraphCxSpMiddle" style="margin-left: 1.25in; mso-add-space: auto;">
Once you’ve got the size and format right, make sure the code is right
too. In particular, avoid empty image src codes.</div>
<div class="MsoListParagraphCxSpMiddle" style="margin-left: 1.25in; mso-add-space: auto;">
<br /></div>
<div class="MsoListParagraphCxSpMiddle" style="margin-left: 1.25in; mso-add-space: auto;">
<br /></div>
<div class="MsoListParagraphCxSpMiddle" style="margin-left: .25in; mso-add-space: auto; mso-list: l0 level1 lfo1; text-indent: -.25in;">
<!--[if !supportLists]--><b>3.<span style="font-size: 7pt; font-weight: normal;"> </span></b><!--[endif]--><b>Optimize CSS Delivery :- <o:p></o:p></b></div>
<div class="MsoListParagraphCxSpMiddle">
Avoid including CSS in HTML code, such as
divs or your headings (like the inline CSS pictured above). You get cleaner
coding if you put all CSS in your external stylesheet.</div>
<div class="MsoListParagraphCxSpMiddle">
<br /></div>
<div class="MsoListParagraphCxSpMiddle" style="margin-left: .25in; mso-add-space: auto; mso-list: l0 level1 lfo1; text-indent: -.25in;">
<!--[if !supportLists]--><b>4.<span style="font-size: 7pt; font-weight: normal;"> </span></b><!--[endif]--><b>Reduce the number of plugins you use on
your site :-<o:p></o:p></b></div>
<div class="MsoListParagraphCxSpMiddle">
Deactivate and delete any unnecessary
plugins. Then weed out any plugins that slow your site speed.</div>
<div class="MsoListParagraphCxSpMiddle">
<br /></div>
<div class="MsoListParagraphCxSpMiddle" style="margin-left: .25in; mso-add-space: auto; mso-list: l0 level1 lfo1; text-indent: -.25in;">
<!--[if !supportLists]--><b>5.<span style="font-size: 7pt; font-weight: normal;"> </span></b><!--[endif]--><b>Avoid bad requests :- <o:p></o:p></b></div>
<div class="MsoListParagraphCxSpMiddle">
Removing "broken links", or
requests that result in 404/410 errors, avoids wasteful requests.</div>
<div class="MsoListParagraphCxSpMiddle">
<br /></div>
<div class="MsoListParagraphCxSpMiddle" style="margin-left: .25in; mso-add-space: auto; mso-list: l0 level1 lfo1; text-indent: -.25in;">
<!--[if !supportLists]--><b>6.<span style="font-size: 7pt; font-weight: normal;"> </span></b><!--[endif]--><b>Combine images into CSS sprites :- <o:p></o:p></b></div>
<div class="MsoListParagraphCxSpMiddle">
Combining images into as few files as
possible using CSS sprites reduces the number of round-trips and delays in
downloading other resources, reduces request overhead, and can reduce the total
number of bytes downloaded by a web page.</div>
<div class="MsoListParagraphCxSpMiddle">
<br /></div>
<div class="MsoListParagraphCxSpMiddle" style="margin-left: .25in; mso-add-space: auto; mso-list: l0 level1 lfo1; text-indent: -.25in;">
<!--[if !supportLists]--><b>7.<span style="font-size: 7pt; font-weight: normal;"> </span></b><!--[endif]--><b>Optimize the order of styles and scripts :-
<o:p></o:p></b></div>
<div class="MsoListParagraphCxSpMiddle">
Correctly ordering <b>external stylesheets</b> and <b>external</b>
and <b>inline scripts</b> enables better
parallelization of downloads and speeds up browser rendering time.</div>
<div class="MsoListParagraphCxSpMiddle">
Put inline scripts after other resources if
possible.</div>
<div class="MsoListParagraphCxSpMiddle">
Put external scripts after external
stylesheets if possible.</div>
<div class="MsoListParagraphCxSpMiddle">
<br /></div>
<div class="MsoListParagraphCxSpMiddle" style="margin-left: .25in; mso-add-space: auto; mso-list: l0 level1 lfo1; text-indent: -.25in;">
<!--[if !supportLists]--><b>8.<span style="font-size: 7pt; font-weight: normal;"> </span></b><!--[endif]--><b> Serve scaled images :-<o:p></o:p></b></div>
<div class="MsoListParagraphCxSpMiddle">
Properly sizing images can save many bytes
of data.</div>
<div class="MsoListParagraphCxSpMiddle">
<br /></div>
<div class="MsoListParagraphCxSpMiddle" style="margin-left: .25in; mso-add-space: auto; mso-list: l0 level1 lfo1; text-indent: -.25in;">
<!--[if !supportLists]--><b>9.<span style="font-size: 7pt; font-weight: normal;"> </span></b><!--[endif]--><b>Use consistent casing, i.e. use lowercase
wherever possible.</b></div>
<div class="MsoListParagraphCxSpMiddle">
<br /></div>
<div class="MsoListParagraphCxSpMiddle" style="margin-left: .25in; mso-add-space: auto; mso-list: l0 level1 lfo1; text-indent: -.25in;">
<!--[if !supportLists]--><b>10.<span style="font-size: 7pt; font-weight: normal;"> </span></b><!--[endif]--><b>Specify a character set:- <o:p></o:p></b></div>
<div class="MsoListParagraphCxSpMiddle">
<br /></div>
<div class="MsoListParagraphCxSpMiddle">
Specify a character set in HTTP headers to
speed up browser rendering. This is done by adding a simple piece of code into
your header:-</div>
<div class="MsoListParagraphCxSpMiddle">
<br /></div>
<div class="MsoListParagraphCxSpMiddle">
<meta
http-equiv="Content-Type" content="text/html;
charset=utf-8"></div>
<div class="MsoListParagraphCxSpMiddle">
<br /></div>
<div class="MsoListParagraphCxSpLast" style="margin-left: .25in; mso-add-space: auto; mso-list: l0 level1 lfo1; text-indent: -.25in;">
<!--[if !supportLists]--><b>11.<span style="font-size: 7pt; font-weight: normal;"> </span></b><!--[endif]--><b>Use / at the end of directory links :-<o:p></o:p></b></div>
<div class="MsoNormal" style="text-indent: .5in;">
<b>Don't do this:</b> <a
href="http://www.URL.com/directoryname"></div>
<div class="MsoNormal" style="text-indent: .5in;">
<b>Do this instead:</b> <a
href="http://www.URL.com/directoryname/"></div>
<div class="MsoNormal" style="text-indent: .5in;">
<br /></div>
<div class="MsoListParagraph" style="margin-left: .25in; mso-add-space: auto; mso-list: l0 level1 lfo1; text-indent: -.25in;">
<!--[if !supportLists]--><b>12.<span style="font-size: 7pt; font-weight: normal;"> </span></b><!--[endif]--><b>Convert Image into a base64 string.<o:p></o:p></b></div>
<div class="MsoNormal" style="margin-left: .25in;">
It works by encoding an image into
a base64 string and place it directly withing an HTML image tag or as a CSS
background URL. <a href="http://webcodertools.com/imagetobase64converter"><b>Online image to base64 converter</b></a></div>
<div class="MsoNormal" style="text-indent: .5in;">
<br /></div>
<div class="MsoListParagraph" style="margin-left: .25in; mso-add-space: auto; mso-list: l0 level1 lfo1; text-indent: -.25in;">
<!--[if !supportLists]--><b>13.<span style="font-size: 7pt; font-weight: normal;"> </span></b><!--[endif]--><b>Store static images in local storage html 5<o:p></o:p></b></div>
<div class="MsoNormal" style="margin-left: .25in;">
The caching in HTML5 local client
storage is way more effective than browser’s caching.</div>
<div class="MsoNormal" style="margin-left: .25in;">
Example:-</div>
<div class="MsoNormal" style="margin-left: .25in;">
<span style="background: white; font-family: Arial, sans-serif; font-size: 9.5pt; line-height: 115%;"><script></span><span style="font-family: Arial, sans-serif; font-size: 9.5pt; line-height: 115%;"><br />
<span style="background: white;">var hero;</span><br />
<span style="background: white;">if ( localStorage.getItem(‘heroImg’)) {</span><br />
<span style="background: white;">hero = localStorage.getItem(‘heroImg’);</span><br />
<span style="background: white;">}</span><br />
<span style="background: white;">else {</span><br />
<span style="background: white;">hero =
‘/9j/4AAQSkZJRgABAgAAZABkAAD/7 /…/
6p+3dIR//9k=’;</span><br />
<span style="background: white;">localStorage.setItem(‘heroImg’,hero);</span><br />
<span style="background: white;">}</span><br />
<span style="background: white;">document.getElementById(“hero-graphic”).src=’data:image/png;base64,’
+ hero;</span><br />
<span style="background: white;"></script><o:p></o:p></span></span></div>
<div class="MsoNormal" style="margin-left: .25in;">
<br /></div>
<div class="MsoNormal" style="margin-left: .25in;">
<br /></div>
<div class="MsoNormal" style="margin-left: .25in;">
<b><span style="background: white; font-family: Arial, sans-serif; font-size: 9.5pt; line-height: 115%;">The corresponding HTML Image element<o:p></o:p></span></b></div>
<div class="MsoNormal" style="margin-left: .25in;">
<span style="background: white; color: #333333; font-family: "Arial","sans-serif"; font-size: 9.5pt; line-height: 115%;"><img id=”hero-graphic” alt=”Blog Hero Image” src=”” /></span><span style="font-family: Arial, sans-serif; font-size: 9.5pt; line-height: 115%;"><br /></span></div>
</div>
Unknownnoreply@blogger.comtag:blogger.com,1999:blog-3729659849536822047.post-8373725093014821212014-11-25T13:19:00.001+05:302014-11-25T13:19:38.297+05:30MTV Song Are Ruk Ja Re Bandhe by Indian ocean With Lyrics<div dir="ltr" style="text-align: left;" trbidi="on">
Song : Are Ruk Ja Re Bandhe (Unplugged Version)<br />
Band : Indian ocean<br />
Singer : Rahul Ram<br />
<br />
<b><u>Indian Ocean - Bandeh Lyrics</u></b><br />
<br />
Are ruk ja are thum ja<br />
Are ruk ja re bandhe are thum ja re bandhe ki kudrat has padegi ho - 3<br />
Are neendein hai jakhmi<br />
Are sapne hai bhooke<br />
Ki karvat phat padegi ho<br />
<br />
Are ruk ja re bandhe are thum ja re bandhe ki kudrat has padegi ho - 2<br />
<br />
<a name='more'></a><br />
<br />
Are mandir ye chup hai are masjid ye gumsum<br />
Ibadat thak padegi ho<br />
Samay ki lal aandhi kabristan ke raaste<br />
Are latpath chalegi ho<br />
<br />
Are ruk ja re bandhe are thum ja re bandhe ki kudrat has padegi ho - 2<br />
<br />
Kise kafir kahega kise kayar kahega<br />
Teri kab tak chalegi ho<br />
Kise kafir kahega kise kayar kahega<br />
Teri kab tak chalegi ho<br />
<br />
Are ruk ja re bandhe are thum ja re bandhe ki kudrat has padegi ho - 2<br />
<br />
Are mandir ye chup hai are masjid hai gumsum<br />
Ibadat thak padegi ho<br />
Samay ki lal aandhi kabristan ye raste<br />
Are latpath chalegi ho<br />
<br />
Are ruk ja re bandhe are thum ja re bandhe ki kudrat has padegi ho - 2<br />
<br />
Are neendein hai jakhmi are sapne hai bhooke<br />
Ki karvat phat padegi ho<br />
<br />
Yeh andhi chot teri Kabhi ki sukh jaati<br />
Magar ab pak chalegi<br />
<div>
<br /></div>
</div>
Unknownnoreply@blogger.comtag:blogger.com,1999:blog-3729659849536822047.post-10747597578812194572014-11-25T13:11:00.000+05:302014-11-25T13:11:47.354+05:30Exception handling in java<div dir="ltr" style="text-align: left;" trbidi="on">
<br />
<div style="-webkit-text-stroke-width: 0px; background-color: #c0a154; clear: both; color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 14px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 20.285999298095703px; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px;">
</div>
<div id="lws_0" style="-webkit-text-stroke-width: 0px; background-color: #c0a154; color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 14px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 20.285999298095703px; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px;">
<div class="linkwithin_outer" style="border: 0px; clear: both; margin: 0px; padding: 0px;">
<div class="linkwithin_inner" id="linkwithin_inner" style="border: 0px; margin: 0px; padding: 0px;">
</div>
</div>
</div>
<br />
<div dir="ltr" style="-webkit-text-stroke-width: 0px; color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 14px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 20.285999298095703px; orphans: auto; text-align: left; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px;" trbidi="on">
<div class="MsoNormal">
<span style="background-color: white;">An exception is a condition that is caused by a run-time error . when java interpreter encounter an error such as dividing an integer by zero, then it creates an exception and throw it informs us that error has occurred. If that exception is not handled or caught , the interpreter will display an error message and terminate the program. If we want to avoid this and program to continue with execution of remaining code, then we should try to catch the exception. This is known as exception handling</span></div>
<div class="MsoNormal">
<span style="background-color: white;"><br /></span></div>
<div class="MsoNormal">
<span style="background-color: white;"> The exception handling consist of two segments , one to detect errors and throw exception and the other to catch exceptions and to take appropriate actions.</span></div>
<div class="MsoNormal">
<span style="background-color: white;">Some common exceptions that are occurred during the program listed as follows</span></div>
<div class="MsoNormal">
<span style="background-color: white;"><br /></span></div>
<table border="1" cellpadding="0" cellspacing="0" class="MsoTableGrid" style="border-collapse: collapse; border: none;"><tbody>
<tr><td style="border: 1pt solid black; padding: 0in 5.4pt; width: 126.9pt;" valign="top" width="169"><div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="background-color: white;">1)ArithmeticException</span></div>
</td><td style="border: 1pt solid black; padding: 0in 5.4pt; width: 351.9pt;" valign="top" width="469"><div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="background-color: white;">Caused by math errors like division by zero</span></div>
</td></tr>
<tr><td style="border: 1pt solid black; padding: 0in 5.4pt; width: 126.9pt;" valign="top" width="169"><div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="background-color: white;">2)ArrayStoreException</span></div>
</td><td style="border-bottom-color: black; border-bottom-width: 1pt; border-right-color: black; border-right-width: 1pt; border-style: none solid solid none; padding: 0in 5.4pt; width: 351.9pt;" valign="top" width="469"><div class="MsoNormal" style="margin: 0in 0in 0.0001pt 2in; text-indent: -2in;">
<span style="background-color: white;">Caused when a program tries to store the wrong type of data in array</span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="background-color: white;"><br /></span></div>
</td></tr>
<tr><td style="border: 1pt solid black; padding: 0in 5.4pt; width: 126.9pt;" valign="top" width="169"><div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="background-color: white;">ArrayIndexOutOfBoundException</span></div>
</td><td style="border-bottom-color: black; border-bottom-width: 1pt; border-right-color: black; border-right-width: 1pt; border-style: none solid solid none; padding: 0in 5.4pt; width: 351.9pt;" valign="top" width="469"><div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="background-color: white;">Caused by bad index of array</span></div>
</td></tr>
<tr><td style="border: 1pt solid black; padding: 0in 5.4pt; width: 126.9pt;" valign="top" width="169"><div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="background-color: white;">FileNotFoundException</span></div>
</td><td style="border-bottom-color: black; border-bottom-width: 1pt; border-right-color: black; border-right-width: 1pt; border-style: none solid solid none; padding: 0in 5.4pt; width: 351.9pt;" valign="top" width="469"><div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="background-color: white;">Caused when attempt to access a file that is not exist</span></div>
</td></tr>
<tr><td style="border: 1pt solid black; padding: 0in 5.4pt; width: 126.9pt;" valign="top" width="169"><div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="background-color: white;">IOException</span></div>
</td><td style="border-bottom-color: black; border-bottom-width: 1pt; border-right-color: black; border-right-width: 1pt; border-style: none solid solid none; padding: 0in 5.4pt; width: 351.9pt;" valign="top" width="469"><div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="background-color: white;">Caused by general I/O failure</span></div>
</td></tr>
<tr><td style="border: 1pt solid black; padding: 0in 5.4pt; width: 126.9pt;" valign="top" width="169"><div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="background-color: white;">OutOfMemoryException</span></div>
</td><td style="border-bottom-color: black; border-bottom-width: 1pt; border-right-color: black; border-right-width: 1pt; border-style: none solid solid none; padding: 0in 5.4pt; width: 351.9pt;" valign="top" width="469"><div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="background-color: white;">When not enough memory to allocate a new object</span></div>
</td></tr>
<tr><td style="border: 1pt solid black; padding: 0in 5.4pt; width: 126.9pt;" valign="top" width="169"><div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="background-color: white;">NullPointerException</span></div>
</td><td style="border-bottom-color: black; border-bottom-width: 1pt; border-right-color: black; border-right-width: 1pt; border-style: none solid solid none; padding: 0in 5.4pt; width: 351.9pt;" valign="top" width="469"><div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="background-color: white;">Caused by referencing a null object</span></div>
</td></tr>
<tr><td style="border: 1pt solid black; padding: 0in 5.4pt; width: 126.9pt;" valign="top" width="169"><div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="background-color: white;">NumberFormatException</span></div>
</td><td style="border-bottom-color: black; border-bottom-width: 1pt; border-right-color: black; border-right-width: 1pt; border-style: none solid solid none; padding: 0in 5.4pt; width: 351.9pt;" valign="top" width="469"><div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="background-color: white;">Caused when a conversion between strings and number fails</span></div>
</td></tr>
</tbody></table>
<div class="MsoNormal">
<span style="background-color: white;"><br /></span></div>
<div class="MsoNormal">
<span style="background-color: white;"><br /></span></div>
<div class="MsoNormal">
<span style="background-color: white;">Syntax for Exception handling code</span></div>
<div class="MsoNormal">
<span style="background-color: white;">There is <b>try </b>keyword in java that is used for exception handling . All the statement s which are likely to generate an exception put in try block and catch block is define by <b>catch</b>keyword that catches the exception thrown by try block.</span></div>
<div class="MsoNormal">
<span style="background-color: white;">Syntax is as follows</span></div>
<div class="MsoNormal">
<span style="background-color: white;">try{</span></div>
<div class="MsoNormal">
<span style="background-color: white;">statement; // generates an exception</span></div>
<div class="MsoNormal">
<span style="background-color: white;">}</span></div>
<div class="MsoNormal">
<span style="background-color: white;">catch(Exception_type e)</span></div>
<div class="MsoNormal">
<span style="background-color: white;">{</span></div>
<div class="MsoNormal">
<span style="background-color: white;">Statement //processes the exception</span></div>
<div class="MsoNormal">
<span style="background-color: white;">}</span></div>
<div class="MsoNormal">
<span style="background-color: white;">More than one catch statement</span></div>
<div class="MsoNormal">
<span style="background-color: white;">It is possible to have more than one catch statements in a program corresponding to single try statement. Example is as follows</span></div>
<div class="MsoNormal">
<span style="background-color: white;">class test1{</span></div>
<div class="MsoNormal">
<span style="background-color: white;">public static void main(String args[]){</span></div>
<div class="MsoNormal">
<span style="background-color: white;">int a[]={2,4};</span></div>
<div class="MsoNormal">
<span style="background-color: white;">int b=2;</span></div>
<div class="MsoNormal">
<span style="background-color: white;">try{</span></div>
<div class="MsoNormal">
<span style="background-color: white;">int x=a[2]/b-a[1];</span></div>
<div class="MsoNormal">
<span style="background-color: white;">}</span></div>
<div class="MsoNormal">
<span style="background-color: white;">catch(ArithmeticException e){</span></div>
<div class="MsoNormal">
<span style="background-color: white;">System.out.println(“Division by zero”);</span></div>
<div class="MsoNormal">
<span style="background-color: white;">}</span></div>
<div class="MsoNormal">
<span style="background-color: white;">Catch(ArrayIndexOutOfBoundException e)</span></div>
<div class="MsoNormal">
<span style="background-color: white;">{</span></div>
<div class="MsoNormal">
<span style="background-color: white;">System.out.println(“Array index error”);</span></div>
<div class="MsoNormal">
<span style="background-color: white;">}</span></div>
<div class="MsoNormal">
<span style="background-color: white;">Catch(ArrayStoreException e)</span></div>
<div class="MsoNormal">
<span style="background-color: white;">{</span></div>
<div class="MsoNormal">
<span style="background-color: white;">System.out.println(“Array index error”);</span></div>
<div class="MsoNormal">
<span style="background-color: white;">}</span></div>
<div class="MsoNormal">
<span style="background-color: white;">Int y=a[1]/a[0];</span></div>
<div class="MsoNormal">
<span style="background-color: white;">System.out.println(”y = ” +y);</span></div>
<div class="MsoNormal">
<span style="background-color: white;">}</span></div>
<div class="MsoNormal">
<span style="background-color: white;">}</span></div>
<div class="MsoNormal">
<span style="background-color: white;">Use of Finally statement</span></div>
<div class="MsoNormal">
<span style="background-color: white;">Java supports another statement known as <b>finally </b>for exception handling . <b>finally </b> block may be added immediately after the try block or after the last catch block. Defining a finally block is guaranteed to execute statement under the finally block , regardless of whether or not in exception is thrown.</span></div>
<div class="MsoNormal">
<span style="background-color: white;">In the above program we may include the last two statements inside a finally block as shown below.</span></div>
<div class="MsoNormal">
<span style="background-color: white;">finally</span></div>
<div class="MsoNormal">
<span style="background-color: white;">{</span></div>
<div class="MsoNormal">
<span style="background-color: white;">Int y=a[1]/a[0];</span></div>
<div class="MsoNormal">
<span style="background-color: white;">System.out.println(”y = ” +y);</span></div>
<div class="MsoNormal">
<span style="background-color: white;">}</span></div>
</div>
</div>
Unknownnoreply@blogger.comtag:blogger.com,1999:blog-3729659849536822047.post-84896735445727951222014-11-19T13:57:00.001+05:302014-11-19T13:57:59.350+05:30Overloading in java<div dir="ltr" style="text-align: left;" trbidi="on">
<br />
<span style="background-color: white;"><span style="color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 14px; line-height: 20.285999298095703px;"><br /></span></span>
<span style="background-color: white;"><span style="color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 14px; line-height: 20.285999298095703px;">In java method </span><b style="color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 14px; line-height: 20.285999298095703px;">overloading</b><span style="color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 14px; line-height: 20.285999298095703px;"> means creating more than a single method with same name with different signatures.</span><br style="color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 14px; line-height: 20.285999298095703px;" /><span style="color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 14px; line-height: 20.285999298095703px;">For instance the + sign is used to add ints as well as</span><br style="color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 14px; line-height: 20.285999298095703px;" /><span style="color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 14px; line-height: 20.285999298095703px;">concatenate strings . The plus sign behaves differently</span><br style="color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 14px; line-height: 20.285999298095703px;" /><span style="color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 14px; line-height: 20.285999298095703px;">depending on the type of its arguments. Therefore the plus</span><br style="color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 14px; line-height: 20.285999298095703px;" /><span style="color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 14px; line-height: 20.285999298095703px;">sign is inherently overloaded.</span><br style="color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 14px; line-height: 20.285999298095703px;" /><br style="color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 14px; line-height: 20.285999298095703px;" /><span style="color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 14px; line-height: 20.285999298095703px;">Methods can be overloaded as well..same method with</span><br style="color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 14px; line-height: 20.285999298095703px;" /><span style="color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 14px; line-height: 20.285999298095703px;">different parameters is said to be method overloadingis one of the ways that java.----</span><br style="color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 14px; line-height: 20.285999298095703px;" /><span style="color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 14px; line-height: 20.285999298095703px;">we can perform the similar operation in different ways for</span><br style="color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 14px; line-height: 20.285999298095703px;" /><span style="color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 14px; line-height: 20.285999298095703px;">different parameters.</span><br style="color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 14px; line-height: 20.285999298095703px;" /><br style="color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 14px; line-height: 20.285999298095703px;" /><span style="color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 14px; line-height: 20.285999298095703px;">Constructors can be overloaded as well...Overloaded</span><br style="color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 14px; line-height: 20.285999298095703px;" /><span style="color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 14px; line-height: 20.285999298095703px;">Constructors provide multiple ways to initialize a new object</span><br style="color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 14px; line-height: 20.285999298095703px;" /><br style="color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 14px; line-height: 20.285999298095703px;" /><span style="color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 14px; line-height: 20.285999298095703px;">Method overloadingis one of the ways that java implements polymorphism.</span><br style="color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 14px; line-height: 20.285999298095703px;" /><br style="color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 14px; line-height: 20.285999298095703px;" /><span style="color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 14px; line-height: 20.285999298095703px;">In the example three methods are created with same name. java understands these methods with there signatures. java identifies the methods by comparing their signatures like return types, constructor parameters & access modifier used.</span><br style="color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 14px; line-height: 20.285999298095703px;" /><br style="color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 14px; line-height: 20.285999298095703px;" /><br style="color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 14px; line-height: 20.285999298095703px;" /><br style="color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 14px; line-height: 20.285999298095703px;" /><span style="color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 14px; line-height: 20.285999298095703px;">public class democlass { </span><br style="color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 14px; line-height: 20.285999298095703px;" /><span style="color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 14px; line-height: 20.285999298095703px;">public void add(int a , int b){</span><br style="color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 14px; line-height: 20.285999298095703px;" /><span style="color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 14px; line-height: 20.285999298095703px;">System.out.println("Result: "+a+b);</span><br style="color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 14px; line-height: 20.285999298095703px;" /><span style="color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 14px; line-height: 20.285999298095703px;">}</span><br style="color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 14px; line-height: 20.285999298095703px;" /><span style="color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 14px; line-height: 20.285999298095703px;">public void add(String a , String b){</span><br style="color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 14px; line-height: 20.285999298095703px;" /><span style="color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 14px; line-height: 20.285999298095703px;">System.out.println("Result: "+a+b);</span><br style="color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 14px; line-height: 20.285999298095703px;" /><span style="color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 14px; line-height: 20.285999298095703px;">}</span><br style="color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 14px; line-height: 20.285999298095703px;" /><br style="color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 14px; line-height: 20.285999298095703px;" /><span style="color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 14px; line-height: 20.285999298095703px;">public static void main(String[] args) {</span><br style="color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 14px; line-height: 20.285999298095703px;" /><span style="color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 14px; line-height: 20.285999298095703px;">democlass democlass=new democlass();</span><br style="color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 14px; line-height: 20.285999298095703px;" /><span style="color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 14px; line-height: 20.285999298095703px;">int a=10; </span><br style="color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 14px; line-height: 20.285999298095703px;" /><span style="color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 14px; line-height: 20.285999298095703px;">int b=20;</span><br style="color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 14px; line-height: 20.285999298095703px;" /><span style="color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 14px; line-height: 20.285999298095703px;">String temp1="Java";</span><br style="color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 14px; line-height: 20.285999298095703px;" /><span style="color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 14px; line-height: 20.285999298095703px;">String temp2="Source blog";</span><br style="color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 14px; line-height: 20.285999298095703px;" /><span style="color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 14px; line-height: 20.285999298095703px;">democlass.add(a, b);</span><br style="color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 14px; line-height: 20.285999298095703px;" /><span style="color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 14px; line-height: 20.285999298095703px;">democlass.add(temp1, temp2);</span><br style="color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 14px; line-height: 20.285999298095703px;" /><br style="color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 14px; line-height: 20.285999298095703px;" /><span style="color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 14px; line-height: 20.285999298095703px;">}</span><br style="color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 14px; line-height: 20.285999298095703px;" /><br style="color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 14px; line-height: 20.285999298095703px;" /><span style="color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 14px; line-height: 20.285999298095703px;">}</span><br style="color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 14px; line-height: 20.285999298095703px;" /><br style="color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 14px; line-height: 20.285999298095703px;" /><br style="color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 14px; line-height: 20.285999298095703px;" /><span style="color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 14px; line-height: 20.285999298095703px;">output</span><br style="color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 14px; line-height: 20.285999298095703px;" /><br style="color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 14px; line-height: 20.285999298095703px;" /><span style="color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 14px; line-height: 20.285999298095703px;">Result: 30</span><br style="color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 14px; line-height: 20.285999298095703px;" /><span style="color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 14px; line-height: 20.285999298095703px;">Result: JavaSource blog</span></span><br />
<div>
<span style="background-color: #c0a154; color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 14px; line-height: 20.285999298095703px;"><br /></span></div>
</div>
Unknownnoreply@blogger.comtag:blogger.com,1999:blog-3729659849536822047.post-48321713345579453152014-11-19T13:42:00.003+05:302014-11-19T13:48:08.167+05:30Send email in java<div dir="ltr" style="text-align: left;" trbidi="on">
<br />
<div dir="ltr" style="-webkit-text-stroke-width: 0px; color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 14px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 20.285999298095703px; orphans: auto; text-align: left; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px;" trbidi="on">
<h1 style="margin: 0px; position: relative;">
<span style="background-color: white;">how to send email in java</span></h1>
<div>
<span style="background-color: white;"><br /></span></div>
<div>
<span style="background-color: white;"><br /></span></div>
<span style="background-color: white;">import java.util.Properties;<br /><br />import javax.mail.Message;<br />import javax.mail.Session;<br />import javax.mail.Transport;<br />import javax.mail.internet.InternetAddress;<br />import javax.mail.internet.MimeMessage;<br /><br />public class </span><br />
<h1 style="font-size: 12px; margin: 0px; position: relative;">
<span style="background-color: white;">Mail</span></h1>
<span style="background-color: white;">{<br /><br />public static void main(String[] args) {<br />String[] to = { "example@example.com" };<br />String[] cc = { "example.example@example.com" };<br />String[] bcc = { "example@example.com" };<br />This is for google<br />Mail.sendMail("example@example.com", "example", to, cc, bcc,<br />"dont send spams",<br />"dont send spams..");<br />}<br /><br />public synchronized static boolean sendMail(String userName, String passWord, String[] to,<br />String[] cc, String[] bcc, String subject, String text) {<br />String starttls = "true";<br />String auth = "true";<br />String port="465";<br />String host="smtp.gmail.com";<br />String socketFactoryClass="javax.net.ssl.SSLSocketFactory";<br />boolean debug=true;<br />String fallback="false";<br /><br />Properties props = new Properties();<br />// Properties props=System.getProperties();<br />props.put("mail.smtp.user", userName);<br />props.put("mail.smtp.host", host);<br />if (!"".equals(port))<br />props.put("mail.smtp.port", port);<br />if (!"".equals(starttls))<br />props.put("mail.smtp.starttls.enable", starttls);<br />props.put("mail.smtp.auth", auth);<br />if (debug) {<br />props.put("mail.smtp.debug", "true");<br />} else {<br />props.put("mail.smtp.debug", "false");<br />}<br />if (!"".equals(port))<br />props.put("mail.smtp.socketFactory.port", port);<br />if (!"".equals(socketFactoryClass))<br />props.put("mail.smtp.socketFactory.class", socketFactoryClass);<br />if (!"".equals(fallback))<br />props.put("mail.smtp.socketFactory.fallback", fallback);<br /><br />try {<br />Session session = Session.getDefaultInstance(props, null);<br />session.setDebug(debug);<br />MimeMessage msg = new MimeMessage(session);<br />msg.setText(text);<br />msg.setSubject(subject);<br />msg.setFrom(new InternetAddress("example@example.com"));<br />for (int i = 0; i < to.length; i++) {<br />msg.addRecipient(Message.RecipientType.TO, new InternetAddress(<br />to[i]));<br />}<br />if (cc != null) {<br />for (int i = 0; i < cc.length; i++) {<br />msg.addRecipient(Message.RecipientType.CC,<br />new InternetAddress(cc[i]));<br />}<br />}<br />if (bcc != null) {<br />for (int i = 0; i < bcc.length; i++) {<br />msg.addRecipient(Message.RecipientType.BCC,<br />new InternetAddress(bcc[i]));<br />}<br />}<br />msg.saveChanges();<br />Transport transport = session.getTransport("smtp");<br />transport.connect(host, userName, passWord);<br />transport.sendMessage(msg, msg.getAllRecipients());<br />transport.close();<br />return true;<br />} catch (Exception mex) {<br />mex.printStackTrace();<br />return false;<br />}<br />}<br /><br />}</span></div>
</div>
Unknownnoreply@blogger.comtag:blogger.com,1999:blog-3729659849536822047.post-77373927411118977942013-03-12T09:36:00.000+05:302013-03-16T13:40:28.013+05:30Recursion in java<div dir="ltr" style="text-align: left;" trbidi="on">
<br />
<br />
Simply put, recursion is when a function calls itself.<br />
recursion is process, when a method calling itself again and again inside its body .<br />
this is look like a never ending loop.but there is a condition which we check , if it is true then exit.<br />
A method that calls itself is said to be recursive.<br />
The best example of recursion is the computation of the factorial of a number.<br />
The factorial of a number N is the product of all the whole numbers between<br />
1 and N. for example, 3 factorial is 1×2×3, or 6. Here is how a factorial can be computed by use of a recursive method.<br />
<br />
class Fact {<br />
int fact(int n){<br />
if (n==1){<br />
return 1;<br />
}<br />
int result;<br />
result= fact(n-1)*n;<br />
return result;<br />
}<br />
}<br />
<br />
class DemoClass {<br />
public static void main (String args[]) {<br />
Fact f =new Fact();<br />
System.out.println("Factorial of 3 is " + f.fact(3));<br />
}<br />
}<br />
<br />
Output:<br />
Factorial of 3 is 6<br />
<br />
<br />
in the above example a method fact is defined which is calling itself inside its body.<br />
fact is recursive function .<br />
<br />
now in DemoClass we calling fact(3) and execution steps are as follows:<br />
<br />
1) first fact will check if 3==1 then return 1.<br />
2) 3!=1, now it will call fact2(3-1)*3 (we are assigning new name fact 2 to fact for understanding)<br />
3) now again fact will check if 2==1 then return .<br />
4) 2!=1, now it will call fact3(2-1)*2 (we are assigning new name fact 3 to fact for understanding)<br />
5) now again fact will check if 1==1 then return .<br />
6) 1==1, now it will return 1 to fact2.<br />
7) now fact2 will return 1*2=2to fact .<br />
8) now fact2 will return 2*3=6 to DemoClass<br />
</div>Unknownnoreply@blogger.comtag:blogger.com,1999:blog-3729659849536822047.post-25034767693631196802013-03-12T09:33:00.002+05:302013-03-12T09:33:56.701+05:30Array in java<div dir="ltr" style="text-align: left;" trbidi="on">
<br />
<div>
<br /></div>
<div>
An array is an group of contiguous or related data items that share a common name. the elements of an array are stored in contiguous memory locations and each individual element can be accessed using one or more indices or subscripts. A subscript or an index is a positive integer value , which indicates the position of an array. Arrays are used when a programmer wants to store multiple data items of the same type into a single list and also wants to access and manipulate individual elements of list.</div>
<div>
Types of array</div>
<div>
1) One dimensional arrays</div>
<div>
2) Two dimensional arrays</div>
<div>
<br /></div>
<div>
One dimensional arrays:- A list of items can be given one variable name using only one subscript and such a variable is called a single –subscripted variable or a one-dimensional array.</div>
<div>
The syntax for declaring a single-dimensional array is as follows :</div>
<div>
data_type array_name[];</div>
<div>
after an array is declared , you need to create it by allocating space to it in memory. Arrays are created using new operator.</div>
<div>
Array_name=new data_type[size];</div>
<div>
<br /></div>
<div>
Example of array One dimensional arrays:-</div>
<div>
int marks[];</div>
<div>
marks= new int[5];</div>
<div>
For example if we want to represent a set of five numbers, say (20,22,26,85,77) by an array variable number, then we may create the variable number as follows</div>
<div>
Int number[]={20,22,26,85,77};</div>
<div>
The element will be store as follows</div>
<div>
number [0]=20</div>
<div>
number [1]=22</div>
<div>
number [2]=26</div>
<div>
number [3]=85</div>
<div>
number [4]=77</div>
<div>
<br /></div>
<div>
Two dimensional arrays:- Two-dimensional arrays are useful when thedata being processed are to be arranged in the form of rows and columns(matrix form)</div>
<div>
The syntax for declaring a two-dimensional array is as follows:</div>
<div>
data_type array_name[][];</div>
<div>
The syntax for creating a two-dimensional array is as follows:</div>
<div>
data_type array_name[row_size][column_size];</div>
<div>
For example an array arr [][] of type int having three rows and two columns can be declared and created using this statement</div>
<div>
Int arr[][]=new int[3][2];</div>
<div>
<br /></div>
<div>
Initialization of two dimensional array</div>
<div>
Int arr[3][2]={ {101,23},{56,55},{88,63} };</div>
<div>
The element will be stored in two dimensional array as follows:</div>
<div>
arr[0][0] = 101</div>
<div>
arr[0][1] = 23</div>
<div>
arr[1][0] =56</div>
<div>
arr[1][1] = 55</div>
<div>
arr[2][0] =88</div>
<div>
arr[2][1] = 63</div>
<div>
<br /></div>
</div>
Unknownnoreply@blogger.comtag:blogger.com,1999:blog-3729659849536822047.post-90850585759830409162013-03-12T09:32:00.000+05:302013-03-12T09:32:29.881+05:30Loop in java<div dir="ltr" style="text-align: left;" trbidi="on">
<br />
<br />
<br />
<br />
Looping is used to develop programs which are having some repetitive process. When a particular block of statement have to reapete then loops are used . it makes the programmer job easier , because instead of writing same lines again and again , loop can be used.<br />
Loop is consist of two segments one is body and other is exit condition . exit condition is a condition which will end the loop. Means the sequence of statement will reapete until the condition is true.<br />
A looping process have four main steps , which are as follows:<br />
1) Setting and initialization of a counter<br />
2) Execution of statements<br />
3) Test for condition that whether the condition is true or false<br />
4) Increment/decrement counter;<br />
Java supports three type of loop statements :<br />
While<br />
Do while<br />
For<br />
While loop:- while loop is an entry-controlled loop statement . at first step the test condition is evaluated , if it is true then the statement is executed and if it is false the exit from loop. After execution of statement again the condition is evaluated and this process is repeated until the condition is true.<br />
Syntax of while<br />
Initialization :<br />
While (test condition){<br />
Body of loop<br />
Increment/decrement<br />
} <br />
Example of while loop<br />
class whileLoop{<br />
public static void main(String args[]){<br />
int i=0;<br />
while(i<5){<br />
System.out.println(i);<br />
i++;<br />
}<br />
}<br />
}<br />
Output:<br />
0<br />
1<br />
2<br />
3<br />
4<br />
Do while loop:-<br />
In while loop first condition is tested then body of loop is executed .In in do while loop first the body of loop is executed and then condition is executed. So the minimum chance of execution of while loop is 0 an the minimum chance of execution of do while loop is 1. Because whether the condition is true or false the statement will be executed atleast for one time.<br />
Syntax of do while loop<br />
Initialization<br />
do<br />
{<br />
Body of loop<br />
}<br />
While(test condition)<br />
We can use nested loop that is loop inside loop according to requirement .<br />
class doWhileLoop{<br />
public static void main(String args[]){<br />
int row, column, x;<br />
row=1;<br />
do{<br />
column =1;<br />
do{<br />
x=row*column;<br />
column=column+1;<br />
}while(column<=3);<br />
System.out.println();<br />
Row=row+1;<br />
}while(row<=3);<br />
}<br />
}<br />
Output<br />
1 2 3<br />
2 4 6<br />
3 6 9<br />
<br />
For loop:-<br />
For loop is most widely used loop and very useful loop .because in for loop initialization , condition and increment/decrement are in a single row.<br />
Syntax of for loop<br />
For(initialization; test condition; increment/decrement){<br />
Body of loop<br />
}<br />
<br />
Example of for loop:<br />
public class foorloop {<br />
public static void main(String[] args) {<br />
for(int i=1;i<=10;i++){<br />
System.out.println("2 * " +i + "=" + 2*i );<br />
}<br />
}<br />
}<br />
<br />
Output<br />
2 * 1=2<br />
2 * 2=4<br />
2 * 3=6<br />
2 * 4=8<br />
2 * 5=10<br />
2 * 6=12<br />
2 * 7=14<br />
2 * 8=16<br />
2 * 9=18<br />
2 * 10=20<br />
<br />
We can use nested loops that is loop inside loop as many as required . There is no limit of nesting loops .<br />
<div>
<br /></div>
</div>
Unknownnoreply@blogger.comtag:blogger.com,1999:blog-3729659849536822047.post-18799149274903260772013-03-12T09:30:00.000+05:302013-03-12T09:30:42.077+05:30If Else statement<div dir="ltr" style="text-align: left;" trbidi="on">
<br />
<div>
<br /></div>
<div>
<div>
<br /></div>
<div>
If statement is very powerful decision making statement and is used to control the flow of execution of statement .</div>
<div>
If we want to execute a statement on some condition . than we should use the if statement</div>
<div>
Syntax :-</div>
<div>
If(Condition){</div>
<div>
//Statement</div>
<div>
}</div>
<div>
Example :-</div>
<div>
If(a<b){</div>
<div>
System.out.println(a is smaller than b);</div>
<div>
}</div>
<div>
In above example first it check that if a is less than b only if it is true then next statement will be executed otherwise no statement will be executed.</div>
<div>
If statement can be implemented in the following ways:-</div>
<div>
1. Simple if statement</div>
<div>
2. If else statement</div>
<div>
3. Else if ladder</div>
<div>
4. Nested if else statement</div>
<div>
<br /></div>
<div>
1) Simple if statement :-</div>
<div>
If (condition){</div>
<div>
Statement - block - x</div>
<div>
}</div>
<div>
Statement –block – y</div>
<div>
In this is if the condition is true then statement block x will be executed and then statement block y will be executed, otherwise the statement block x will be skipped only statement block y will be executed.</div>
<div>
Example :</div>
<div>
Class SimpleIf{</div>
<div>
Public static void main(String args[]){</div>
<div>
Int a=10,b=5;</div>
<div>
If(a>b){</div>
<div>
System.out.println(“a is greater”);</div>
<div>
}</div>
<div>
System.out.println(“Thanks for coming”);</div>
<div>
}</div>
<div>
}</div>
<div>
Output:</div>
<div>
a is greater</div>
<div>
Thanks for coming</div>
<div>
<br /></div>
<div>
IF Else statement:-</div>
<div>
If(condition)</div>
<div>
{</div>
<div>
Statement – block -x</div>
<div>
}</div>
<div>
else</div>
<div>
{</div>
<div>
Statement – block – y</div>
<div>
}</div>
<div>
Statement-z</div>
<div>
In this if the condition is true then statement block x will be executed and statement block y will be skipped and then statement z will be executed and condition will false then statement block x will be skipped and statement block y will be executed and statement z will be executed.</div>
<div>
Nested if else:-</div>
<div>
If(condition 1){</div>
<div>
If(condition 2){</div>
<div>
Statement -1</div>
<div>
}</div>
<div>
else{</div>
<div>
statement - 2</div>
<div>
}</div>
<div>
}</div>
<div>
else{</div>
<div>
statement -3</div>
<div>
}</div>
<div>
In the above example if condition-1 is false then statement -1 and statement-2 will be skipped and only statement -3 will be executed and if the condition -1 will true then condition-2 will be checked and if condition -2 will be true then statement -1 will be executed otherwise statement -2 will be executed.</div>
<div>
Example</div>
<div>
Int a=5;</div>
<div>
Int b=10;</div>
<div>
Int c=15;</div>
<div>
If(a>b){</div>
<div>
If(a>c){</div>
<div>
System.out.println(“a is greater”);</div>
<div>
}</div>
<div>
else{</div>
<div>
System.out.println(“c is greater”)</div>
<div>
}</div>
<div>
}</div>
<div>
else{</div>
<div>
if(b>c){</div>
<div>
System.out.println(“b is greater”);</div>
<div>
}</div>
<div>
else{</div>
<div>
System.out.println(“c is greater”);</div>
<div>
}</div>
<div>
<br /></div>
<div>
}</div>
<div>
Else if ladder:- If we want to use multiple decision in our program then we have an another option that is else if ladder.</div>
<div>
Syntax:</div>
<div>
If(condition 1) {</div>
<div>
Statement 1</div>
<div>
}</div>
<div>
else if(condition 2){</div>
<div>
Statement 2</div>
<div>
}</div>
<div>
else if(condition 2){</div>
<div>
Statement 2</div>
<div>
}</div>
<div>
else{</div>
<div>
Statement 3</div>
<div>
}</div>
<div>
In this all the condition is evaluated from top to down which condition is that statement will be executed if all condition will be false then final else statement will be executed.</div>
<div>
Example</div>
<div>
If(marks>90){</div>
<div>
System.out.println(“First division”)</div>
<div>
}</div>
<div>
else If(marks>80){</div>
<div>
System.out.println(“Second division”)</div>
<div>
}</div>
<div>
else If(marks>60){</div>
<div>
System.out.println(“Third division”)</div>
<div>
}</div>
<div>
else {</div>
<div>
System.out.println(“Pass”)</div>
<div>
}</div>
<div>
This will end our if statement</div>
</div>
</div>
Unknownnoreply@blogger.comtag:blogger.com,1999:blog-3729659849536822047.post-74869687403969566162013-03-04T14:44:00.001+05:302013-03-04T14:44:04.298+05:30Tu Hi Tu Full Song With Lyrics | Nautanki Saala | Ayushmann Khurrana<div dir="ltr" style="text-align: left;" trbidi="on">
<iframe width="560" height="315" src="http://www.youtube.com/embed/xj644HlZA4U" frameborder="0" allowfullscreen></iframe>
</br>
</br>
<table border="0" cellpadding="0" cellspacing="0" style="background-color: white; color: #222222; font-family: arial, sans-serif; font-size: 13px; margin: 0px 9px; text-align: start; width: 480px;"><tbody>
<tr><td style="margin: 0px;"><a class="nonplayable" href="http://muftdownloadsongs.blogspot.in/" style="color: #1155cc; display: block; text-decoration: initial;" target="_blank"><img alt="Tu Hi Tu , Lyrics, Nautanki Saala" border="0" height="300" src="http://i2.ytimg.com/vi/xj644HlZA4U/hqdefault.jpg" title="Tu Hi Tu , Lyrics, Nautanki Saala" width="400" /></a></td></tr>
<tr><td height="16" style="margin: 0px;"></td></tr>
<tr><td style="margin: 0px;" width="480"><a href="http://muftdownloadsongs.blogspot.in/" style="color: #1155cc; text-decoration: initial;" target="_blank"><div style="color: #333333; font-family: arial, Arial, sans-serif; font-size: 15px; font-weight: bold; line-height: 20px;">
Tu Hi Tu Full Song With Lyrics | Nautanki Saala | Ayushmann Khurrana</div>
</a><div style="color: #999999; font-family: arial, Arial, sans-serif; line-height: 20px;">
<br /></div>
</td></tr>
</tbody></table>
<table border="0" cellpadding="0" cellspacing="0" style="background-color: white; color: #222222; font-family: arial, sans-serif; font-size: 13px; text-align: start;"><tbody>
<tr><td height="16" style="margin: 0px;"></td></tr>
</tbody></table>
<table border="0" cellpadding="0" cellspacing="0" style="background-color: white; color: #222222; font-family: arial, sans-serif; font-size: 13px; text-align: start;"><tbody>
<tr><td style="margin: 0px;" width="498"><div style="color: #333333; font-family: arial, Arial, sans-serif; line-height: 20px;">
Song: Tu Hi Tu<br />Movie: Nautanki Saala<br />Singer: Ayushmann Khurrana<br />Music: Mikey Mccleary<br />Lyrics: Kausar Munir<br />Director: Rohan Sippy<br />Music Label: T-Series</div>
</td></tr>
</tbody></table>
</div>Unknownnoreply@blogger.comtag:blogger.com,1999:blog-3729659849536822047.post-9935870711435662952013-02-13T11:56:00.001+05:302013-02-13T11:56:48.261+05:30How to Use DateFormat Class in Java <div dir="ltr" style="text-align: left;" trbidi="on">
<br />
<div class="p1">
Use getDateInstance to get the normal date format for that country<span class="s1">.</span> For example,</div>
<div class="p1">
import java.text.DateFormat<span class="s1">;</span></div>
<div class="p1">
import java.util.Date<span class="s1">;</span></div>
<div class="p2">
<br /></div>
<div class="p1">
public class DateFormatExample<span class="s1"> {</span></div>
<div class="p2">
<br /></div>
<div class="p3">
<span class="s2">public</span> static void main(String[] args) {</div>
<div class="p2">
</div>
<div class="p3">
Date now = new Date();</div>
<div class="p2">
<br /></div>
<div class="p3">
<span class="s2">DateFormat</span> defaultDf = DateFormat.getDateInstance();</div>
<div class="p3">
<span class="s2">DateFormat</span> shortDf = DateFormat.getDateInstance(DateFormat.SHORT);</div>
<div class="p3">
<span class="s2">DateFormat</span> mediumDf = DateFormat.getDateInstance(DateFormat.MEDIUM);</div>
<div class="p3">
<span class="s2">DateFormat</span> longDf = DateFormat.getDateInstance(DateFormat.LONG);</div>
<div class="p3">
<span class="s2">DateFormat</span> fullDf = DateFormat.getDateInstance(DateFormat.FULL);</div>
<div class="p2">
</div>
<div class="p3">
<span class="s2">System</span>.out.println(" 1. " + defaultDf.format(now));</div>
<div class="p3">
<span class="s2">System</span>.out.println(" 2. " + shortDf.format(now));</div>
<div class="p3">
<span class="s2">System</span>.out.println(" 3. " + mediumDf.format(now));</div>
<div class="p3">
<span class="s2">System</span>.out.println(" 4. " + longDf.format(now));</div>
<div class="p3">
<span class="s2">System</span>.out.println(" 5. " + fullDf.format(now));</div>
<div class="p3">
}</div>
<div class="p3">
}</div>
<div class="p1">
The output is</div>
<div class="p3">
<span class="s3"> </span>1. <span class="s3">Jun </span>20, 2008</div>
<div class="p3">
2. 6/20/08</div>
<div class="p3">
3. <span class="s3">Jun </span>20, 2008</div>
<div class="p3">
4. <span class="s3">June </span>20, 2008</div>
<div class="p3">
5. <span class="s3">Friday,</span> <span class="s3">June </span>20, 2008</div>
<div class="p2">
<br /></div>
<div class="p1">
Use getTimeInstance to get the time format for that country<span class="s1">.</span> For example,</div>
<div class="p1">
import java.text.DateFormat<span class="s1">;</span></div>
<div class="p1">
import java.util.Date<span class="s1">;</span></div>
<div class="p2">
<br /></div>
<div class="p1">
public class DateFormatExample<span class="s1"> {</span></div>
<div class="p2">
<br /></div>
<div class="p3">
<span class="s2">public</span> static void main(String[] args) {</div>
<div class="p2">
</div>
<div class="p3">
Date now = new Date();</div>
<div class="p2">
<br /></div>
<div class="p3">
<span class="s2">DateFormat</span> defaultDf = DateFormat.getTimeInstance();</div>
<div class="p3">
<span class="s2">DateFormat</span> shortDf = DateFormat.getTimeInstance(DateFormat.SHORT);</div>
<div class="p3">
<span class="s2">DateFormat</span> mediumDf = DateFormat.getTimeInstance(DateFormat.MEDIUM);</div>
<div class="p3">
<span class="s2">DateFormat</span> longDf = DateFormat.getTimeInstance(DateFormat.LONG);</div>
<div class="p3">
<span class="s2">DateFormat</span> fullDf = DateFormat.getTimeInstance(DateFormat.FULL);</div>
<div class="p2">
</div>
<div class="p3">
<span class="s2">System</span>.out.println(" 1. " + defaultDf.format(now));</div>
<div class="p3">
<span class="s2">System</span>.out.println(" 2. " + shortDf.format(now));</div>
<div class="p3">
<span class="s2">System</span>.out.println(" 3. " + mediumDf.format(now));</div>
<div class="p3">
<span class="s2">System</span>.out.println(" 4. " + longDf.format(now));</div>
<div class="p3">
<span class="s2">System</span>.out.println(" 5. " + fullDf.format(now));</div>
<div class="p3">
}</div>
<div class="p3">
}</div>
<div class="p1">
The output is</div>
<div class="p3">
<span class="s3"> </span>1. 10<span class="s3">:</span>09<span class="s3">:</span>12<span class="s3"> PM</span></div>
<div class="p3">
<span class="s3"> </span>2. 10<span class="s3">:</span>09<span class="s3"> PM</span></div>
<div class="p3">
<span class="s3"> </span>3. 10<span class="s3">:</span>09<span class="s3">:</span>12<span class="s3"> PM</span></div>
<div class="p1">
<span class="s1">4. 10</span>:<span class="s1">09</span>:<span class="s1">12</span> PM EDT</div>
<div class="p1">
<span class="s1">5. 10</span>:<span class="s1">09</span>:<span class="s1">12</span> PM EDT</div>
<div class="p4">
<br /></div>
<div class="p1">
Use getDateTimeInstance to get a date and time format<span class="s1">.</span> For example,</div>
<div class="p1">
import java.text.DateFormat<span class="s1">;</span></div>
<div class="p1">
import java.util.Date<span class="s1">;</span></div>
<div class="p2">
<br /></div>
<div class="p1">
public class DateFormatExample<span class="s1"> {</span></div>
<div class="p2">
<br /></div>
<div class="p3">
<span class="s2">public</span> static void main(String[] args) {</div>
<div class="p2">
<span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span></div>
<div class="p3">
Date now = new Date();</div>
<div class="p2">
<br /></div>
<div class="p3">
<span class="s2">DateFormat</span> defaultDf = DateFormat.getDateTimeInstance();</div>
<div class="p3">
<span class="s2">DateFormat</span> shortDf = DateFormat.getDateTimeInstance(</div>
<div class="p3">
DateFormat.SHORT, DateFormat.SHORT);</div>
<div class="p3">
<span class="s2">DateFormat</span> mediumDf = DateFormat.getDateTimeInstance(</div>
<div class="p3">
DateFormat.MEDIUM, DateFormat.SHORT);</div>
<div class="p3">
<span class="s2">DateFormat</span> longDf = DateFormat.getDateTimeInstance(</div>
<div class="p3">
DateFormat.LONG, DateFormat.SHORT);</div>
<div class="p3">
<span class="s2">DateFormat</span> fullDf = DateFormat.getDateTimeInstance(</div>
<div class="p3">
DateFormat.FULL, DateFormat.SHORT);</div>
<div class="p2">
</div>
<div class="p3">
<span class="s2">System</span>.out.println(" 1. " + defaultDf.format(now));</div>
<div class="p3">
<span class="s2">System</span>.out.println(" 2. " + shortDf.format(now));</div>
<div class="p3">
<span class="s2">System</span>.out.println(" 3. " + mediumDf.format(now));</div>
<div class="p3">
<span class="s2">System</span>.out.println(" 4. " + longDf.format(now));</div>
<div class="p3">
<span class="s2">System</span>.out.println(" 5. " + fullDf.format(now));</div>
<div class="p3">
<span class="s2">System</span>.out.println("============================");</div>
<div class="p3">
<span class="s2">shortDf</span> = DateFormat.getDateTimeInstance(DateFormat.SHORT, </div>
<div class="p3">
DateFormat.MEDIUM);</div>
<div class="p3">
<span class="s2">mediumDf</span> = DateFormat.getDateTimeInstance(DateFormat.MEDIUM, </div>
<div class="p3">
DateFormat.MEDIUM);</div>
<div class="p3">
<span class="s2">longDf</span> = DateFormat.getDateTimeInstance(DateFormat.LONG, </div>
<div class="p3">
DateFormat.MEDIUM);</div>
<div class="p3">
<span class="s2">fullDf</span> = DateFormat.getDateTimeInstance(DateFormat.FULL, </div>
<div class="p3">
DateFormat.MEDIUM);</div>
<div class="p2">
<span class="Apple-tab-span"> </span> </div>
<div class="p3">
<span class="s2">System</span>.out.println(" 6. " + shortDf.format(now));</div>
<div class="p3">
<span class="s2">System</span>.out.println(" 7. " + mediumDf.format(now));</div>
<div class="p3">
<span class="s2">System</span>.out.println(" 8. " + longDf.format(now));</div>
<div class="p3">
<span class="s2">System</span>.out.println(" 9. " + fullDf.format(now));</div>
<div class="p3">
<span class="s2">System</span>.out.println("============================");</div>
<div class="p2">
</div>
<div class="p3">
<span class="s2">shortDf</span> = DateFormat.getDateTimeInstance(DateFormat.SHORT, </div>
<div class="p3">
DateFormat.LONG);</div>
<div class="p3">
<span class="s2">mediumDf</span> = DateFormat.getDateTimeInstance(DateFormat.MEDIUM, </div>
<div class="p3">
DateFormat.LONG);</div>
<div class="p3">
<span class="s2">longDf</span> = DateFormat.getDateTimeInstance(DateFormat.LONG, </div>
<div class="p3">
DateFormat.LONG);</div>
<div class="p3">
<span class="s2">fullDf</span> = DateFormat.getDateTimeInstance(DateFormat.FULL, </div>
<div class="p3">
DateFormat.LONG);</div>
<div class="p2">
<span class="Apple-tab-span"> </span> </div>
<div class="p3">
<span class="s2">System</span>.out.println(" 10. " + shortDf.format(now));</div>
<div class="p3">
<span class="s2">System</span>.out.println(" 11. " + mediumDf.format(now));</div>
<div class="p3">
<span class="s2">System</span>.out.println(" 12. " + longDf.format(now));</div>
<div class="p3">
<span class="s2">System</span>.out.println(" 13. " + fullDf.format(now));</div>
<div class="p3">
<span class="s2">System</span>.out.println("============================");</div>
<div class="p2">
<br /></div>
<div class="p3">
<span class="s2">shortDf</span> = DateFormat.getDateTimeInstance(DateFormat.SHORT, </div>
<div class="p3">
DateFormat.FULL);</div>
<div class="p3">
<span class="s2">mediumDf</span> = DateFormat.getDateTimeInstance(DateFormat.MEDIUM, </div>
<div class="p3">
DateFormat.FULL);</div>
<div class="p3">
<span class="s2">longDf</span> = DateFormat.getDateTimeInstance(DateFormat.LONG, </div>
<div class="p3">
DateFormat.FULL);</div>
<div class="p3">
<span class="s2">fullDf</span> = DateFormat.getDateTimeInstance(DateFormat.FULL, </div>
<div class="p3">
DateFormat.FULL);</div>
<div class="p2">
<span class="Apple-tab-span"> </span> </div>
<div class="p3">
<span class="s2">System</span>.out.println(" 14. " + shortDf.format(now));</div>
<div class="p3">
<span class="s2">System</span>.out.println(" 15. " + mediumDf.format(now));</div>
<div class="p3">
<span class="s2">System</span>.out.println(" 16. " + longDf.format(now));</div>
<div class="p3">
<span class="s2">System</span>.out.println(" 17. " + fullDf.format(now));</div>
<div class="p2">
<br /></div>
<div class="p3">
}</div>
<div class="p2">
<br /></div>
<div class="p3">
}</div>
<div class="p1">
The output is</div>
<div class="p3">
<span class="s3"> </span>1. <span class="s3">Jun </span>21, 2008 9<span class="s3">:</span>30<span class="s3">:</span>41<span class="s3"> PM</span></div>
<div class="p3">
<span class="s3"> </span>2. 6/21/08 9<span class="s3">:</span>30<span class="s3"> PM</span></div>
<div class="p3">
<span class="s3"> </span>3. <span class="s3">Jun </span>21, 2008 9<span class="s3">:</span>30<span class="s3"> PM</span></div>
<div class="p3">
<span class="s3"> </span>4. <span class="s3">June </span>21, 2008 9<span class="s3">:</span>30<span class="s3"> PM</span></div>
<div class="p1">
<span class="s1">5. </span>Saturday,<span class="s1"> </span>June <span class="s1">21, 2008 9</span>:<span class="s1">30</span> PM</div>
<div class="p3">
============================</div>
<div class="p3">
6. 6/21/08 9<span class="s3">:</span>30<span class="s3">:</span>41<span class="s3"> PM</span></div>
<div class="p3">
<span class="s3"> </span>7. <span class="s3">Jun </span>21, 2008 9<span class="s3">:</span>30<span class="s3">:</span>41<span class="s3"> PM</span></div>
<div class="p3">
<span class="s3"> </span>8. <span class="s3">June </span>21, 2008 9<span class="s3">:</span>30<span class="s3">:</span>41<span class="s3"> PM</span></div>
<div class="p1">
<span class="s1">9. </span>Saturday,<span class="s1"> </span>June <span class="s1">21, 2008 9</span>:<span class="s1">30</span>:<span class="s1">41</span> PM</div>
<div class="p3">
============================</div>
<div class="p3">
10. 6/21/08 9<span class="s3">:</span>30<span class="s3">:</span>41<span class="s3"> PM EDT</span></div>
<div class="p3">
<span class="s3"> </span>11. <span class="s3">Jun </span>21, 2008 9<span class="s3">:</span>30<span class="s3">:</span>41<span class="s3"> PM EDT</span></div>
<div class="p3">
<span class="s3"> </span>12. <span class="s3">June </span>21, 2008 9<span class="s3">:</span>30<span class="s3">:</span>41<span class="s3"> PM EDT</span></div>
<div class="p1">
<span class="s1">13. </span>Saturday,<span class="s1"> </span>June <span class="s1">21, 2008 9</span>:<span class="s1">30</span>:<span class="s1">41</span> PM EDT</div>
<div class="p3">
============================</div>
<div class="p3">
14. 6/21/08 9<span class="s3">:</span>30<span class="s3">:</span>41<span class="s3"> PM EDT</span></div>
<div class="p3">
<span class="s3"> </span>15. <span class="s3">Jun </span>21, 2008 9<span class="s3">:</span>30<span class="s3">:</span>41<span class="s3"> PM EDT</span></div>
<div class="p3">
<span class="s3"> </span>16. <span class="s3">June </span>21, 2008 9<span class="s3">:</span>30<span class="s3">:</span>41<span class="s3"> PM EDT</span></div>
<div class="p1">
<span class="s1">17. </span>Saturday,<span class="s1"> </span>June <span class="s1">21, 2008 9</span>:<span class="s1">30</span>:<span class="s1">41</span> PM EDT</div>
</div>
Unknownnoreply@blogger.comtag:blogger.com,1999:blog-3729659849536822047.post-58473401098567537162012-12-28T00:24:00.000+05:302012-12-28T00:24:07.146+05:30Send email in java<div dir="ltr" style="text-align: left;" trbidi="on">
<br />
<h3 style="text-align: left;">
<b>How to send email in java</b></h3>
<div>
<b><br /></b></div>
import java.util.Properties;<br />
<br />
import javax.mail.Message;<br />
import javax.mail.Session;<br />
import javax.mail.Transport;<br />
import javax.mail.internet.InternetAddress;<br />
import javax.mail.internet.MimeMessage;<br />
<br />
public class<br />
Mail<br />
{<br />
<br />
public static void main(String[] args) {<br />
String[] to = { "example@example.com" };<br />
String[] cc = { "example.example@example.com" };<br />
String[] bcc = { "example@example.com" };<br />
This is for google<br />
Mail.sendMail("example@example.com", "password", to, cc, bcc,<br />
"dont send spams",<br />
"dont send spams..");<br />
}<br />
<br />
public synchronized static boolean sendMail(String userName, String passWord, String[] to,<br />
String[] cc, String[] bcc, String subject, String text) {<br />
String starttls = "true";<br />
String auth = "true";<br />
String port="465";<br />
String host="smtp.gmail.com";<br />
String socketFactoryClass="javax.net.ssl.SSLSocketFactory";<br />
boolean debug=true;<br />
String fallback="false";<br />
<br />
Properties props = new Properties();<br />
// Properties props=System.getProperties();<br />
props.put("mail.smtp.user", userName);<br />
props.put("mail.smtp.host", host);<br />
if (!"".equals(port))<br />
props.put("mail.smtp.port", port);<br />
if (!"".equals(starttls))<br />
props.put("mail.smtp.starttls.enable", starttls);<br />
props.put("mail.smtp.auth", auth);<br />
if (debug) {<br />
props.put("mail.smtp.debug", "true");<br />
} else {<br />
props.put("mail.smtp.debug", "false");<br />
}<br />
if (!"".equals(port))<br />
props.put("mail.smtp.socketFactory.port", port);<br />
if (!"".equals(socketFactoryClass))<br />
props.put("mail.smtp.socketFactory.class", socketFactoryClass);<br />
if (!"".equals(fallback))<br />
props.put("mail.smtp.socketFactory.fallback", fallback);<br />
<br />
try {<br />
Session session = Session.getDefaultInstance(props, null);<br />
session.setDebug(debug);<br />
MimeMessage msg = new MimeMessage(session);<br />
msg.setText(text);<br />
msg.setSubject(subject);<br />
msg.setFrom(new InternetAddress("example@example.com"));<br />
for (int i = 0; i < to.length; i++) {<br />
msg.addRecipient(Message.RecipientType.TO, new InternetAddress(<br />
to[i]));<br />
}<br />
if (cc != null) {<br />
for (int i = 0; i < cc.length; i++) {<br />
msg.addRecipient(Message.RecipientType.CC,<br />
new InternetAddress(cc[i]));<br />
}<br />
}<br />
if (bcc != null) {<br />
for (int i = 0; i < bcc.length; i++) {<br />
msg.addRecipient(Message.RecipientType.BCC,<br />
new InternetAddress(bcc[i]));<br />
}<br />
}<br />
msg.saveChanges();<br />
Transport transport = session.getTransport("smtp");<br />
transport.connect(host, userName, passWord);<br />
transport.sendMessage(msg, msg.getAllRecipients());<br />
transport.close();<br />
return true;<br />
} catch (Exception mex) {<br />
mex.printStackTrace();<br />
return false;<br />
}<br />
}<br />
<br />
}<br />
<br /></div>
Unknownnoreply@blogger.comtag:blogger.com,1999:blog-3729659849536822047.post-38008351800710132692012-10-14T00:41:00.002+05:302012-10-14T00:51:47.185+05:30Create database and insert records in it for Android<div dir="ltr" style="text-align: left;" trbidi="on">
<br />
<br />
<div class="MsoNormal" style="background-color: white;">
<b><span style="color: #333333; font-family: "Verdana","sans-serif"; font-size: 10pt;">Create a Database</span></b><span style="color: #333333; font-family: "Segoe UI","sans-serif"; font-size: 12pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="background-color: white;">
<b><span style="color: #333333; font-family: "Verdana","sans-serif"; font-size: 10pt;"><br /></span></b></div>
<div class="MsoNormal" style="background-color: white;">
<span style="color: #333333; font-family: "Verdana","sans-serif"; font-size: 10pt;">Simple steps to create a database and handle are as following.</span><span style="color: #333333; font-family: "Segoe UI","sans-serif"; font-size: 12pt;"><o:p></o:p></span></div>
<ol start="1" type="1">
<li class="MsoNormal" style="background-color: white; color: #333333;"><span style="font-family: "Verdana","sans-serif"; font-size: 10pt;">Create "SQLiteDatabase" object.</span><span style="font-family: "Segoe UI","sans-serif"; font-size: 12pt;"><o:p></o:p></span></li>
<li class="MsoNormal" style="background-color: white; color: #333333;"><span style="font-family: "Verdana","sans-serif"; font-size: 10pt;">Open or Create database and create connection.</span><span style="font-family: "Segoe UI","sans-serif"; font-size: 12pt;"><o:p></o:p></span></li>
<li class="MsoNormal" style="background-color: white; color: #333333;"><span style="font-family: "Verdana","sans-serif"; font-size: 10pt;">Perform insert, update or delete operation.</span><span style="font-family: "Segoe UI","sans-serif"; font-size: 12pt;"><o:p></o:p></span></li>
<li class="MsoNormal" style="background-color: white; color: #333333;"><span style="font-family: "Verdana","sans-serif"; font-size: 10pt;">Create Cursor to display data from table of database.</span><span style="font-family: "Segoe UI","sans-serif"; font-size: 12pt;"><o:p></o:p></span></li>
<li class="MsoNormal" style="background-color: white; color: #333333;"><span style="font-family: "Verdana","sans-serif"; font-size: 10pt;">Close the database connectivity.</span><span style="font-family: "Segoe UI","sans-serif"; font-size: 12pt;"><o:p></o:p></span></li>
</ol>
<div class="MsoNormal">
<span style="background-color: white; color: #333333; font-family: Verdana, sans-serif; font-size: 10pt;">Following tutorial helps you to create database and insert records in it.<br /><br /><b>Step 1:</b></span><b style="background-color: white;"><span style="color: #333333; font-family: "Verdana","sans-serif"; font-size: 10pt;"> </span></b><span style="background-color: white; color: #333333; font-family: Verdana, sans-serif; font-size: 10pt;">Instantiate "SQLiteDatabase" object</span><span style="background-color: white;"><span style="font-family: Verdana, sans-serif; font-size: 10pt;">SQLiteDatabase</span><span style="font-family: Verdana, sans-serif; font-size: 10pt;"> </span><span style="color: #0000c0; font-family: Verdana, sans-serif; font-size: 10pt;">db</span><span style="font-family: Verdana, sans-serif; font-size: 10pt;">;</span><span style="color: #333333; font-family: 'Segoe UI', sans-serif; font-size: 12pt;"><o:p></o:p></span></span></div>
<div class="MsoNormal">
<span style="background-color: white;"><span style="color: #333333; font-family: Verdana, sans-serif; font-size: 10pt;">Before you can use the above object, you must import the </span><span style="font-family: Verdana, sans-serif; font-size: 10pt;">android.database.sqlite.SQLiteDatabase</span></span><span style="font-family: Verdana, sans-serif; font-size: 10pt;"><span style="background-color: white;">namespace in</span><span style="background-color: white;"> your application.</span></span><span style="background-color: white; font-family: Verdana, sans-serif; font-size: 10pt;"> </span><span style="background-color: white; font-family: Verdana, sans-serif; font-size: 10pt;"><br /></span><span style="background-color: white; color: #333333; font-family: 'Segoe UI', sans-serif; font-size: 12pt;"><o:p></o:p></span></div>
<div class="MsoNormal">
<span style="background-color: #cfe2f3;"><span style="color: #333333; font-family: Verdana, sans-serif; font-size: 10pt;">db=openOrCreateDatabase(String path,</span><span style="color: #333333; font-family: Verdana, sans-serif; font-size: 10pt;"> </span><span style="color: #333333; font-family: Verdana, sans-serif; font-size: 10pt;">int mode,</span><span style="color: #333333; font-family: Verdana, sans-serif; font-size: 10pt;"> </span></span><span style="color: #333333; font-family: Verdana, sans-serif; font-size: 10pt;"><span style="background-color: #cfe2f3;">SQLiteDatabase.CursorFactory factory)</span> </span><span style="background-color: white; color: #333333; font-family: Verdana, sans-serif; font-size: 10pt;"><br />This method is used to create/open database. As the name suggests, it will open a database connection if it is already there, otherwise it will create a new one.<br /><br />Example,<br /><br />db=openOrCreateDatabase("XYZ_Database",SQLiteDatabase.CREATE_IF_NECESSARY,null);<o:p></o:p></span></div>
<div class="MsoNormal" style="background-color: white;">
<br />
<br /></div>
<div class="MsoNormal">
<b style="background-color: white;"><span style="color: #333333; font-family: "Verdana","sans-serif"; font-size: 10pt;">Step 2:</span></b><b style="background-color: white;"><span style="color: #333333; font-family: "Verdana","sans-serif"; font-size: 10pt;"> </span></b><span style="color: #333333; font-family: Verdana, sans-serif; font-size: 10pt;"><span style="background-color: white;">Execute DDL command</span><br /><br /><span style="background-color: #cfe2f3;">db.execSQL(String sql) throws SQLException</span><br /><br /><span style="background-color: white;">This command is used to execute single SQL statement which doesn't return any data means other than SELECT or any other.</span><br /><br /><span style="background-color: white;">db.execSQL("Create Table Temp (id Integer, name Text)");</span><br /><br /><span style="background-color: white;">In the above example, it takes "CREATE TABLE" statement of SQL. This will create a table of "Integer" & "Text" fields.</span><br /><br /><span style="background-color: white;">Try and Catch block is require while performing this operation. An exception that indicates there was an error with SQL parsing or execution.</span><br /><br /><b style="background-color: white;">Step 3:</b></span><span style="background-color: white; color: #333333; font-family: Verdana, sans-serif; font-size: 10pt;"> </span><span style="background-color: white; color: #333333; font-family: Verdana, sans-serif; font-size: 10pt;">Create object of "ContentValues" and Initiate it.</span><span style="background-color: #cfe2f3;"><span style="font-family: Verdana, sans-serif; font-size: 10pt;">ContentValues values=</span><b><span style="color: #7f0055; font-family: Verdana, sans-serif; font-size: 10pt;">new</span></b><span style="font-family: Verdana, sans-serif; font-size: 10pt;"> </span><span style="font-family: Verdana, sans-serif; font-size: 10pt;">ContentValues();</span></span><span style="background-color: white; color: #333333; font-family: Verdana, sans-serif; font-size: 10pt;"><br /><br />This class is used to store a set of values. We can also say, it will map ColumnName and relavent ColumnValue.</span><span style="background-color: silver; font-family: Verdana, sans-serif; font-size: 10pt;">values.put(</span><span style="background-color: silver; color: #2a00ff; font-family: Verdana, sans-serif; font-size: 10pt;">"id"</span><span style="background-color: silver; font-family: Verdana, sans-serif; font-size: 10pt;">,</span><span style="background-color: white; font-family: Verdana, sans-serif; font-size: 10pt;"> </span><span style="background-color: silver; color: #0000c0; font-family: Verdana, sans-serif; font-size: 10pt;">eid</span><span style="background-color: silver; font-family: Verdana, sans-serif; font-size: 10pt;">.getText().toString());</span><span style="background-color: white; font-family: Verdana, sans-serif; font-size: 10pt;"> </span><span style="background-color: white; font-family: Verdana, sans-serif; font-size: 10pt;"> </span><span style="background-color: white; font-family: Verdana, sans-serif; font-size: 10pt;"><br /><span style="background-color: silver; background-position: initial initial; background-repeat: initial initial;">values.put(</span></span><span style="background-color: silver; color: #2a00ff; font-family: Verdana, sans-serif; font-size: 10pt;">"name"</span><span style="background-color: silver; font-family: Verdana, sans-serif; font-size: 10pt;">,</span><span style="background-color: white; font-family: Verdana, sans-serif; font-size: 10pt;"> </span><span style="background-color: silver; color: #0000c0; font-family: Verdana, sans-serif; font-size: 10pt;">ename</span><span style="background-color: silver; font-family: Verdana, sans-serif; font-size: 10pt;">.getText().toString());</span><span style="background-color: white; color: #333333; font-family: Verdana, sans-serif; font-size: 10pt;"> </span><span style="background-color: white; color: #333333; font-family: 'Segoe UI', sans-serif; font-size: 12pt;"><o:p></o:p></span></div>
<table border="1" cellpadding="0" cellspacing="0" class="MsoNormalTable" style="background-color: silver; border-collapse: collapse; width: 500px;"><tbody>
<tr><td style="border: 1pt solid black; padding: 0in 5.4pt; width: 87.25pt;" valign="top" width="116"><div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="font-family: "Verdana","sans-serif"; font-size: 10pt;">String Key</span><span style="font-family: "Times New Roman","serif"; font-size: 12pt;"><o:p></o:p></span></div>
</td><td style="border: 1pt solid black; padding: 0in 5.4pt; width: 287.75pt;" valign="top" width="384"><div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="font-family: "Verdana","sans-serif"; font-size: 10pt;">Name of field as in table. Ex. "id", "name"</span><span style="font-family: "Times New Roman","serif"; font-size: 12pt;"><o:p></o:p></span></div>
</td></tr>
<tr><td style="border: 1pt solid black; padding: 0in 5.4pt; width: 87.25pt;" valign="top" width="116"><div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="font-family: "Verdana","sans-serif"; font-size: 10pt;">String Value</span><span style="font-family: "Times New Roman","serif"; font-size: 12pt;"><o:p></o:p></span></div>
</td><td style="border-bottom-color: black; border-bottom-width: 1pt; border-right-color: black; border-right-width: 1pt; border-style: none solid solid none; padding: 0in 5.4pt; width: 287.75pt;" valign="top" width="384"><div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="font-family: "Verdana","sans-serif"; font-size: 10pt;">Value to be inserted.</span><span style="font-family: "Times New Roman","serif"; font-size: 12pt;"><o:p></o:p></span></div>
</td></tr>
</tbody></table>
<div class="MsoNormal">
<b style="background-color: white;"><span style="color: #333333; font-family: "Verdana","sans-serif"; font-size: 10pt;">Step 4:</span></b><b style="background-color: white;"><span style="color: #333333; font-family: "Verdana","sans-serif"; font-size: 10pt;"> </span></b><span style="background-color: white; color: #333333; font-family: Verdana, sans-serif; font-size: 10pt;">Perform Insert Statement.</span><span style="background-color: #cfe2f3;"><span style="font-family: Verdana, sans-serif; font-size: 10pt;">insert(</span><span style="color: blue; font-family: Verdana, sans-serif; font-size: 10pt;">String</span><span style="font-family: Verdana, sans-serif; font-size: 10pt;"> </span><span style="font-family: Verdana, sans-serif; font-size: 10pt;">table,</span><span style="font-family: Verdana, sans-serif; font-size: 10pt;"> </span><span style="color: blue; font-family: Verdana, sans-serif; font-size: 10pt;">String</span><span style="font-family: Verdana, sans-serif; font-size: 10pt;"> </span><span style="font-family: Verdana, sans-serif; font-size: 10pt;">nullColumnHack,</span><span style="font-family: Verdana, sans-serif; font-size: 10pt;"> </span><span style="color: blue; font-family: Verdana, sans-serif; font-size: 10pt;">ContentValues</span><span style="font-family: Verdana, sans-serif; font-size: 10pt;"> </span><span style="font-family: Verdana, sans-serif; font-size: 10pt;">values)</span></span><span style="background-color: white; color: #333333; font-family: 'Segoe UI', sans-serif; font-size: 12pt;"><o:p></o:p></span></div>
<table border="1" cellpadding="0" cellspacing="0" class="MsoNormalTable" style="background-color: silver; border-collapse: collapse; width: 500px;"><tbody>
<tr><td style="border: 1pt solid black; padding: 0in 5.4pt; width: 1.45in;" valign="top" width="139"><div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="font-family: "Verdana","sans-serif"; font-size: 10pt;">String table</span><span style="font-family: "Times New Roman","serif"; font-size: 12pt;"><o:p></o:p></span></div>
</td><td style="border: 1pt solid black; padding: 0in 5.4pt; width: 5.2in;" valign="top" width="499"><div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="font-family: "Verdana","sans-serif"; font-size: 10pt;">Name of table related to database.</span><span style="font-family: "Times New Roman","serif"; font-size: 12pt;"><o:p></o:p></span></div>
</td></tr>
<tr><td style="border: 1pt solid black; padding: 0in 5.4pt; width: 1.45in;" valign="top" width="139"><div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="font-family: "Verdana","sans-serif"; font-size: 10pt;">String nullColumnHack</span><span style="font-family: "Times New Roman","serif"; font-size: 12pt;"><o:p></o:p></span></div>
</td><td style="border-bottom-color: black; border-bottom-width: 1pt; border-right-color: black; border-right-width: 1pt; border-style: none solid solid none; padding: 0in 5.4pt; width: 5.2in;" valign="top" width="499"><div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="font-family: "Verdana","sans-serif"; font-size: 10pt;">If not set to null, the</span><span style="font-family: "Verdana","sans-serif"; font-size: 10pt;"> </span><span style="font-family: "Verdana","sans-serif"; font-size: 10pt;">nullColumnHack</span><span style="font-family: "Verdana","sans-serif"; font-size: 10pt;"> </span><span style="font-family: "Verdana","sans-serif"; font-size: 10pt;">parameter provides the name of nullable column name to explicitly insert a NULL into in the case where your</span><i><span style="font-family: "Verdana","sans-serif"; font-size: 10pt;">values</span></i><span style="font-family: "Verdana","sans-serif"; font-size: 10pt;"> </span><span style="font-family: "Verdana","sans-serif"; font-size: 10pt;">is empty.</span><span style="font-family: "Times New Roman","serif"; font-size: 12pt;"><o:p></o:p></span></div>
</td></tr>
<tr><td style="border: 1pt solid black; padding: 0in 5.4pt; width: 1.45in;" valign="top" width="139"><div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="font-family: "Verdana","sans-serif"; font-size: 10pt;">ContentValues values</span><span style="font-family: "Times New Roman","serif"; font-size: 12pt;"><o:p></o:p></span></div>
</td><td style="border-bottom-color: black; border-bottom-width: 1pt; border-right-color: black; border-right-width: 1pt; border-style: none solid solid none; padding: 0in 5.4pt; width: 5.2in;" valign="top" width="499"><div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="font-family: "Verdana","sans-serif"; font-size: 10pt;">This map contains the initial column values for the row.</span><span style="font-family: "Times New Roman","serif"; font-size: 12pt;"><o:p></o:p></span></div>
</td></tr>
</tbody></table>
<div class="MsoNormal" style="margin-bottom: 6pt;">
<span style="background-color: white; color: #333333; font-family: Verdana, sans-serif; font-size: 10pt;">This method returns a long. The row ID of the newly inserted row, or -1 if an error occurred.<br /><br />Example,</span><span style="background-color: #cfe2f3;"><span style="color: #0000c0; font-family: Verdana, sans-serif; font-size: 10pt;">db</span><span style="font-family: Verdana, sans-serif; font-size: 10pt;">.insert(</span><span style="color: #2a00ff; font-family: Verdana, sans-serif; font-size: 10pt;">"temp"</span><span style="font-family: Verdana, sans-serif; font-size: 10pt;">,</span><span style="font-family: Verdana, sans-serif; font-size: 10pt;"> </span><b><span style="color: #7f0055; font-family: Verdana, sans-serif; font-size: 10pt;">null</span></b><span style="font-family: Verdana, sans-serif; font-size: 10pt;">, values);</span></span><span style="color: #333333; font-family: Verdana, sans-serif; font-size: 10pt;"><span style="background-color: #cfe2f3;"><br /></span><br /><b style="background-color: white;">Step 5:</b></span><span style="background-color: white; color: #333333; font-family: Verdana, sans-serif; font-size: 10pt;"> </span><span style="background-color: white; color: #333333; font-family: Verdana, sans-serif; font-size: 10pt;">Create Cursor<br /><br />This interface provides random read-write access to the result set returned by a database query.</span><span style="background-color: #cfe2f3;"><span style="font-family: Verdana, sans-serif; font-size: 10pt;">Cursor c=</span><span style="color: #0000c0; font-family: Verdana, sans-serif; font-size: 10pt;">db</span><span style="font-family: Verdana, sans-serif; font-size: 10pt;">.rawQuery(</span><span style="color: #333333; font-family: Verdana, sans-serif; font-size: 10pt;">String</span><span style="color: #333333; font-family: Verdana, sans-serif; font-size: 10pt;"> </span><span style="color: #333333; font-family: Verdana, sans-serif; font-size: 10pt;">sql, String[] selectionArgs</span></span><span style="font-family: Verdana, sans-serif; font-size: 10pt;"><span style="background-color: #cfe2f3;">)</span></span><br />
<span style="font-family: Verdana, sans-serif; font-size: 10pt;"><span style="background-color: #cfe2f3;"><br /></span></span>
<span style="font-family: Verdana, sans-serif; font-size: 10pt;"><span style="background-color: #cfe2f3;"><br /></span></span></div>
<table border="1" cellpadding="0" cellspacing="0" class="MsoNormalTable" style="background-color: silver; border-collapse: collapse; width: 500px;"><tbody>
<tr><td style="border: 1pt solid black; padding: 0in 5.4pt; width: 1.7in;" valign="top" width="163"><div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="font-family: "Verdana","sans-serif"; font-size: 10pt;">Strign sql</span><span style="font-family: "Times New Roman","serif"; font-size: 12pt;"><o:p></o:p></span></div>
</td><td style="border: 1pt solid black; padding: 0in 5.4pt; width: 4.95in;" valign="top" width="475"><div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="font-family: "Verdana","sans-serif"; font-size: 10pt;">The SQL query</span><span style="font-family: "Times New Roman","serif"; font-size: 12pt;"><o:p></o:p></span></div>
</td></tr>
<tr><td style="border: 1pt solid black; padding: 0in 5.4pt; width: 1.7in;" valign="top" width="163"><div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="font-family: "Verdana","sans-serif"; font-size: 10pt;">String []selectionArgs</span><span style="font-family: "Times New Roman","serif"; font-size: 12pt;"><o:p></o:p></span></div>
</td><td style="border-bottom-color: black; border-bottom-width: 1pt; border-right-color: black; border-right-width: 1pt; border-style: none solid solid none; padding: 0in 5.4pt; width: 4.95in;" valign="top" width="475"><div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="font-family: "Verdana","sans-serif"; font-size: 10pt;">You may include ?s in where clause in the query, which will be replaced by the values from selectionArgs. The values will be bound as Strings.</span><span style="font-family: "Times New Roman","serif"; font-size: 12pt;"><o:p></o:p></span></div>
</td></tr>
</tbody></table>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="background-color: white; color: #333333; font-family: Verdana, sans-serif; font-size: 10pt;">Example,</span><span style="background-color: #cfe2f3;"><span style="font-family: Verdana, sans-serif; font-size: 10pt;">Cursor c=</span><span style="color: #0000c0; font-family: Verdana, sans-serif; font-size: 10pt;">db</span><span style="font-family: Verdana, sans-serif; font-size: 10pt;">.rawQuery(</span><span style="color: #2a00ff; font-family: Verdana, sans-serif; font-size: 10pt;">"SELECT</span><span style="color: #2a00ff; font-family: Verdana, sans-serif; font-size: 10pt;"> </span><span style="color: #2a00ff; font-family: Verdana, sans-serif; font-size: 10pt;">* FROM temp"</span><span style="font-family: Verdana, sans-serif; font-size: 10pt;">,</span><b><span style="color: #7f0055; font-family: Verdana, sans-serif; font-size: 10pt;">null</span></b><span style="font-family: Verdana, sans-serif; font-size: 10pt;">);</span></span><span style="background-color: white; color: #333333; font-family: Verdana, sans-serif; font-size: 10pt;"><br /><br />Methods<br /> </span><span style="background-color: white; color: #333333; font-family: 'Segoe UI', sans-serif; font-size: 12pt;"><o:p></o:p></span></div>
<table border="1" cellpadding="0" cellspacing="0" class="MsoNormalTable" style="background-color: silver; border-collapse: collapse; width: 500px;"><tbody>
<tr><td style="border: 1pt solid black; padding: 0in 5.4pt; width: 126.9pt;" valign="top" width="169"><div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="font-family: "Verdana","sans-serif"; font-size: 10pt;">moveToFirst</span><span style="font-family: "Times New Roman","serif"; font-size: 12pt;"><o:p></o:p></span></div>
</td><td style="border: 1pt solid black; padding: 0in 5.4pt; width: 351.9pt;" valign="top" width="469"><div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="font-family: "Verdana","sans-serif"; font-size: 10pt;">Moves cursor pointer at first position of result set</span><span style="font-family: "Times New Roman","serif"; font-size: 12pt;"><o:p></o:p></span></div>
</td></tr>
<tr><td style="border: 1pt solid black; padding: 0in 5.4pt; width: 126.9pt;" valign="top" width="169"><div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="font-family: "Verdana","sans-serif"; font-size: 10pt;">moveToNext</span><span style="font-family: "Times New Roman","serif"; font-size: 12pt;"><o:p></o:p></span></div>
</td><td style="border-bottom-color: black; border-bottom-width: 1pt; border-right-color: black; border-right-width: 1pt; border-style: none solid solid none; padding: 0in 5.4pt; width: 351.9pt;" valign="top" width="469"><div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="font-family: "Verdana","sans-serif"; font-size: 10pt;">Moves cursor pointer next to current position.</span><span style="font-family: "Times New Roman","serif"; font-size: 12pt;"><o:p></o:p></span></div>
</td></tr>
<tr><td style="border: 1pt solid black; padding: 0in 5.4pt; width: 126.9pt;" valign="top" width="169"><div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="font-family: "Verdana","sans-serif"; font-size: 10pt;">isAfterLast</span><span style="font-family: "Times New Roman","serif"; font-size: 12pt;"><o:p></o:p></span></div>
</td><td style="border-bottom-color: black; border-bottom-width: 1pt; border-right-color: black; border-right-width: 1pt; border-style: none solid solid none; padding: 0in 5.4pt; width: 351.9pt;" valign="top" width="469"><div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="font-family: "Verdana","sans-serif"; font-size: 10pt;">Returs false, if cursor pointer is not at last position of result set.</span><span style="font-family: "Times New Roman","serif"; font-size: 12pt;"><o:p></o:p></span></div>
</td></tr>
</tbody></table>
<div class="MsoNormal" style="background-color: white; margin-bottom: 0.0001pt;">
<span style="color: #333333; font-family: "Verdana","sans-serif"; font-size: 10pt;"><br /></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="background-color: white; color: #333333; font-family: Verdana, sans-serif; font-size: 10pt;">Example,</span><span style="background-color: #cfe2f3;"><span style="font-family: Verdana, sans-serif; font-size: 10pt;">c.moveToFirst();</span><b><span style="color: #7f0055; font-family: Verdana, sans-serif; font-size: 10pt;">while</span></b><span style="font-family: Verdana, sans-serif; font-size: 10pt;">(!c.isAfterLast())<br />{<br /> //statement…<br />c.moveToNext();<br />}</span></span><span style="background-color: white; color: #333333; font-family: Verdana, sans-serif; font-size: 10pt;"><br /><br /><b>Step 6:</b></span><span style="background-color: white; color: #333333; font-family: Verdana, sans-serif; font-size: 10pt;"> </span><span style="background-color: white; color: #333333; font-family: Verdana, sans-serif; font-size: 10pt;">Close Cursor and Close Database connectivity<br /><br />It is very important to release our connections before closing our activity. It is advisable to release the Database connectivity in "onStop" method. And Cursor connectivity after use it.</span></div>
</div>
Unknownnoreply@blogger.comtag:blogger.com,1999:blog-3729659849536822047.post-16151112317262856052012-10-14T00:29:00.000+05:302012-10-14T00:29:45.361+05:30Introduction to SQLite Database for Android<div dir="ltr" style="text-align: left;" trbidi="on">
<br />
<div class="MsoNormal" style="margin-bottom: .0001pt; margin-bottom: 0in; mso-line-height-alt: 15.6pt; mso-outline-level: 3; vertical-align: baseline;">
<b><span style="color: #333333; font-family: "Arial","sans-serif"; font-size: 18.0pt; mso-fareast-font-family: "Times New Roman";">Now move to Data base .. <o:p></o:p></span></b></div>
<div class="MsoNormal" style="margin-bottom: .0001pt; margin-bottom: 0in; mso-line-height-alt: 15.6pt; mso-outline-level: 3; vertical-align: baseline;">
<b><span style="color: #333333; font-family: "Arial","sans-serif"; font-size: 18.0pt; mso-fareast-font-family: "Times New Roman";">we use SQLite for take access on data.<o:p></o:p></span></b></div>
<div class="MsoNormal" style="margin-bottom: .0001pt; margin-bottom: 0in; mso-line-height-alt: 15.6pt; mso-outline-level: 3; vertical-align: baseline;">
<br /></div>
<div class="MsoNormal" style="line-height: 15.6pt; margin-bottom: .0001pt; margin-bottom: 0in; mso-outline-level: 3; vertical-align: baseline;">
<br /></div>
<div class="MsoNormal" style="background-color: white; background-position: initial initial; background-repeat: initial initial;">
<b><span style="color: #333333; font-family: "Verdana","sans-serif"; font-size: 10.0pt; mso-bidi-font-family: "Segoe UI"; mso-fareast-font-family: "Times New Roman";">Introduction</span></b><span style="color: #333333; font-family: "Segoe UI","sans-serif"; font-size: 12.0pt; mso-fareast-font-family: "Times New Roman";"><o:p></o:p></span></div>
<div class="MsoNormal" style="background-color: white; background-position: initial initial; background-repeat: initial initial;">
<b><span style="color: #333333; font-family: "Verdana","sans-serif"; font-size: 10.0pt; mso-bidi-font-family: "Segoe UI"; mso-fareast-font-family: "Times New Roman";"><br /></span></b></div>
<div class="MsoNormal" style="background-color: white; background-position: initial initial; background-repeat: initial initial;">
<span style="color: #333333; font-family: "Verdana","sans-serif"; font-size: 10.0pt; mso-bidi-font-family: "Segoe UI"; mso-fareast-font-family: "Times New Roman";">In this article, we will see how to create a SQLite
database in an Android application. We will also see how to add records to the
database and read and display in an application.</span><span style="color: #333333; font-family: "Segoe UI","sans-serif"; font-size: 12.0pt; mso-fareast-font-family: "Times New Roman";"><o:p></o:p></span></div>
<div class="MsoNormal" style="background-color: white; background-position: initial initial; background-repeat: initial initial;">
<span style="color: #333333; font-family: "Verdana","sans-serif"; font-size: 10.0pt; mso-bidi-font-family: "Segoe UI"; mso-fareast-font-family: "Times New Roman";"><br /></span></div>
<div class="MsoNormal" style="background-color: white; background-position: initial initial; background-repeat: initial initial;">
<span style="color: #333333; font-family: "Verdana","sans-serif"; font-size: 10.0pt; mso-bidi-font-family: "Segoe UI"; mso-fareast-font-family: "Times New Roman";"><br /></span></div>
<div class="MsoNormal" style="background-color: white; background-position: initial initial; background-repeat: initial initial;">
</div>
<div class="MsoNormal" style="background-position: initial initial; background-repeat: initial initial;">
<b><span style="color: #333333; font-family: "Verdana","sans-serif"; font-size: 10.0pt; mso-bidi-font-family: "Segoe UI"; mso-fareast-font-family: "Times New Roman";">SQLiteDatabase</span></b><span style="color: #333333; font-family: "Segoe UI","sans-serif"; font-size: 12.0pt; mso-fareast-font-family: "Times New Roman";"><o:p></o:p></span></div>
<div class="MsoNormal" style="background-position: initial initial; background-repeat: initial initial;">
<span style="color: #333333; font-family: "Verdana","sans-serif"; font-size: 10.0pt; mso-bidi-font-family: "Segoe UI"; mso-fareast-font-family: "Times New Roman";"><br /></span></div>
<div class="MsoNormal" style="background-position: initial initial; background-repeat: initial initial;">
<span style="color: #333333; font-family: "Verdana","sans-serif"; font-size: 10.0pt; mso-bidi-font-family: "Segoe UI"; mso-fareast-font-family: "Times New Roman";">In Android, the SQLiteDatabase namespace defines the
functionality to connect and manage a database. It provides functionality to
create, delete, manage and display database content.</span><span style="color: #333333; font-family: "Verdana","sans-serif"; font-size: 10.0pt; mso-bidi-font-family: "Segoe UI"; mso-bidi-font-size: 11.0pt; mso-fareast-font-family: "Times New Roman";"> </span><span style="color: #333333; font-family: "Segoe UI","sans-serif"; font-size: 12.0pt; mso-fareast-font-family: "Times New Roman";"><o:p></o:p></span></div>
<div class="MsoNormal" style="background-position: initial initial; background-repeat: initial initial;">
<b><span style="color: #333333; font-family: "Verdana","sans-serif"; font-size: 10.0pt; mso-bidi-font-family: "Segoe UI"; mso-fareast-font-family: "Times New Roman";"><br /></span></b></div>
<div class="MsoNormal" style="background-position: initial initial; background-repeat: initial initial;">
<b><span style="color: #333333; font-family: "Verdana","sans-serif"; font-size: 10.0pt; mso-bidi-font-family: "Segoe UI"; mso-fareast-font-family: "Times New Roman";">Create a Database</span></b><span style="color: #333333; font-family: "Segoe UI","sans-serif"; font-size: 12.0pt; mso-fareast-font-family: "Times New Roman";"><o:p></o:p></span></div>
<div class="MsoNormal" style="background-position: initial initial; background-repeat: initial initial;">
<span style="color: #333333; font-family: "Verdana","sans-serif"; font-size: 10.0pt; mso-bidi-font-family: "Segoe UI"; mso-fareast-font-family: "Times New Roman";"><br /></span></div>
<div class="MsoNormal" style="background-position: initial initial; background-repeat: initial initial;">
<span style="color: #333333; font-family: "Verdana","sans-serif"; font-size: 10.0pt; mso-bidi-font-family: "Segoe UI"; mso-fareast-font-family: "Times New Roman";">Simple steps to create a database and handle are as
following.</span><span style="color: #333333; font-family: "Segoe UI","sans-serif"; font-size: 12.0pt; mso-fareast-font-family: "Times New Roman";"><o:p></o:p></span></div>
<ol start="1" type="1">
<li class="MsoNormal" style="background-position: initial initial; background-repeat: initial initial; color: #333333;"><span style="font-family: "Verdana","sans-serif"; font-size: 10.0pt; mso-bidi-font-family: "Segoe UI"; mso-fareast-font-family: "Times New Roman";">Create
"SQLiteDatabase" object.</span><span style="font-family: "Segoe UI","sans-serif"; font-size: 12.0pt; mso-fareast-font-family: "Times New Roman";"><o:p></o:p></span></li>
<li class="MsoNormal" style="background-position: initial initial; background-repeat: initial initial; color: #333333;"><span style="font-family: "Verdana","sans-serif"; font-size: 10.0pt; mso-bidi-font-family: "Segoe UI"; mso-fareast-font-family: "Times New Roman";">Open
or Create database and create connection.</span><span style="font-family: "Segoe UI","sans-serif"; font-size: 12.0pt; mso-fareast-font-family: "Times New Roman";"><o:p></o:p></span></li>
<li class="MsoNormal" style="background-position: initial initial; background-repeat: initial initial; color: #333333;"><span style="font-family: "Verdana","sans-serif"; font-size: 10.0pt; mso-bidi-font-family: "Segoe UI"; mso-fareast-font-family: "Times New Roman";">Perform
insert, update or delete operation.</span><span style="font-family: "Segoe UI","sans-serif"; font-size: 12.0pt; mso-fareast-font-family: "Times New Roman";"><o:p></o:p></span></li>
<li class="MsoNormal" style="background-position: initial initial; background-repeat: initial initial; color: #333333;"><span style="font-family: "Verdana","sans-serif"; font-size: 10.0pt; mso-bidi-font-family: "Segoe UI"; mso-fareast-font-family: "Times New Roman";">Create
Cursor to display data from table of database.</span><span style="font-family: "Segoe UI","sans-serif"; font-size: 12.0pt; mso-fareast-font-family: "Times New Roman";"><o:p></o:p></span></li>
<li class="MsoNormal" style="background-position: initial initial; background-repeat: initial initial; color: #333333;"><span style="font-family: "Verdana","sans-serif"; font-size: 10.0pt; mso-bidi-font-family: "Segoe UI"; mso-fareast-font-family: "Times New Roman";">Close
the database connectivity.</span><span style="font-family: "Segoe UI","sans-serif"; font-size: 12.0pt; mso-fareast-font-family: "Times New Roman";"><o:p></o:p></span></li>
</ol>
<br />
</div>
Unknownnoreply@blogger.comtag:blogger.com,1999:blog-3729659849536822047.post-76553980571206709162012-10-14T00:15:00.001+05:302012-10-14T00:24:43.342+05:30Getting stated with Android create new project with screen short<div dir="ltr" style="text-align: left;" trbidi="on">
Create new project in Eclipse for Android</div>
Unknownnoreply@blogger.com