Friday, March 22, 2013

Latest image iPhone6

visit: http://gadgets.feedbox.info/wyncase-turn-the-iphone-into-a-true-mobile-gaming-console?utm_medium=teaser&utm_source=mgid&utm_term=1323&utm_campaign=exchange&utm_content=1442419#332

Top 40 Women in Tech Was Supposed to Focus on Their Beautiful Insides


Technology has been a boy's club for most of its existence. Just another unfortunate repercussion of the patriarchy. But that's been slowly changing, and over the last decade we've seen a number of wonderful, intelligent, and cunning women make inspiring strides in the field of technology. Through web development, social media, space exploration, and video game design, we see the world of tech becoming a more equal playing field. 
So what happened next? Sonic boom. All sorts of women who make you go "Awoooga!" [open mouth, tongue unrolls] were included in this roundup—New York Times writer Jenna Wortham, Lifehacker founder Gina Trapani, Boing Boing blogger Xeni Jardin—and it's fair to say that most of them did not take kindly to the, uh, honor:
Source: http://gawker.com/5991978/top-40-hottest-women-in-tech-was-supposed-to-focus-on-their-beautiful-insides

City cops raid office of corporate in Chennai over ‘IPR violation’


A raid on the offices of Sundaram BNP Paribas Home Finance and Sundaram Infotech Solutions in Chennai were conducted by a team from the Mumbai Police's cyber cell a week ago as part of an ongoing investigation into allegations of software hacking and re-engineering with larger implications for Intellectual Property Rights (IPR) infringement disputes.
The raid took place at Chennai's White Road premises of Sundaram BNP Paribas HF and Sundaram Infotech Solutions on March 3.
"We went ahead with the raids once the Madras High Court gave an order in our favour. Computers and hard disks have been seized," said Additional Commissioner of Police (Crime) Niket Kaushik.
The case pertains to an FIR registered in 2010 with the Mumbai Police's Cyber Cell, after Virendra Singh, the owner of a software company, Kensoft Infotech Ltd, alleged that Sundaram BNP Paribas HF, its MD Srinivas Acharya and four senior management hacked, reverse engineered and tampered with a software developed by the firm, thus committing an IPR fraud.
A 1992 home finance software — KEN-HFS — designed and developed by Kensoft, was supplied to Sundaram BNP Paribas on a user licence for seven years. Singh claimed that Sundaram BNP Paribas HF tampered with the software in 2008. To a query he asked, he was told in a "cold email" in December 2008 that Sundaram was the new owner of the code as they had developed the product.
With the matter initially "studied and researched" by IIT-Bombay faculty, the Mumbai Police Crime branch began probing the criminal angle in 2011. After studying the report prepared by two IIT-Bombay professors, Mumbai Police Crime Branch had been trying to take the mirror images of the sever in Chennai since 2011, said senior officials.
In August 2011, the company challenged the territorial and subject jurisdiction of the Mumbai Crime Branch to register an FIR and probe the matter. On January 22, the Madras High Court dismissed the company's appeal to quash the FIR and gave a verdict in favour of Mumbai Crime Branch and Crime Branch's Cyber Cell, both of whom were respondents in the case. The judgment states that the Mumbai Crime Branch has a statutory right to probe the matter and no one can intervene and take that away.
"The raid is a big move. It also gains significance as big companies are usually careful in subjects like IPR," said Karuna Jain, co-ordinator, IPR Cell, Professor of Technology and Operations Management, SJMSOM, IIT Bombay. Jain was involved in studying the Intellecutal Property legalities. "We studied it in detail at IIT and were convinced that a fraud had been committed." Jain's report is one of the documents the Mumbai Crime Branch relied upon.
"I usually do not consult IT companies and look only into matters involving the end-user. In this case, I took a different view as this case was important," said Professor D B Phatak, head of Kanwal Rekhi School of Information Technology, IIT Bombay. Phatak even visited the office of Sundaram Paribas to apprise them of their alleged mistake early in 2010.
"I have read the legal papers. The code was licensed to them for seven years. They used for that long and when the time to renew it came, they called it their own. This case is important for many reasons, mostly for the manner in which Kensoft is fighting against a big corporate," said Jain.
A NASSCOM official helping the Mumbai Police said, "The delay that the corporate has shown in co-operating with police is a sign that they have a role to play."
"This case also points at how the IP agreements can be interpreted. Kensoft's papers were perfect, still the company misinterpreted the words claiming that it is their product. We handle big corporates on a regular basis and now advise them that words like turnkey and others are not to be misinterpreted. The probe will set a precedent in such matters," said R M Sonar, associate professor of Information from IIT Bombay (currently on lien to his company Iken Solutions).
A spokesperson from Sundaram Infotech said, "While dismissing our appeal questioning the jurisdiction of Mumbai Police, Madras High Court directed Mumbai Police to appoint another investigating officer to go into the case afresh. They have since appointed another investigating officer, who visited our office and recorded the statements of our officials. We have also given them copies of the softwares for forensic test to establish whether the new software is a copy of the old one. We have given them enough documents to support our case. The documents include report of Anna University certifying that the new software is not a copy."
"The complainant deliberately did not file the report of Anna University, a copy of which was available with them while filing complaint. They misled the police by filing only a copy of report of professors of IIT Bombay given in their individual capacity. IIT Bombay have confirmed that they do not give such reports officially. The IIT Bombay professors gave the report without visiting Chennai to look at the softwares. Their opinion is based on the information provided by the complainant," the spokesperson added.
"There is no way the IIT professors at Mumbai could have had access to the new software. The company officials will visit Mumbai next week to record their statements", the spokesperson said.
Source: http://www.indianexpress.com/news/city-cops-raid-office-of-corporate-in-chennai-over--ipr-violation-/1086190/4


