Documente Academic
Documente Profesional
Documente Cultură
Most especially to my family and friends without their cooperation, this training as well as my project work would not
have been a success.
AAMIR KAMAAL
1200112004
1 | Page
ABSTRACT
Android is a software stack for mobile devices that includes
an operating system, middleware and key applications.
Android is a software platform and operating system for
mobile devices based on the Linux operating system and
developed by Google and the Open Handset Alliance. It
allows developers to write managed code in a Java-like
language that utilizes Google-developed Java libraries,
but does not support programs developed in native code.
The unveiling of the Android platform on 5 November 2007
was announced with the founding of the Open Handset
Alliance, a consortium of 34 hardware, software
andtelecom companies devoted to advancing open st
andards for mobile devices. Whenreleased in 2008,
most of the Android platform will be made available under the
Apache free-software and open-source license.
AAMIR KAMAAL
1200112004
2 | Page
3 | Page
of
business
Mission Statement
To design, build, deliver and manage unique and customised
business
solutions
for
our
customers.
To
provide
4 | Page
your
expenditures
and
maximize
the
use
of
latest
Business Partnership
SoftPro India specializes in information technology Products
and Services that provides the right solution to your needs at a
AAMIR KAMAAL
1200112004
5 | Page
Services
AAMIR KAMAAL
1200112004
6 | Page
Consulting/Design
Implementation
Maintenance/Support
Network Integration
LAN/WAN/Enterprise/Global Networks
Hardware and Software Integration
Management
Training Services
Products
Consulting
Corporate Telework Training
Telecom Training
Software and Hardware Training
Contact Information
Command office :
URL: http://www.softproindia.org
Email : hr@softproindia.org
Phone: +91 522 6565114, 09838505980
AAMIR KAMAAL
1200112004
7 | Page
CONTENTS
Introduction
Android fundamentals
Android components
Android lifecycle
Screenshots.
Coding
Enhancement Scope
Conclusion
References
Introduction
AAMIR KAMAAL
1200112004
8 | Page
9 | Page
ANDROID FUNDAMENTALS:
Android apps are written in the Java programming
language. The Android SDK tools compile your code
along with any data and resource filesinto an APK:
AAMIR KAMAAL
1200112004
10 | P a g e
11 | P a g e
App Components
AAMIR KAMAAL
1200112004
12 | P a g e
13 | P a g e
Services
A service is a component that runs in the
background to perform long-running operations or
to perform work for remote processes. A service
does not provide a user interface. For example, a
service might play music in the background while
the user is in a different app, or it might fetch data
over the network without blocking user interaction
with an activity. Another component, such as an
activity, can start the service and let it run or bind to
it in order to interact with it.
A service is implemented as a subclass
of Service and you can learn more about it in
the Servicesdeveloper guide.
Content providers
A content provider manages a shared set of app
data. You can store the data in the file system, an
SQLite database, on the web, or any other
persistent storage location your app can access.
Through the content provider, other apps can query
or even modify the data (if the content provider
allows it). For example, the Android system
provides a content provider that manages the user's
contact information. As such, any app with the
proper permissions can query part of the content
provider (such asContactsContract.Data) to read
and write information about a particular person.
Content providers are also useful for reading and
writing data that is private to your app and not
AAMIR KAMAAL
1200112004
14 | P a g e
AAMIR KAMAAL
1200112004
15 | P a g e
And more
Declaring components
The primary task of the manifest is to inform the system
about the app's components. For example, a manifest
file can declare an activity as follows:
AAMIR KAMAAL
1200112004
16 | P a g e
AAMIR KAMAAL
1200112004
17 | P a g e
ACTIVITY LIFECYCLE
AAMIR KAMAAL
1200112004
18 | P a g e
19 | P a g e
SCREENSHOTS OF GAME:
AAMIR KAMAAL
1200112004
20 | P a g e
AAMIR KAMAAL
1200112004
21 | P a g e
CODING
import android.app.Activity;
import android.content.Intent;
import android.content.SharedPreferences;
AAMIR KAMAAL
1200112004
22 | P a g e
import android.os.Bundle;
import android.view.View;
import android.view.Window;
import android.widget.TextView;
public class HomeActivity extends Activity {
TextView tv;
SharedPreferences shared;
String s = "High Score : ";
@Override
protected void onCreate(Bundle
savedInstanceState) {
// TODO Auto-generated method stub
super.onCreate(savedInstanceState);
requestWindowFeature(Window.FEATURE_NO_TITLE);
setContentView(R.layout.activity_home);
SharedPreferences
preferences=getSharedPreferences("filename",
MODE_PRIVATE);
s += preferences.getString("key",null);
tv = (TextView)findViewById(R.id.textView1);
AAMIR KAMAAL
1200112004
23 | P a g e
tv.setText(s);
}
public void start(View v)
{
Intent i = new
Intent(HomeActivity.this,MainActivity.class);
startActivity(i);
}
}
import java.util.Random;
import android.app.Activity;
import android.content.Context;
AAMIR KAMAAL
1200112004
24 | P a g e
import android.content.Intent;
import android.content.SharedPreferences;
import android.os.Bundle;
import android.os.Handler;
import android.view.View;
import android.view.Window;
import android.widget.FrameLayout;
import android.widget.FrameLayout.LayoutParams;
import android.widget.ImageView;
import android.widget.TextView;
import android.widget.Toast;
25 | P a g e
int score = 0;
int highScore = 0;
int life = 5;
@Override
protected void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
requestWindowFeature(Window.FEATURE_NO_TITLE);
setContentView(R.layout.activity_main);
String h1 = Integer.toString(getWidth());
Toast.makeText(this, h1,
Toast.LENGTH_SHORT).show();
context = this;
inItUi();
addMultipleViews();
moveViews();
addNewView();
//
sharedPreferences =
getSharedPreferences("filename", MODE_PRIVATE);
AAMIR KAMAAL
1200112004
26 | P a g e
27 | P a g e
@Override
public void run() {
System.out.println("Child
count>>>"+baseLayout.getChildCount());
for(int i=0 ; i < baseLayout.getChildCount() ; i++){
View v=baseLayout.getChildAt(i);
if(v.getY()<0){
baseLayout.removeView(v);
life--;
if(life>0)
lifeTextView.setText("Life : "+life);
else
{
if(score>highScore)
{
highScore = score;
editor = sharedPreferences.edit();
editor.putString("key",
Integer.toString(highScore));
editor.commit();
}
AAMIR KAMAAL
1200112004
28 | P a g e
moveTime--;
moveHandler.postDelayed(moveRunnable,
moveTime);
}
};
moveHandler.postDelayed(moveRunnable,
100);
}
29 | P a g e
addRunnable=new Runnable() {
@Override
public void run() {
addNewView();
addHandler.postDelayed(addRunnable, 2000);
}
};
addHandler.postDelayed(addRunnable, 100);
}
AAMIR KAMAAL
1200112004
30 | P a g e
LayoutParams params=new
LayoutParams(LayoutParams.WRAP_CONTENT,LayoutPa
rams.WRAP_CONTENT);
imageView.setLayoutParams(params);
Random random=new Random();
int num=random.nextInt(getWidth()-200);
imageView.setX(num);
imageView.setY(getHeight());
imageView.setOnClickListener(new
View.OnClickListener() {
@Override
public void onClick(View view) {
// TODO Auto-generated method stub
//
playSound();
score++;
scoreTextView.setText(" Score:
"+score);
baseLayout.removeView(view);
//
//
view2.setImageResource(R.drawable.image8);
//
overLayout.addView(view2);
view.setOnClickListener(null);
AAMIR KAMAAL
1200112004
31 | P a g e
}
});
baseLayout.addView(imageView);
}
32 | P a g e
@Override
protected void onDestroy() {
// TODO Auto-generated method stub
super.onDestroy();
moveHandler.removeCallbacks(moveRunnable);
addHandler.removeCallbacks(addRunnable);
}
33 | P a g e
android:layout_height="match_parent" >
<Button
android:id="@+id/button1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_centerHorizontal="true"
android:layout_marginBottom="51dp"
android:onClick="start"
android:text="START GAME" />
<TextView
android:id="@+id/textView2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_above="@+id/button1"
android:layout_centerHorizontal="true"
android:layout_marginBottom="34dp"
android:text="YOUR SCORE : "
android:textAppearance="?
android:attr/textAppearanceMedium" />
AAMIR KAMAAL
1200112004
34 | P a g e
<TextView
android:id="@+id/textView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_above="@+id/textView2"
android:layout_centerHorizontal="true"
android:layout_marginBottom="29dp"
android:text="HIGH SCORE :"
android:textAppearance="?
android:attr/textAppearanceMedium" />
</RelativeLayout>
35 | P a g e
android:layout_height="match_parent"
android:paddingBottom="@dimen/activity_vertical_mar
gin"
android:paddingLeft="@dimen/activity_horizontal_marg
in"
android:paddingRight="@dimen/activity_horizontal_ma
rgin"
android:paddingTop="@dimen/activity_vertical_margin"
tools:context=".MainActivity" >
<FrameLayout
android:id="@+id/overLayout"
android:layout_width="match_parent"
android:layout_height="match_parent" >
</FrameLayout>
<FrameLayout
android:id="@+id/baseLayout"
android:layout_width="match_parent"
android:layout_height="match_parent" >
AAMIR KAMAAL
1200112004
36 | P a g e
</FrameLayout>
<FrameLayout
android:id="@+id/textLayout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_alignParentRight="true"
android:layout_alignParentTop="true" >
<TextView
android:id="@+id/scoreTextView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentTop="true"
android:text="Score: 0"
android:textAppearance="?
android:attr/textAppearanceMedium" />
<TextView
android:id="@+id/lifeTextView"
AAMIR KAMAAL
1200112004
37 | P a g e
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="70dp"
android:text="Life: 5 "
android:textAppearance="?
android:attr/textAppearanceMedium" />
</FrameLayout>
</RelativeLayout>
38 | P a g e
Appealing
Clearly defined learning outcomes
Higher engagement factor
Fun
Addictive
39 | P a g e
CONCLUSION:
The market of mobile gaming has brought in an imperative
feature in fashion. Video games are ancient history now.
Almost every individual owns a Smartphone now and they
prefer playing high definition games on their device without
facing any difficulty. Age is just a number when it comes to
gaming.
AAMIR KAMAAL
1200112004
40 | P a g e
REFERENCES:1- http://www.slideshare.net/
2- http://developer.android.com/
3- android-developers.blogspot.com/
AAMIR KAMAAL
1200112004
41 | P a g e
AAMIR KAMAAL
1200112004
42 | P a g e