Você está na página 1de 36

ABOUT PSSP TECHNOLOGY:

Peripheral Software Solutions & PrinTech is a Business Related Service Provider firm in Noida. They specialize in Website Designing and Development, Software Development, On-line Promotion, Graphics Designing and Print Media Solutions. The ability to draw from an experienced base of personnel whilst maintaining a personalized form of business liaison stands them out within this competitive market of IT. The ultimate in Designing, Skills Diversity and Adaptability to meet client expectations are their very strengths. The company believes in providing optimum services to its clients keeping in view the cost to be spent on the project. Given our expertise in both commercial IT Development, Graphics Designing & Printing Solutions, it believes it can offer a unique and superior service to small & medium sized business owners, at the best affordable cost in comparison to what is currently available in todays market. Our mission is to help the clients compete in quickly evolving global markets by providing all possible Business Solutions. To fulfill its mission, it constantly evaluates technologies and innovations used in global market and meets those requirements on implementing continuous improvement strategies.

DEVELOPMENT SERVICES Provided to clients:


The companys integrated consulting in information technology, website development, graphic designing and printing solutions and all other kinds of possible business solutions providing capabilities to bring continuity and consistency to the clients strategic programs. WEBSITE DEVELOPMENT SERVICES: IT Consulting, Information Risk Management, Infrastructure Services, IT Process and Service Management, IT Strategy and Governance, Master Data Management, Performance Engineering Solutions, Quality Assurance, Testing and Training. Website Development, including website design, Custom CMS website development, Search Engine Optimization, website maintenance, portal, Ecommerce Solution with latest technology web 2.0, open source development (Oscommerce, Magento, Zencart, X-cart, CS-cart, Joomla, Drupal, Word Press). CMS website- We offer Web Content management services that help organizations to distribute and manage information faster and more efficiently.Our customized website content management solution helps companies to enjoy uncomplicated management of their websites and other crucial online content with reduced time and effort. E-commerce- E-commerce web solutions enable the distribution, buying, selling, marketing, and servicing of products or services over the Internet and help to reduce costs while reaching a wider market.

SOFTWARE DEVELOPMENT SERVICES:


We provide single permanent solution in software delivery to secondary assignments through graphic designers and information systems technicians. Software Development is a collaborative effort in proper unison concluding through proper efforts. Services are provided as per client's requirements and budget to the best of our efforts. Thinking differently, Providing Services Efficiently, Cutting down Cost, Increase the Sales through various Promotional Techniques, and Make Revenue Grow are some of our qualities on which clients grow.

MOBILE DEVELOPMENT SERVICES:


The number of ways, your business can utilize the power of a mobile phone are many for this we provide services in Android Development as well as in windows mobile Development. And here we come into the role, you can utilize our services like Android Solutions Development as well as windows mobile development.

MY ROLE AS AN INTERN:
As already mentioned, the company caters to the needs of clients in majorly three areas namely, website development services, software development services and mobile development services. I was absorbed in the mobile development services. My role was of an android application developer. Under this role, I was to work in a group of two for developing two applications which could be run on an android phone. The domain chosen by my group was game development. For the first two weeks, we were made to learn/ master the coding techniques of android application development relevant to our assigned work. During this period, we were assisted a lot by our mentors at the firm. After that, we were assigned the actual application to be developed for the next four weeks. The reason for choosing android application development is that the field provides a lot of scope to grow. Android Development tools are open source and hence an individual can flourish as an android programmer upto full extent. Another reason is that the field is relatively new in the industry and the trends show that there is a heavy need of android programmers in the market. Yet, another reason is that the programmer can easily put up his/her product in the android app market and can earn a good deal of supportive income.

ABOUT ANDROID OPERATING SYSTEM


An open platform for mobile development Android is an OS designed to facilitate mobile development. The platform, the SDK and the associated tools are totally open-source and under Apache license. Thus, the code can be used and modified by everyone who is following the rules described in the Apache license.