Cyberwar and internationalhumanitarian law


Cyberwar and internationalhumanitarian law 

Hostile states, non-state actors and individuals have not only taken to the internet as a means of expressing themselves, but have also created a hotbed of conflict. Whilst Public International Law does not have any mechanism in place to handle cyberattacks, International Humanitarian Law may provide some important answers. 

What are the principles of conflict transformation?

By Kirthi Jayakumar
The word ‘war’ invariably prompts images of a battlefront – guns pointed at the ready, men in uniform standing with grim expressions, tanks, bombs, grenades, trenches,  death and destruction. While this sounds like a ubiquitous form of war – common throughout much of history – war itself has evolved with technology; not simply the weaponry and artillery of war, but the very battlefield itself. For there now exists a bloodless, weapon-less hub of warfare: the Internet.
States face a very real threat in the form of cyberattacks. With the world increasingly dependent on computers and computer networks at every level, and paperwork increasingly going digital, war has also shifted to the realm of cyberspace. Hostile states, non-state actors and individuals have not only taken to the internet as a means of expressing themselves, but have also created a hotbed of conflict. These entities have targeted the computer systems and databases of their ‘enemy’ countries, hacking into information for a variety of reasons. From Estonia in 2007 to Georgia the very next year – and, most recently, in 2010 in Iran – cyberattacks are definitely here to stay.
Cyberattacks are of many different kinds. While on the one hand they can cause physical damage that can be likened to that emanating from conventional weapons, it can also destroy a state’s operating systems – threatening aircraft/spacecraft and even nuclear power plants. Cyber attacks can single-handedly stultify websites and the functioning capacities of databases, which remain vulnerable to manipulation, thereby potentially damaging a country’s financial or military defence system. Cyberattacks need not necessarily have physical effects, although physical effects can stem as a consequence of the attack itself.
As things now stand, Public International Law (PIL) does not have any mechanism in place to handle cyberattacks. Save for Article 2(4) of the UN Charter and customary norms that prohibit the use of force, no legal rules prohibit anything besides armed force. Article 51 of the UN Charter permits self-defence only against an armed attack. Doubtless, therefore, cyberattacks fall through the holes in the net, as no one uses arms in a cyberattack (physically destroying computers don’t count.)
With cyberattacks falling beyond the ambit of Article 2(4) and Article 51 of the UN Charter, one must turn to International Humanitarian Law (IHL). Built on the principles of jus ad bellum, much of the content of IHL deals with a time when the world was faced by a massive force comprised of weapons and destructive anti-humanist policies. Consequently, the scope and ambit of IHL has been confined largely to grave armed attacks and the commission of what are now understood to be war crimes.
Cyberwar can significantly challenge many aspects of IHL – particularly the questions of distinction, proportionality, civilian protection, civilian objectives and the like. There is also an element of difficulty in estimating the very occurrence of ‘cyberwar’ in that there are huge variances in battlefield dynamics. Cyberwar does not create refugees, nor are there civilians and health personnel on field that need to be segregated from armed or enemy combatants in the strictest sense of the term. The Geneva Conventions and their Additional Protocols do not mention anything about cyber warfare.
Nevertheless, one cannot dismiss IHL as totally inapplicable in that they are not confined to situations that existed only when they were adopted. When one peruses its contents, it appears that it could have possibly envisaged a world where technology would evolve enough to significantly alter the interface and realm of war. Cyberwar has the potential to affect civilians and alter their lives by affecting their means of survival – and that outcome itself is enough to reinforce the relevance of IHL. The only difference lies in that cyber warfare is not kinetic, physical or overt like conventional warThis alone, however, is not enough to dismiss it as falling beyond the scope and ambit of IHL.
When computers and computer networks are deployed to extract, discover, alter, affect, disrupt or transfer data in any computer or database, through the manipulation of such systems or networks, a cyberattack is said to occur. The element of proportionality and distinction under IHL can and does play a role in this. Under IHL, it is necessary to distinguish between military targets and civilians and, in doing so, to be proportionate in the use of force and to be justified by an acceptable military gain. Though the means differ in cyberwar, they are capable of being subjected to these rules. The deployment of a cyberattack with a military objective is legal if it adheres to IHL.
This is not to mean, however, that this legal system fully suffices. Computer networks can cause impacts that are intangible and difficult to understand. One can, therefore, look at IHL as being useful in offering a beginning of sorts. The core value that civilians should be protected – and their livelihoods, environment and cultural property should not be targeted – is a principle that is as applicable to cyberwar as it is to conventional war. Treating this as a starting point, it is important to better understand the difference between both kinds of warfare and to begin pruning the law to address the specific challenges that cyber warfare poses. When you have no means to tackle an issue under a given regime, it is a wise idea to stretch the extant principles to cover the issues as best as possible in the interim. Evaluating IHL, meanwhile, will help reveal the drawbacks in the present legal system, thereby allowing future rectifications to be made.
Kirthi Jayakumar is a Lawyer, specialized in public international law and human rights. A graduate of the School of Excellence in Law, Chennai, Kirthi has diversified into research and writing on public international law and human rights. She has worked as a UN Volunteer, specializing in human rights research in Africa, India and Central Asia and the Middle East. She also runs a journal and consultancy that focuses on international law, called A38.

Microsoft's premier student technology competition


Your Region: Worldwide [edit]
Sign Up / Sign In
Imagine Cup is Microsoft's premier student technology competition. Join student innovators from all over the world, and take your one of a kind, ground-breaking app idea from concept to marketplace with Microsoft resources.
Registration for the Imagine Cup 2013 worldwide event in Russia is closed, but you can still compete for cash, travel and networking opportunities with our new Challenges.
Women's Athletics App Challenge: Women are changing both athletics and technology, and we want to highlight and reward these amazing efforts. Learn more >>
April Brain Games Challenge Quiz: Match wits with students from all over the world in our monthly online trivia quiz.Learn more >>
Not competing currently, but want to stay up to date on Imagine Cup, including local and online finalists' announcements?
  • Subscribe to our IC Blog
  • Sign Up for our monthly Insiders Newsletter
  • Access the Community Forums through your newsletter registration. Join the conversation or just take advantage of the shared resources.

Tips and Tricks to Choosing Open Source Software for Business Use


you can't always trust the new framework or database on its description alone. Once you find a piece of open source code that does what you need, you have to vet it in a number of ways, including for reliability, security and legal concerns. You may invest more or less time on the first two, depending on how crucial to the core of your application it will be. For example, the database that stores all of your customers' information may be more important to vet than a little JavaScript calendar widget that lets them enter their birthday.
As a natural reaction to this problem, the open source community has evolved a built-in reputation-based meritocracy. Some of the first questions you ask when evaluating a new open
source project are: how active is it? How many people are working on it? Is it one guy in his basement, or is it a worldwide community of contributors? Who else is using this? Are there real-world examples of it being used? Are there people on forums asking and answering questions? Here you are looking for reliability. It's like the old saying, "it's all about who you know," applied to software. "Oh, you're working with GitHub? Ok, you must be cool." 
Another big concern is security. The level of activity on the project plays a big part here too. If big companies are using it, there's a darn good chance it is very secure, because a company like Google, Twitter, etc. (who both use and contribute to open source) wouldn't survive if it was using technologies with big security holes. Another good source for security-related information is the National Vulnerability Database (NVD), which publishes alerts for known security holes in open-source projects.
Understanding legality and licensing  is complicated, so we'll save for another day. Suffice to say that you need to pay attention to which license(s) the project is licensed under.
Consider this example:
Redis  is an example of a shining star in the open source world. It's a great technology, it's fast and reliable, and it has a vibrant and still growing community. At OpenLogic, we have been using Redis more and more as time goes on. For little things at first, with bigger plans for the future. Here is what we like about it:
First, it serves our needs. Redis is an incredibly fast in-memory datastore. We use it when we have data that has a lot of "churn", meaning we do a lot of reads and writes of data in quick succession. Where something like MySQL would likely buckle under the pressure of 100 of queries per second, Redis can handle up to 100,000 requests per second.
Reliability is important. In the past, because Redis is an in-memory datastore, we were reticent to use it to store valuable data that could not be regenerated if it was lost. In-memory means that, when a box goes down, all the data is lost. Redis has been adding more reliability features, including near-real-time flushing of the data to disk, so (depending on the configuration) the most data you'd ever lose could be as little as 1 second's worth. Another new feature is live replication, or automatic backups to other machines. And again, big companies like GitHub are using Redis, so we felt it must be very reliable.
Redis is licensed under the BSD 3-clause license, which (disclaimer: the following does not constitute legal advice) basically lets you do anything you want with the software as long as you retain the copyright notice and don't use the name of the original software for endorsements.
Don't be scared of open source; be inspired by it! Just do your due diligence and make sure the project you select is right for your needs, reliable and secure. And remember… always comply with the license.