The Open Handset Alliance A lot of people consider Android as a Google technology. As a matter of fact, Android is a project from the Open Handset Alliance (OHA). The OHA is a collection of more than 45 technology companies including hardware manufacturers, mobile operators, semiconductors companies, software developers and commercialization companies. Some of the more prominent mobile technology companies are listed below: Hardware manufacturers1: Samsung, LG, Sony Ericsson, Motorola, etc. Mobile operators: T-Mobile, Sprint, China Mobile, Vodafone, NTT DoCoMo, etc. Semiconductors companies: Intel, ARM, Nvidia, Qualcomm, Texas Instruments, etc. Software developers: Google, PacketVideo, eBay, etc. Commercialization companies: Noser, Borqs, etc. This group of mobile and technology leaders hopes to deliver a better mobile software experience for consumers. This is performed by providing the platform needed for innovative mobile development at a faster rate and a higher quality without licensing fees for software developers and handset manufacturers. Each member of the OHA is also strongly committed to greater openness. Indeed, they all believe that increasing openness is synonymous with faster innovation and better response to end-users. Android is the first joint project of this alliance. It was built from the ground up with the explicit goal to be the first open, complete, and free platform created specifically for mobile devices. Considering Google as the father of the Android platform is a huge misapprehension. Google obviously developed most of the Android project and linked the platform to a large number of its web services such as Google Maps, Google Mail, Google Calendar, Youtube, etc. Nevertheless, the Android project is a OHA production. For example, PacketVideo can be quoted as the main contributer in regards to multimedia codecs embedded in Android. Companies such as HTC and T-mobile also worked on the release of the first Android-powered handset released during October 2008 in the US.

ANDROID FOR MOBILE OPERATING SYSTEM:


Google describes Android as: The first truly open and comprehensive platform for mobile devices. It includes an operating system, user-interface and applications all of the software to run a mobile phone, but without the proprietary obstacles that have hindered mobile innovation. Android is a complete software stack developed by Google and designed to run efficiently on mobile devices. A common mistake is to consider Android as a framework and some applications linked to the associated Google services. In fact, Android is a set of technologies from the lower level operating system to the top level software. As part of the OHA, companies have contributed to the Android open source project. A mascot has also been created to represent it. This is the green android shown in figure 2.1. The OHA is devoted to the open source philosophy because open source projects have lots of advantages nowadays: Economical advantages: With the economic recession, a lot of IT companies dont have enough budget to maintain, develop or create an up-to-date and state-of-the-art OS. Being a team project, Android allows companies to reduce their expenses in engineering by simply aggregating knowledge and skills. Standards compliance: Most of the frameworks available in the Android project rely on other open source projects. As a consequence, all protocols, files, programs, etc. use open formats that are defined as standards. So, communication between third-party applications are facilitated. Security and reliability: all bugs are rapidly corrected thanks to the openness of the source code. All developers can access, correct and modify the source code. Thus, users can patch their current version of the platform freely by recompiling the system or executing a correcting patch.

Openness: the source code, which is controlled by the Apache license, is available to everyone. It implies that everyone can modify or re-use the code as long as the copyright is preserved. Thank to that, unsatisfied users can add new features to their system or even tune the system up to create a brand new branch.

A lot of people are also afraid by Google overseing and interfering with personal data. In order to counter this fear, Google explained that Android is totally boundless. Native (Google provided) and third-applications are equals. Indeed, contrary to the iPhone OS in which all Apples applications have a higher priority and cant be removed, Android users can adopt non Google applications. The best example of this is the possibility to remove and replace the desktop application or the dialer by a third-party home screen.

VERSIONS OF ANDROID RELEASED SO FAR . . .