New Tata water plus in bottles

Wednesday, March 20, 2013

Anna university chennai - IT 3rd year exam schedule

ooad-21/5/13(f.n)
web technology-24/5/13(f.n)
npm-27/5/13(a.n)
cns-29/5/13(a.n)
nm-31/5/13(f.n)
es-3/6/13(f.n)

National Conference on Electrical Sysytems & Renewble Energy [NESR'13]


National  Conference on Electrical Sysytems & Renewble Energy [NESR'13] on 3rd may 2013 is organized by Department of Electrical and Electronics Engineering, Anna University, BIT Campus, Tiruchirappalli-620 024.
The theme of the conference is focused on creating a forum for talent young group of researchers with affordable solutions for the problems in electrical engineering.
The main objective is to provide a forum for presentation for research ideas,applications of the technology to the practice of Electric Power,Drives,the Technology Development in renewable energy and communication engineering.The conference is not only creating a forum and also useful for framing the curriculum for the future and improving the academic research talent for the teachers and participants.The conference is also focusing its theme to create a new technology to use the available natural resource to sustain the growing energy demand of the society.
NESR invites you!!!!


http://www.annauniv.edu/neesr/index.html

Tuesday, March 19, 2013

Create a Simple Android Application- SIMPLE CONVERTER


"Simple converter" is the application intended to convert values from one unit to other that user can select. There are separate pages for Length, Temperature, weight.


Hi friends,

This time I would like to explain in detail how to make a simple Android application through an example - "SIMPLE CONVERTER". Here I provide the complete java code for this application. Step by Step explanation of the code is also given. "SIMPLE CONVERTER" is created in such a manner that many of the basic codes for android application development may  included. To understand them correctly, I tried to describe them stepwise.  Hope this will be useful for you.

This post includes:
  • How to make Android development platform? 
  • How to create User interface?
  • Code for basic Android application
  • Code for EditText
  • Code for Button
  • Code for Toast
  • Code for Spinner
Firstly, developing an simple Android application is  an easy job, if you know basics of java programming. Hope you are provided with eclipse to make a platform for android application development.

(I) Create application development platform

  1. To start application creation open eclipse and follow file--> New -->Project
  2. Select Android application from Android folder and "Finish".
  3. Enter necessary fields in dialog box.


 Look at the example..
  

                                  


(II) Create User Interface for Application

We need  two 'EditText 's  to enter values and two  'Button's for submitting our choices.We can include them in main.xml as follows.

Open res-->layout-->main.xml.

Edit main.xml it as:-

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="
http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
>
<TextView
android:id="@+id/header"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="SIMPLE CONVERTER"
android:gravity="center"
android:textSize="25sp"
/>

<EditText android:id="@+id/Value1"
android:layout_width="120sp"
android:layout_below="@+id/header"
android:hint="0.0"
android:layout_height="wrap_content">
</EditText>

<EditText
android:id="@+id/Value2"
android:layout_width="120sp"
android:hint="0.0"
android:layout_height="wrap_content"
android:layout_below="@+id/Value1">
</EditText>

<Button android:text="convert"
android:id="@+id/convert"
android:layout_width="fill_parent" android:layout_height="wrap_content"
android:layout_below="@+id/Value2" >
</Button>

<Button android:text="Reset"
android:id="@+id/reset"
android:layout_width="fill_parent" android:layout_height="wrap_content"
android:layout_below="@+id/convert">
</Button>

</RelativeLayout>

The output of the xml file will be as follows:







(III) Create Android Code for Application

Open the java file as src-->  <package name> -->    <filename.java>

In this example it is liengthConverter.java.
It will be like this:

package com.simpleconverter;
import android.app.Activity;
import android.os.Bundle;
public class lengthConverter extends Activity
{
    /** Called when the activity is first created. */
    @Override
    public void onCreate(Bundle savedInstanceState)
 {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);
    }
}


Edit the java code as:


package com.simpleconverter;
import android.app.Activity;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.Toast;

public class lengthConverter extends Activity {

private EditText v1,v2;
private Button Convert;
private Button Reset;
private double val1=0,val2=0;

/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
setContentView(R.layout.main);

v1= ( EditText)findViewById(R.id.Value1);
v2= ( EditText)findViewById(R.id.Value2);
Convert = (Button)findViewById(R.id.convert);
Reset = (Button)findViewById(R.id.reset);
Convert.setOnClickListener(new View.OnClickListener()
{
public void onClick(View v)
{
convertValues();
}
}
);

Reset.setOnClickListener(new View.OnClickListener()
{
public void onClick(View v)
{
reset();
}
}
);
}

void convertValues()
{
if (v1.getText().length() > 0)
{
val1=Double.parseDouble(v1.getText().toString());
val2=InchToCm(val1);
}
else if(v2.getText().length() > 0)
{
val2=Double.parseDouble(v2.getText().toString());
val1=CmToInch(val2);
}
else
Toast.makeText(this,"please enter a value",Toast.LENGTH_LONG).show();
v1. setText(Double.toString(val1));
v2. setText(Double.toString(val2));

}
double InchToCm(double val)
{return(val*2.54);}
double CmToInch(double val)
{return(val/2.54);}


void reset()
{
v1.setText("");
v2.setText("");
}
}

This code converts centimeter value entered  in EditText _1 to Inch value and display it  in EditText _2.








Let us have  a detailed look on the code:

(IV) CODE EXPLANATION

I would like to describe each code segment separately , rather than explaining all in a while.

**How EditText works??

 Include this code in xml file. 

<EditText<Spinner
android:id="@+id/Value2"
android:layout_width="120sp"
android:hint="0.0"
android:layout_height="wrap_content"
android:layout_below="@+id/Value1">
</EditText>

Points to note:-
  • id   :: unique identifier for being accessed in java code.
  • hint:: hint displayed in EditText field.
  • text:: default text displayed in EditText field.


To access EditText in java, code as
v1= ( EditText)findViewById(R.id.Value1);

To check the no. of characters in text Field
int count=myEditText.getText().length();

To read a string
String val=myEditText.getText().toString();

To read a number
Double =val=Double.parseDouble(myEditText.getText().toString());


**How Button works??

To include a button ,code xml as:

<Button android:text="ButtonName"
 android:id="@+id/Button_id"
 android:layout_width="fill_parent" android:layout_height="wrap_content"
>
</Button>

To access button in java code:
private MyButton = (Button)findViewById(R.id.ButtonNmae);

To recognize Button click,
MyButton.setOnClickListener(new View.OnClickListener()
{
public void onClick(View v)
{
..........
}
}
);