Googles Android operating system has undergone a pretty incredible metamorphosis in the three short years since it debuted on the T-Mobile G1. The Android era officially began on October 22nd, 2008, when the T-Mobile G1 launched in the United States. Initially, many features that we couldn't live without today were missing an on-screen keyboard, multitouch capability, and paid apps, for instance but the foundation was in place, and a few lasting trademarks of the platform debuted on those very first G1s to roll off the assembly line: The pull-down notification window. Though these early phones clearly weren't without their flaws, it was almost universally acknowledged that Android nailed the notification system on day one it would take iOS another three years before launching a design as effective at triaging messages and alerts coming from users' ever-growing collection of mobile apps. The secret was in the G1's unique status bar, which could be dragged downward to reveal every notification in a single list: text messages, voicemails, alarms, and so on. The fundamental concept lives on (in a refined form) even in version 4.0 today. Home screen widgets. If you had to pick an enduring differentiator for Android as a phone platform a differentiator it can still claim against iOS 5 and, to some extent, Windows Phone 7.5 it'd be rich support for widgets on the home screen. Google had big plans for widgets from the very beginning, but there was one big hang-up at launch: developers couldn't create their own widgets. Deep, rich Gmail integration. By the time the G1 was released, Gmail had long since supported POP and IMAP for integration with mobile email clients but the problem is that neither one of those protocols are well-suited for supporting some of Gmail's more unique features like archival and labeling. Android 1.0 fixed that in a big way, shipping with by far the best mobile Gmail experience on the market. The Android Market. It's hard to imagine a smartphone without a centralized app store now, but when Android first shipped, it did so at the very start of the mobile app revolution. Indeed, the Android Market on those first G1s bore little resemblance to the Android Market of today: it launched with just a handful of apps (as you'd expect of an entirely new ecosystem), and didn't have the rich, multifaceted curation that has been added over the last couple versions instead, it just had a single row of handpicked selections at the top of the app's home screen. Perhaps more importantly, it lacked support for any sort of payment system, a problem that wouldn't get fixed until the following year. Notably, Google developed Android 1.0's UI with help from The Astonishing Tribe, a Swedish interaction design firm responsible for some truly amazing interface concepts over the years. If you look closely, you can see where TAT left its mark on the platform: the analog clock widget included in Android versions 1.0 through 2.2 read "Malmo" in small, light gray type near the

bottom of the face, a tribute to TAT's hometown of Malm, Sweden. The company would later go on to be acquired by RIM to focus solely on advancement of its BlackBerry and BBX platforms so needless to say, Google's collaboration with TAT has come to an end. The first upgrade to the Android platform came in February of 2009, a little over three months after the launch of the G1. Version 1.1 wasn't a revolution by any stretch of the imagination it patched a fairly lengthy list of bugs, primarily but if nothing else, it validated Android's ability to roll out updates over the air and make them nearly effortless for users to install.

Android 1.5 perhaps better known by its codename, Cupcake marked much more of a milestone. It wasn't just about the fact that it added several hotly-anticipated features that were critical to keeping the platform competitive, it was also the first version to use Google's "sweet" naming convention: every major release since Cupcake has been named after a confection in alphabetical order. Apart from a couple tricky letters like "X," we'd expect the trend to continue for a while. In many ways, Cupcake was about refinement, polishing some rough edges on the user interface that had originally launched. Some of these changes were nearly imperceptible if you weren't looking for them. For instance, the standard Google search widget a staple on many users' home screens gained a hint of transparency, and the app drawer was decorated with a subtle weave pattern beneath the icons. Hover over the image below to get a sense of just how subtle these changes were. If you used a device running 1.1 and 1.5 in succession, you might never notice anything; in reality, though, everything from text alignment to shading on the status bar had gone under the knife. Though it wasn't as big of an upgrade as Cupcake, Android 1.6 Donut was still a far bigger deal than its "0.1" increment would let on. It made another pass of minor visual refinements throughout the platform and added a handful of new and updated, but much of the big news was under the hood. CDMA support was first offered in Donut, for instance, opening the door to American carriers like Verizon and potentially hundreds of millions of subscribers across Asia. But perhaps none of the "under the hood" changes had a more profound effect on the platform than resolution independence. Donut marked the first time that Android was capable of running on a variety of screen resolutions and aspect ratios, which opened the door for phones that featured displays of something other than 320 x 480 in a portrait orientation. If you look at any carrier's Android lineup today, you're liable to see phones of QVGA, HVGA, WVGA, FWVGA, qHD, and 720p resolution and maybe even a portrait QWERTY model or two and that scaling capability traces its roots directly to 1.6.

In early November of 2009 about a year after the G1's premiere Android 2.0 launched right on Donut's heels. "Big" would be an accurate description all around: it was a big deal, made big promises, and was deployed on big phones offered by big carriers. Eclair, as it was known, was initially offered exclusively on Verizon on none other than the Motorola Droid the phone that kicked off one of the most successful mobile franchises in history.

Though it wasn't a huge update, Android 2.1 marked a strategic shift for Google. Possibly concerned about its hardware partners' trend toward skinning and significantly altering the "stock" Android experience, Google chose to work directly with HTC to make its own flagship device a phone that would showcase pure Android 2.1 without any modifications. Android the way Google intended, as it were. That's how the Nexus Onewas born, a slim, keyboardless device with one of the first 1GHz Qualcomm Snapdragon processors on the market and an advanced AMOLED display at WVGA resolution. It was well ahead of its time, and it has since gone down as one of the most well-regarded Android phones ever produced. Google had actually started down this path in Android 2.0 with the Motorola Droid. Google and Moto had worked very closely together in the development of the phone, and the Droid received Eclair well before anyone else did, but it wasn't quite "pure" the Droid made some user interface tweaks that don't appear in the stock builds of the platform and Google never sold the Droid to users directly. That changed with the Nexus One.

Android 2.2 was released in mid-2010, and the advantage of the Nexus program was starting to become clear: the Nexus One was the first to get updated. What did Google have to showcase in Froyo? Plenty. From the first power-on, the redesigned home screen was instantly recognizable: gone was the old three-panel view (which dated back to Android 1.0), replaced by a five-panel one with a new group of dedicated, translucent shortcuts at the bottom for the phone, web browser, and app launcher. Additionally, dots on either side of the shortcuts gave the user an indication of what panel they were currently viewing. In some ways, Google was playing catch-up here third-party skins like HTC's Sense had already done all of these things.

About a half year after the launch of Froyo on the Nexus One, Google came back for another round of the Nexus program to support the release of Android 2.3. This time, it had selected Samsung to produce the Nexus S, a derivative of the company's wildly successful Galaxy S line. Though it actually wasn't much more advanced than the Nexus One it replaced, the two phones couldn't have looked much more different thanks largely to a new curved-glass display

and a glossy, all-black shell. Gone also was the ubiquitous trackball beneath the display with the Nexus S, it appeared that Google was finally ready to bid adieu to hardware navigation of the user interface. For Andy Rubin, the transition might have been a tough call to make: the trackball had always been a marquee feature in Danger's line of devices, and he'd brought it over for the G1.

Honeycomb was, to say the least, an oddity a divergence in Google's hard-charging path toward smartphone dominance. In fact, Honeycomb wasn't for smartphones at all. Instead, Google returned to Motorola the company that it had worked with to deliver Android 2.0 exclusively on the Droid to produce a device in the same vein as the Nexus series that would showcase "stock" Android 3.0, a variant of Android targeted exclusively at tablets. That device would become the Xoom. Though Honeycomb hasn't seen the levels of market traction that Google was probably aiming for, it previewed a fundamental redesign of Android's user interface that would be more thoroughly built out in Android 4.0:

And that leads us to our current state of affairs with the recent release of Android 4.0 on the Galaxy Nexus, a return to the Nexus program and a second visit to Samsung, which had provided last year's Nexus S for the launch of Gingerbread. Ice Cream Sandwich is, without question, the biggest change for Android on phones yet but many of its new features and design elements got their start in Honeycomb, including virtual buttons, the transition from green to blue accents, improved widget support, multitasking with a scrollable list of thumbnails, and "action bars" within applications.

project realization
Softwares required:
The following softwares are required before a programmer can start developing applications for android: 1. Java Development Kit 2. Java Runtime Environment 3. Eclipse 4. Android Software Development Kit 5. Android Development Tool All the above mentioned softwares are open source and available on trusted websites. Once all of the above are installed, we run the AVD Manager from inside the Eclipse so as to run the Emulator, which is a virtual android device to test the applications developed right on the desktop.

The Memory Game:


In this games, the user has to unveil the squares to get the matching pairs of images. To develop this game, two programming languages were used: 1. JAVA 2. XML Use of xml is done for simulating graphics. The reference ID is used to link the JAVA files with the respective xml files. Bitmap images are used wherever required. In this game, png images are used.

CODE EXTRACTS
Strings.xml: <?xml version="1.0" encoding="utf-8"?> <resources> <string name="app_name">Memory Game</string>

<string-array name="type"> <item>New Game</item> <item>4 X 4</item> <item>4 X 5</item> <item>4 X 6</item> <item>5 X 6</item> <item>6 X 6</item> </string-array>

</resources>

Main.xml: <?xml version="1.0" encoding="utf-8"?>

<TableLayout android:layout_width="fill_parent" android:layout_height="fill_parent" xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/TableLayout03">

<TableRow android:id="@+id/TableRow04" android:layout_width="wrap_content" android:layout_height="wrap_content" android:gravity="center"> <Spinner android:id="@+id/Spinner01" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_weight="1"> </Spinner> </TableRow> <TableRow android:id="@+id/TableRow05" android:layout_width="wrap_content" android:layout_height="wrap_content"> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:id="@+id/tv1" android:paddingLeft="10sp" android:layout_weight="1"> </TextView> </TableRow> <TableRow android:id="@+id/TableRow01" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="center" android:gravity="center">

<TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:gravity="center" android:text="Memory Game" android:visibility="visible" android:textSize="30sp" android:paddingTop="20sp" android:textColor="#EEFFAA" android:id="@+id/mainTitle"> </TextView> </TableRow> <TableRow android:id="@+id/TableRow02" android:layout_width="wrap_content" android:layout_height="wrap_content" android:gravity="center"> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="center" android:gravity="center" android:typeface="normal" android:bufferType="normal" android:textColor="#FFEEAA" android:id="@+id/myWebSite" android:text="http://www.aviyehuda.com"> </TextView> </TableRow> <TableRow android:id="@+id/TableRow03" android:layout_width="wrap_content" android:layout_height="wrap_content" android:gravity="center"> <LinearLayout android:id="@+id/LinearLayout01" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="center" android:gravity="center"> <ImageView android:id="@+id/ImageView01" android:layout_width="wrap_content" android:layout_height="wrap_content" android:background="@drawable/card1" android:layout_gravity="center"> </ImageView>

</LinearLayout> </TableRow>

</TableLayout>

card.java: package com.aviy.memory; import android.widget.Button; public class Card{

public int x; public int y; public Button button;

public Card(Button button, int x,int y) { this.x = x; this.y=y; this.button=button; }

Manager.java package com.aviy.memory;

import java.util.ArrayList; import java.util.List; import java.util.Random; import java.util.Timer; import java.util.TimerTask; import java.util.regex.Pattern;

import android.app.Activity; import android.content.Context; import android.graphics.drawable.Drawable; import android.os.Bundle; import android.os.Handler; import android.os.Message; import android.text.util.Linkify; import android.util.Log; import android.view.Gravity; import android.view.View; import android.view.View.OnClickListener; import android.widget.AdapterView;

import android.widget.ArrayAdapter; import android.widget.Button; import android.widget.Spinner; import android.widget.TableLayout; import android.widget.TableRow; import android.widget.TextView; import android.widget.AdapterView.OnItemSelectedListener;

public class Manager extends Activity { private static int ROW_COUNT = -1; private static int COL_COUNT = -1; private Context context; private Drawable backImage; private int [] [] cards; private List<Drawable> images; private Card firstCard; private Card seconedCard; private ButtonListener buttonListener;

private static Object lock = new Object();

int turns;

private TableLayout mainTable; private UpdateCardsHandler handler;

@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState);

handler = new UpdateCardsHandler(); loadImages(); setContentView(R.layout.main);

TextView url = ((TextView)findViewById(R.id.myWebSite)); Linkify.addLinks(url, Linkify.WEB_URLS);

backImage = getResources().getDrawable(R.drawable.icon);

/* ((Button)findViewById(R.id.ButtonNew)).setOnClickListener(new OnClickListener() {

@Override public void onClick(View v) {

newGame();

});*/

buttonListener = new ButtonListener();

mainTable = (TableLayout)findViewById(R.id.TableLayout03);

context = mainTable.getContext();

Spinner s = (Spinner) findViewById(R.id.Spinner01); ArrayAdapter adapter = ArrayAdapter.createFromResource( this, R.array.type, android.R.layout.simple_spinner_item); adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_ item); s.setAdapter(adapter);

s.setOnItemSelectedListener(new OnItemSelectedListener(){

@Override public void onItemSelected( android.widget.AdapterView<?> arg0, View arg1, int pos, long arg3){

((Spinner) findViewById(R.id.Spinner01)).setSelection(0);

int x,y;

switch (pos) { case 1: x=4;y=4; break; case 2: x=4;y=5; break; case 3: x=4;y=6; break; case 4:

x=5;y=6; break; case 5: x=6;y=6; break; default: return; } newGame(x,y);

@Override public void onNothingSelected(AdapterView<?> arg0) { // TODO Auto-generated method stub

}); }

private void newGame(int c, int r) { ROW_COUNT = r; COL_COUNT = c;

cards = new int [COL_COUNT] [ROW_COUNT];

mainTable.removeView(findViewById(R.id.TableRow01)); mainTable.removeView(findViewById(R.id.TableRow02));

TableRow tr = ((TableRow)findViewById(R.id.TableRow03)); tr.removeAllViews();

mainTable = new TableLayout(context); tr.addView(mainTable);

for (int y = 0; y < ROW_COUNT; y++) { mainTable.addView(createRow(y)); }

firstCard=null; loadCards();

turns=0; ((TextView)findViewById(R.id.tv1)).setText("Tries: "+turns);

private void loadImages() { images = new ArrayList<Drawable>();

images.add(getResources().getDrawable(R.drawable.card1)); images.add(getResources().getDrawable(R.drawable.card2)); images.add(getResources().getDrawable(R.drawable.card3)); images.add(getResources().getDrawable(R.drawable.card4)); images.add(getResources().getDrawable(R.drawable.card5)); images.add(getResources().getDrawable(R.drawable.card6)); images.add(getResources().getDrawable(R.drawable.card7)); images.add(getResources().getDrawable(R.drawable.card8)); images.add(getResources().getDrawable(R.drawable.card9)); images.add(getResources().getDrawable(R.drawable.card10)); images.add(getResources().getDrawable(R.drawable.card11)); images.add(getResources().getDrawable(R.drawable.card12));

images.add(getResources().getDrawable(R.drawable.card13)); images.add(getResources().getDrawable(R.drawable.card14)); images.add(getResources().getDrawable(R.drawable.card15)); images.add(getResources().getDrawable(R.drawable.card16)); images.add(getResources().getDrawable(R.drawable.card17)); images.add(getResources().getDrawable(R.drawable.card18)); images.add(getResources().getDrawable(R.drawable.card19)); images.add(getResources().getDrawable(R.drawable.card20)); images.add(getResources().getDrawable(R.drawable.card21));

private void loadCards(){ try{ int size = ROW_COUNT*COL_COUNT;

Log.i("loadCards()","size=" + size);

ArrayList<Integer> list = new ArrayList<Integer>();

for(int i=0;i<size;i++){ list.add(new Integer(i));

Random r = new Random();

for(int i=size-1;i>=0;i--){ int t=0;

if(i>0){ t = r.nextInt(i); }

t=list.remove(t).intValue(); cards[i%COL_COUNT][i/COL_COUNT]=t%(size/2);

Log.i("loadCards()", "card["+(i%COL_COUNT)+ "]["+(i/COL_COUNT)+"]=" + cards[i%COL_COUNT][i/COL_COUNT]); } } catch (Exception e) { Log.e("loadCards()", e+"");

private TableRow createRow(int y){ TableRow row = new TableRow(context); row.setHorizontalGravity(Gravity.CENTER);

for (int x = 0; x < COL_COUNT; x++) { row.addView(createImageButton(x,y)); } return row; }

private View createImageButton(int x, int y){ Button button = new Button(context); button.setBackgroundDrawable(backImage); button.setId(100*x+y); button.setOnClickListener(buttonListener); return button; }

class ButtonListener implements OnClickListener {

@Override public void onClick(View v) {

synchronized (lock) { if(firstCard!=null && seconedCard != null){ return; } int id = v.getId(); int x = id/100; int y = id%100; turnCard((Button)v,x,y); }

private void turnCard(Button button,int x, int y) { button.setBackgroundDrawable(images.get(cards[x][y]));

if(firstCard==null){ firstCard = new Card(button,x,y);

} else{

if(firstCard.x == x && firstCard.y == y){ return; //the user pressed the same card }

seconedCard = new Card(button,x,y);

turns++; ((TextView)findViewById(R.id.tv1)).setText("Tries: "+turns);

TimerTask tt = new TimerTask() {

@Override public void run() { try{ synchronized (lock) { handler.sendEmptyMessage(0); } }

catch (Exception e) { Log.e("E1", e.getMessage()); } } };

Timer t = new Timer(false); t.schedule(tt, 1300); }

class UpdateCardsHandler extends Handler{

@Override public void handleMessage(Message msg) { synchronized (lock) { checkCards(); }

} public void checkCards(){ if(cards[seconedCard.x][seconedCard.y] == cards[firstCard.x][firstCard.y]){ firstCard.button.setVisibility(View.INVISIBLE); seconedCard.button.setVisibility(View.INVISIBLE); } else { seconedCard.button.setBackgroundDrawable(backImage); firstCard.button.setBackgroundDrawable(backImage); }

firstCard=null; seconedCard=null; } } }

SCREENSHOTS:

WINTER TRAINING REPORT


ANDROID APPLICATION DEVELOPMENT @ Peripheral software solutions & Printech

Você também pode gostar