**How Toast works??

Toast displays a tiny message for a short time and then disappears.

Code for Toast is
Toast.makeText(this,"my Toast...",Toast.LENGTH_SHORT).show();

parameter 1: context
parameter 2:Text to display.
parameter 2:duration of display; LENGTH_SHORT,LENGTH_LONG are available


(V)Modify the code

Current code has the only ability to convert from inch to centimeter and viceversa. We can improve it by including a Spinner with more unit conversion options.


** How to code Spinner??

Edit xml code as:

android:id="@+id/unit1"
android:gravity="center"
android:layout_height="wrap_content" android:layout_below="@+id/Value1" android:layout_width="fill_parent">
</Spinner>

To include options with spinner:

String[] items = new String[] {"inch<-->Centimeter",
 "Foot<-->Metre",
"Mile<-->Kilometre",
"Yard<-->Metre"};

ArrayAdapter<String> adapter = new ArrayAdapter<String>
(this,android.R.layout.simple_spinner_item, items);

adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);

mySpinner.setAdapter(adapter);

To get the selection by Spinner, use the funtion:
int select=mySpinner.get SelectedItemPosition();

 We have now familiarized  with all necessary codings to deal with simple application, To improve functionality, edit  java code as,


void convertValues()
{
int u1= unit1.getSelectedItemPosition();
if (v1.getText().length() > 0) 
{
val1=Double.parseDouble(v1.getText().toString());
val2=findValue1(val1,u1);
}
else if(v2.getText().length() > 0)
{
val2=Double.parseDouble(v2.getText().toString());
val1=findValue2(val2,u1);
}
else
Toast.makeText(this,"please enter a value",Toast.LENGTH_LONG).show(); 
v1. setText(Double.toString(val1));
v2. setText(Double.toString(val2));

}

double findValue1(double val,int unit)
{
double retval=0.0;
switch(unit)
{
case 0:retval= InchToCm(val);break;
case 1:retval= FootToMetre(val);break;
case 2:retval=MileToKm(val);break;
case 3:retval=YardToMetre(val);break;
}
return(retval);


double findValue2 (double val,int unit)
{
double retval=0.0;
switch(unit)
{
case 0:retval= CmToInch(val);break;
case 1:retval= MetreToFoot(val);break;
case 2:retval=KmToMile(val);break;
case 3:retval=MetreToYard(val);break;
}
return(retval);


double InchToCm(double val){return(val*2.54);}
double CmToInch(double val){return(val/2.54);}
double MetreToFoot (double val){return(val*3.28084);}
double FootToMetre (double val){return(val/3.28084);}
double MileToKm (double val){return(val*1.60934);}
double KmToMile (double val){return(val/1.60934);}
double MetreToYard(double val){return(val*1.09361);}
double YardToMetre(double val){return(val/1.09361);}


Now, our Simple converter is able to convert values on these units.


inch<-->Centimeter
Foot<-->Metre
Mile<-->Kilometre
Yard<-->Metre
   

Is Android programming funny now.??   :)
Your valuable suggestions are welcomed.!!
  


A Simple Android ListView Example


This tutorial describes how to create a simple ListView and populate it with text data (the names of various planets). The following picture shows what the Android program looks like.
Basically we create a ListView class and use TextView objects for each row. Each planet name is rendered in a TextView.

Main Layout File

Our ListView is defined in the main layout file (res/layout/main.xml) within a LinearLayout.
  1. <?xml version="1.0" encoding="utf-8"?>  
  2. <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"  
  3.   android:orientation="vertical"  
  4.   android:layout_width="fill_parent"  
  5.   android:layout_height="fill_parent">  
  6.     
  7.     <ListView android:layout_width="fill_parent"   
  8.       android:layout_height="fill_parent"   
  9.       android:id="@+id/mainListView">  
  10.     </ListView>  
  11.       
  12. </LinearLayout>  
The resource ID of the ListView is mainListView, which we will use to get a reference to the ListView in our Activity class.
  1. // Find the ListView resource.     
  2. mainListView = (ListView) findViewById( R.id.mainListView );    

Row Layout File

Each row in the ListView will be a TextView. The TextView is defined in another file (res/layout/simplerow.xml).
  1. <TextView xmlns:android="http://schemas.android.com/apk/res/android"  
  2.  android:id="@+id/rowTextView"   
  3.  android:layout_width="fill_parent"   
  4.  android:layout_height="wrap_content"  
  5.  android:padding="10dp"  
  6.  android:textSize="16sp" >  
  7. </TextView>  

Activity

Our main activity (SimpleListViewActivity) creates an ArrayAdapter, which holds the objects to be displayed in the ListView. The ArrayAdapter constructor is passed the resource ID of the TextView layout file (R.layout.simplerow). The ArrayAdapter will use it to instantiate a TextView for each row.
We then set the ArrayAdapter as our ListView's adapter.
  1. package com.windrealm.android;  
  2.   
  3. import java.util.ArrayList;  
  4. import java.util.Arrays;  
  5.   
  6. import android.app.Activity;  
  7. import android.os.Bundle;  
  8. import android.widget.ArrayAdapter;  
  9. import android.widget.ListView;  
  10.   
  11. public class SimpleListViewActivity extends Activity {  
  12.     
  13.   private ListView mainListView ;  
  14.   private ArrayAdapter<String> listAdapter ;  
  15.     
  16.   /** Called when the activity is first created. */  
  17.   @Override  
  18.   public void onCreate(Bundle savedInstanceState) {  
  19.     super.onCreate(savedInstanceState);  
  20.     setContentView(R.layout.main);  
  21.       
  22.     // Find the ListView resource.   
  23.     mainListView = (ListView) findViewById( R.id.mainListView );  
  24.   
  25.     // Create and populate a List of planet names.  
  26.     String[] planets = new String[] { "Mercury""Venus""Earth""Mars",  
  27.                                       "Jupiter""Saturn""Uranus""Neptune"};    
  28.     ArrayList<String> planetList = new ArrayList<String>();  
  29.     planetList.addAll( Arrays.asList(planets) );  
  30.       
  31.     // Create ArrayAdapter using the planet list.  
  32.     listAdapter = new ArrayAdapter<String>(this, R.layout.simplerow, planetList);  
  33.       
  34.     // Add more planets. If you passed a String[] instead of a List<String>   
  35.     // into the ArrayAdapter constructor, you must not add more items.   
  36.     // Otherwise an exception will occur.  
  37.     listAdapter.add( "Ceres" );  
  38.     listAdapter.add( "Pluto" );  
  39.     listAdapter.add( "Haumea" );  
  40.     listAdapter.add( "Makemake" );  
  41.     listAdapter.add( "Eris" );  
  42.       
  43.     // Set the ArrayAdapter as the ListView's adapter.  
  44.     mainListView.setAdapter( listAdapter );        
  45.   }  
  46. }