MOTORBIKE GP FOR ALL DEVICE


THE BEST HD MOTOR BIKE RACING GAME IS HERE WITH THE BEST GRAPHIC COMPADIBLE IN OUR PHONE






EXTRACT THE DATA AT SD CARD/HERE

ROOT REQUIRED: NO





8.0'' HD Android 1.5GHz Onda vi30 dual-core tablet PC new exposure

After the 9.7'' IPS Android tablet Onda vi40 dual-core edition come out.Now we have another dual-core tablet--Onda vi30 dual-core edition--coming.And the price would be around US $199.00 only for 8gb.

From the exposure,we can see Onda vi30 dual-core edition has a 8.0'' capacitive multi-touch screen and the resolution would be 1024*768 pixel.It uses 1.5GHz AmLogic AML8726-MX dual-core chip,1GB DDR3 RAM and 8GB internal storage.It comes with Google Android 4.0 ics operation system.Its front has a 0.3MP camera,which can be used to taking pictures or Skype video chat etc.It only has a Home buton in front,while the back has stereo speakers.The thickness is 10mm.The expansion ports include DC,miniUSB,HDMI,TF card slot and 3.5mm headphone port.Overall hardware is quit good.



If you are interested in this product.Please contact us for more detail.

The Amazing Spider-Man APK + DATA (WVGA ONLY)


Clean out
 the thugs and super-villains from NYC in this Super Hero journey!











The Amazing Spider-Man v1.0.8 play.google.com.GloftAMHM
Get ready for intense web-slinging action with The Amazing Spider-Man! Join Spidey in the official game app of this highly anticipated 2012 blockbuster! Play through the movie storyline as Spider-Man faces off against the Lizard and rampaging gangs. Web-sling and crawl your way through an open, fully 3D New York while using your amazing skills to save the city.

THE OFFICIAL GAME OF 2012’s HIGHLY AWAITED SUPER HERO BLOCKBUSTER

  • Fight the Lizard and his minions to put a stop to his dark schemes.
  • Play The Amazing Spider-Man through more than 25 immersive missions inspired by the upcoming movie's storyline.
  • Climb, jump and web-sling from building to building for an aerial thrill like never before!
FREE NEW YORK CITY
  • Explore the city through its five distinctive districts (Central Park, Business, Downtown, Pier and Residential)
  • An exciting and enjoyable fighting system with melee, ranged, combo attacks and much more
  • A wide selection of upgrades to customize your style, attacks and skills
A HIGH PRODUCTION-VALUE GAME
  • Explore an open-world Manhattan, teeming with action. Discover random missions, collectibles and more secrets in the City that Never Sleeps!
  • Fight in a fully 3D New York City with cutting-edge graphics. 
  • Advanced shaders and visual effects make Spider-Man more realistic than ever before!
Required Android O/S : 2.2+

Screenshots :







Download : 8Mb APK

Download : 560Mb Cache File Part1 Part2 Part3
Instructions:
  1. Install the APK
  2. Download the obb file 
  3. Extract the obb file with 7-zip and put data to 'sdcard/android/data/com.gameloft.android.ANMP.GloftAMHM/files/'
  4. Launch the Game with internet connection.
If you ignore the 3nd instruction you will get a License error.

GameStop plans to sell Nexus 7, begins taking Android tablet trade-ins

Android SDK Tools, Revision 20


[This post is by Xavier Ducrohet, Tech Lead for the Android developer tools]



Along with the preview of the Android 4.1 (Jelly Bean) platform, we launched Android SDK Tools R20 and ADT 20.0.0. Here are a few things that we would like to highlight.

    Application templates: Android ADT supports a new application templates for creating new application, blank activity, master-detail flow, and custom view. These templates support the Android style guide thus making it faster and easier to build beautiful apps. More templates will be added over time.






    Tracer for GLES: With this new tool you can capture the entire sequence of OpenGL calls made by an app into a trace file on the host and replay the captured trace and display the GL state at any point in time.



    Device Monitor: To help you to easily debug your apps, all the Android debugging tools like DDMS, traceview, hierarchyviewer and Tracer for GLES are now built into one single application.

    Systrace: Improving app performance does not have to be a guesswork any more. Systrace for Jelly Bean and above lets you easily optimize your app. You can capture a slice of system activity plus additional information tagged from the Settings > Developer Options > Monitoring: Enable traces or with specific calls added to your application code.






To learn more on the layout editor, XML editing, build system & SDK Manager improvements, please read the ADT 20.0.0 and SDK Tools R20 release notes.



Join us today, June 28th, at the “What’s new in Android developer tools” session for some fun tool demos and a sneak-peak into what’s coming next.

Android @ I/O: the playground is open

Last year at Google I/O, we talked about momentum, mobile and more. This year, we’re picking up right where we left off. More than 400 million Android devices have now been activated—up from 100 million last June. And twelve new Android devices are activated every every second—that’s more than 1 million a day. Today, we’re rolling out a new version of Android called Jelly Bean, adding more entertainment to Google Play, and introducing two powerful—yet distinctly different Nexus devices to bring you the best of Google.

Jelly Bean: simple, beautiful and beyond smart
Jelly Bean builds on top of Ice Cream Sandwich. It makes everything smoother, faster and more fluid. For example, notifications are now more dynamic: if you’re late for a meeting or missed a call, you can email or call directly from notifications. The keyboard is smarter and more accurate, and can predict your next word. And voice typing is faster, working even when you don’t have a data connection.

We’ve redesigned search from the ground up in Jelly Bean, with a new user interface and faster, more natural Voice Search. You can type your query or simply ask Google a question. Google can speak back to you, delivering a precise answer, powered by the Knowledge Graph, if it knows one, in addition to a list of search results.

Today’s smart devices still rely on you to do pretty much everything—that is, until now. Google Now is a new feature that gets you just the right information at just the right time. It tells you today’s weather before you start your day, how much traffic to expect before you leave for work, or your favorite team's score as they’re playing. There’s no digging required: cards appear at the moment you need them most.



Starting in mid-July, we’ll start rolling out over-the-air updates to Galaxy Nexus, Motorola Xoom and Nexus S, and we’ll also release Jelly Bean to open source.

Google Play: more entertainment
Google Play is your digital entertainment destination, with more than 600,000 apps and games plus music, movies and books. It’s entirely cloud-based, which means all of your content is always available across all of your devices. Today our store is expanding to include magazines. We’ve been working with leading publishers Condé Nast, Hearst, Meredith and more to offer magazines like House Beautiful, Men’s Health, Shape and WIRED.

Now, you can also purchase movies in addition to renting them. And we’re adding television shows on Google Play—in fact, we’re adding thousands of episodes of broadcast and cable TV shows, like "Revenge," "Parks & Recreation" and "Breaking Bad," from some of the top studios, like ABC Studios, NBCUniversal and Sony Pictures. You can play back movies and TV shows on all your Android devices, through Google Play on the web, and on YouTube, and soon we’ll bring the experience to Google TV devices.

Movie purchases, TV shows and magazines are available today on play.google.com, and will roll out to Google Play on devices over the coming days.

Nexus 7: powerful, portable and designed for Google Play
All of this great Google Play content comes to life on Nexus 7, a powerful new tablet with a vibrant, 7” 1280x800 HD display. The Tegra-3 chipset, with a quad-core CPU and 12-core GPU, makes everything, including games, extremely fast. And best of all, it’s only 340 grams, lighter than most tablets out there. Nexus 7 was built to bring you the best of Google in the palm of your hand. Hang out with up to 10 friends on Google+ using the front-facing camera, browse the web blazingly fast with Chrome and, of course, crank through your emails with Gmail.



Nexus 7 comes preloaded with some great entertainment, including the movie "Transformers: Dark of the Moon," the book “The Bourne Dominion,” magazines like Condé Nast Traveler and Popular Science, and songs from bands like Coldplay and the Rolling Stones. We’ve also included a $25 credit to purchase your favorite movies, books and more from Google Play, for a limited time. Nexus 7 is available for preorder today from Google Play in the U.S., U.K., Canada and Australia, and starts at $199 in the U.S. It will start shipping mid-July.

Nexus Q: It’s a sphere!
It's great to be able to take your entertainment with you wherever you go, but sometimes you want to ditch the headphones and enjoy music with friends and family. So we’re introducing Nexus Q, which combines the power of Android and Google Play to easily stream music and video in your home—all controlled by an Android phone or tablet. Designed and engineered by Google, Nexus Q is a small sphere that plugs into the best speakers and TV in your house. It’s the first-ever social streaming device—like a cloud-connected jukebox where everyone brings their own music to the party. Available first in the U.S., you can preorder Nexus Q today from Google Play for $299, and it will ship mid-July.



If you own one of the 400 million Android devices out there, you already know that it’s much more than simply a phone or tablet. It’s your connection to the best of Google—all of your stuff and entertainment, everywhere you go. Now you have a new version of Android, more entertainment and a growing portfolio of Nexus devices to choose from—all available in Google Play. The playground is open.

Introducing Android 4.1 (Jelly Bean) preview platform, and more


[This post is by Angana Ghosh, Product Manager on the Android team]







At Google I/O today we announced the latest version of the Android platform, Android 4.1 (Jelly Bean). With Jelly Bean, we’ve made the great things about Android even better with improved system performance and enhanced user features.



Improvements include a smoother and more responsive UI across the system, a home screen that automatically adapts to fit your content, a powerful predictive keyboard, richer and more interactive notifications, larger payload sizes for Android Beam sharing and much more. For a lowdown on what’s new, head over to the Jelly Bean platform highlights.



Of course, Jelly Bean wouldn’t be complete without a healthy serving of new APIs for app developers. Here are some of the new APIs that Jelly Bean introduces:

    Expandable notifications: Android 4.1 brings a major update to the Android notifications framework. Apps can now display larger, richer notifications to users that can be expanded and collapsed with a pinch. Users can now take actions directly from the notification shade, and notifications support new types of content, including photos.

    Android Beam: In Android 4.1, Android Beam makes it easier to share images, videos, or other payloads by leveraging Bluetooth for the data transfer.

    Bi-directional text support: Android 4.1 helps you to reach more users through support for for bi-directional text in TextView and EditText elements.

    Gesture mode: New APIs for accessibility services let you handle gestures and manage accessibility focus. Now you can traverse any element on the screen using gestures, accessories, you name it.

    Media codec access: Provides low-level access to platform hardware and software codecs.

    Wi-Fi Direct service discoverability: New API provides pre-associated service discovery letting apps get more information from nearby devices about the services they support, before they attempt to connect.

    Network bandwidth management: New API provides ability to detect metered networks, including tethering to a mobile hotspot.

For a complete overview of new APIs in Jelly Bean, please read the API highlights document. Note that this is a preview of the Jelly Bean platform. While we’re still finalizing the API implementations we wanted to give developers a look at the new API to begin planning app updates. We’ll be releasing a final platform in a few weeks that you should use to build and publish applications for Android 4.1.



For Android devices with the Google Play, we launched the following at Google I/O today:

    Smart app updates: For Android 2.3, Gingerbread devices and up, when there is a new version of an app in Google Play, only the parts of the app that changed are downloaded to users’ devices. On average, a smart app update is a third the size of a full apk update. This means your users save bandwidth and battery and the best part? You don’t have to do a thing. This is automatically enabled for all apps downloaded from Google Play.

    App encryption: From Jelly Bean and forward, paid apps in Google Play are encrypted with a device-specific key before they are delivered and stored on the device. We know you work hard building your apps. We work hard to protect your investment.

    Google Cloud Messaging for Android: This is the next version of C2DM and goes back to Froyo. Getting started is easy and has a whole bunch of new APIs than C2DM has to offer. If you sign-up for GCM, you will be able to see C2DM and GCM stats in the Android developer console. Most importantly, the service is free and there are no quotas. [Learn more.]

Starting from today, over 20 Android sessions at Google I/O will deep-dive in many of these areas. Join us in-person or follow us live.

A new friend just moved into the neighborhood...

The statues on the front lawn of the Android building got a new friend this afternoon...
   

Also, you may have noticed we did a little redecorating. We’ve been asking you what content you wanted to see more of on the Google Mobile blog, and the answer was quite clear: more Android! This blog, in addition to the +Android page on Google+, will be your place to find all the latest news from the Android team.

See you tomorrow at I/O!

Posted by: Hugo Barra, Director of Product Management, Android

Replying to User Reviews on Google Play

[This post is by Trevor Johns from the Android team — Tim Bray]

User reviews on Google Play are great for helping people discover quality apps and give feedback to developers and other potential app users. But what about when developers want to give feedback to their users? Sometimes a user just needs a helping hand, or perhaps a new feature has been added and the developer wants to share the good news.

That’s why we’re adding the ability for Google Play developers to respond to reviews from the Google Play Android Developer Console. Developers can gather additional information, provide guidance, and — perhaps most importantly — let users know when their feature requests have been implemented.

We’ll also notify the user who wrote the review via email that the developer has responded. Users can then contact the developer directly if additional followup is needed or update their review.

We’re releasing this feature today to those with a Top Developer badge (). And based on feedback from users and developers, we will offer it to additional Google Play developers in the future.

Conversations are meant to be two-sided, and facilitating discussion between developers and users will ultimately yield better apps, to the benefit of everyone.

Helping you build beautiful, powerful, successful apps

[This post is by Billy Rutledge, Director of Developer Relations for Android. — Tim Bray]

Just in time for Google I/O next week, the Android Developers site is stepping into a new look that is streamlined, simplified, and refocused. A developer’s tasks fall into three baskets: Designing, developing, and distributing. We're trying to make developer.android.com's organization reflect this reality, shepherding you through the app development life cycle, from start to finish.

Design

Earlier this year, we launched Android Design, an online style guide which lays out the principles, building blocks, and patterns for excellence in Android user interfaces. It seems to be working; every day, we see more and more beautiful apps arriving in Google Play. At I/O, we’ll continue to talk design, kicking off with Android Design for Success, led by Matias Duarte.

Develop

An Android app should be fast, powerful and useful. With Android Training, one of the many parts of the Develop section that we continue to build out, we lay out best practices in a variety of framework topics to help you achieve those goals. If you’re at I/O and you’re interested in Android tools, be sure to start off your show with What’s new in Android Developers’ Tools.

Distribute

The most important piece of the piece of the puzzle is about getting your app in front of millions and millions of Android users on Google Play. That’s why we added a section on distributing your app — a peek into the world of publishing and promoting your app. Chris Yerga on the Play team will be kicking off our how-to sessions on distributing your with Android apps in Google Play.

This is just a small sample of the Android sessions at Google I/O, many of which will be live-streamed so you can follow along even if you can’t make it out to San Francisco. In the meantime, we hope you find the new Android Developer site much more useful as you build great apps.



Join the discussion on

+Android Developers



Rockchip RK3066 dual-core Ployer 3 kinds of game tablets new exposure

Nowadays,there are more and more dual-core Android tablets.Ployer,one of tablet manufacturers from China,is also going to release 3 kinds of dual-core tablets.As we know,they will be named as MOMO11 speed edition,MOMO8 speed edition and MOMO7 speed edition.They all use up to 1.6GHz processor speed brand new dual-core program.

9.7'' IPS dual-core  Android tablet -- Ployer MOMO11 speed edition
MOMO11 speed edition would be the first one going to release.It targets on advanced professional users.It uses dual-core Cortex-A9 program,the processor speed can be up to 1.6GHz.Also comes with 9.7'' IPS HD touch screen and big capacitity battery.Official people said it would get improved from the MOMO11 bird edition.


8'' capacitive Android tablet -- Ployer MOMO8 speed edition
MOMO8 speed edition also uses 1.6GHz dual-core CPU,which would improve the 1080P HD videos,HDMI output,dual cameras,WiFi/3G etc functions' performance.The 8'' capacitive HD size can be more flexible indoors or outdoors.

7'' IPS dual-core Android Tablet -- Ployer MOMO7 speed edition
7'' IPS and 1.6GHz dual-core CPU can be very competitive among those 7'' tablets.

Though Ployer did not publish the specification detail.But 1.6GHz dual-core CPU,we think it must be Rockchip RK3066 program.

BUGS WAR 3D

THE BEST 3D GAME WITH THE NICE GRAPHICS IS NOW ON THE BLOG


HERE THE EARTH IS ATTACK BY THE ALIEN AND WE HAVE TO SAVE THE PEOPLE






ROOT REQUIRED : YES (FOR ONLY LUCKY PATCHER)


Fix "start kernel failed" for Zenithink C91 upgrade zt-282 edition

For some Zenithink users may face the following message "start kernel failed press CAMERA KEY to update".If this occurs,please firstly try to re-install the firmware.If that not works,please try the following steps:

Note:This is a example for Zenithink C91 upgrade zt-282 H3_1a 8gb edtion. If you have other device or not sure what version you have,please ask us to confirm by providing your serial number in the tablet first.

1.Charge your tablet and get ready one formatted micro-SD card (2gb is recommended);
2.Download the latest firmware from http://zenithink.com/Eproducts_C91_2.php?download ;Extract it and find the "zt-update" folder and copy the folder into the root of micro-sd card;
3.Download the autoscript,spl: http://www.mediafire.com/?1sg43lpfuzr93tb ; extract it you will get 3 files and copy the 3 files into the "zt-update" folder in the sd card;
4.Turn of your tablet,and insert the sd card into the tablet and power up.It will auto update;
5.When it is over,power off the tablet.Eject sd card and delete the files: autoscript,ZT282.spl;
6.Insert the sd card back to the tablet,press "back" button (top right corner),at the same time,press power button until it goes to update mode.follow the instruction in the screen and do the update.

After finish,try to reboot your tablet see if it works.

If you have any doubt about this,don't hesitate to let us know.

Not fear of "big brand":Gemei dual-core G9T vs Samsung Galaxy Tab P7510

Coming to 2012,tablet PCs become hotter and hotter.Their popularity even beyonds our daily mobile phones.While,the quality and hardware become better and better.


From the day Gemei released the dual-core Android tablet--G9T, it has attracted lots of attention.Today,we would compare it with the hottest Samsung Glaxy Tab--10.1'' P7510 tablet.

1).SPECIFICATION
MODEL GEMEI G9T SAMSUNG P7510
CPU AMLogic Nvidia Tegra2
Chip 40NM 45NM
Memory 1GB 1333MHz 1GB
Internal Storage 16GB 16GB
GPU 400MHz mali400MP2 ULP-GeForce
Display 9.7'' 4:3 1024*768pixel 10.1'' 16:9 1280*800pixel
Display material iPad 2nd generation IPS TFT
WiFi Broadcom WiFi mode normal Wifi mode
Flash Hardware decoding Software decoding
Video 1080P FULL HD 720P
Camera front 0.3mp+back 2.0mp front 2.0mp+back 3.0mp
OS Android 4.0 ICS Android 3.1
Body material aluminium alloy metal shell plastic
Battery 8000mAh 7000mAh
Price $309.00 (tablets-world.com) over $500.00


2).APPERANCE
Gemei G9T uses aluminium alloy metal shell with G+G ultra-thin IPS touch screen,it's lighter and looks more fashionable.4:3 display is more convenient for Web,e-books.

While,Samsung Galaxy Tab P7510 uses plastic.16:9 display is more convenient for watching movies.

3).DISPLAY PERFORMANCE
Gemei G9T uses original iPad 2nd generation IPS touch screen,which has very good performance on brightness,defination,viewing angle and so on.

After put the brightness into largest,from the front looking,they almost have no difference.But we can still see G9T is brighter.

Viewing the pictures in hands,the Gemei G9T 4:3 size display is more convenient.The P7510 is little longer.4:3 is better for reading e-books.

From the side viewing angle,Gemei G9T still has very good performance,while the Samsung P7510 is little yellow.

Open a web page,we can still see Gemei G9T has better display performance.

SUMMARY
Though Samsung Galaxy Tab P7510 is a strong Android tablet,but after compared with it,Gemei G9T still looks good.If you want to have dual-core Android tablet with clear IPS touch screen similar with iPad,then Gemei G9T would be a good choice.

http://www.tablets-world.com/android/dual-core-cpu-9.7---ips-android-4.0-tablet-pc-gemei-g9t-wifi-n-3g-dual-camera/136/

COGS ALSO WORKING ON LOW END DEVICE LIKE GALAXY Y

Description
Get your mental gears going with this award-winning puzzle game!
Cogs is a ground-breaking puzzle game where players build increasingly complex machines using sliding tiles in 2D and 3D environments. It comes with 50 puzzles and three gameplay modes for a total of 150 unique challenges, totalling more than 10 hours of mind-bending gameplay. This award-winning game is perfect for puzzle fans of any age and ability!







***If you receive an "incorrect version for this device" error, please email us! If you are using Chainfire3D, please set it to support PVR or uninstall it to play Cogs***
“It is awesome.” – TouchArcade
"One of the highest quality puzzle games we've seen." – PocketGamer
“The visual design and imagination of the game are stunning, with great attention to detail, and the sound effects are downright enticing.” – Adrenaline Vault
“If a sliding puzzle was a wheel, consider it re-invented!” – TouchGen
“A masterpiece visually, as well with the actual gameplay.” – AppAdvice
INVENTOR MODE
Starting with simple puzzles, players are introduced to the widgets that are used to build machines — gears, pipes, balloons, chimes, hammers, wheels, props, and more.
TIME CHALLENGE MODE
If you finish a puzzle in Inventor Mode, it will be unlocked here. This time, it will take fewer moves to reach a solution, but you only have 30 seconds to find it.
MOVE CHALLENGE MODE
Take your time and plan ahead. Every click counts when you only get ten moves to find a solution.
LEADERBOARD AND ACHIEVEMENTS THROUGH OPENFEINT
Unlock achievements, see how you stack up on global leaderboards, and play with friends!

APK: http://adf.ly/9lAT1

INSTRUCTION FOR PLAYING GAME ON GALAXY Y OR OTHER LOW END DEVICE IF THIS GAME DOESNOT WORK NORMALLY AND PHONE GETS HANG THAN FOLLOW FOLLOWING 

REQUIRES ROOT ACCESS AND CHINFIRE 3D

OPEN CF3D (CHAINFIRE 3D) 
OPEN DEFULT GL SETTINGS 
TICK REDUCE TEXTURE SIZE 
TICK REDUCE TEXTURE QUALITY
CHOOSE PLUGIN: QUALCOMM

THE GAME WORKS VERY WELL

ENJOY THE GAME :)


Using DialogFragments

[This post is by David Chandler, Android Developer Advocate — Tim Bray]

Honeycomb introduced Fragments to support reusing portions of UI and logic across multiple activities in an app. In parallel, the showDialog / dismissDialog methods in Activity are being deprecated in favor of DialogFragments.



In this post, I’ll show how to use DialogFragments with the v4 support library (for backward compatibility on pre-Honeycomb devices) to show a simple edit dialog and return a result to the calling Activity using an interface.
For design guidelines around Dialogs, see the Android Design site.

The Layout

Here’s the layout for the dialog in a file named fragment_edit_name.xml.

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/edit_name"
android:layout_width="wrap_content" android:layout_height="wrap_content"
android:layout_gravity="center" android:orientation="vertical" >

<TextView
android:id="@+id/lbl_your_name" android:text="Your name"
android:layout_width="wrap_content" android:layout_height="wrap_content" />

<EditText
android:id="@+id/txt_your_name"
android:layout_width="match_parent" android:layout_height="wrap_content"
android:inputType=”text”
android:imeOptions="actionDone" />
</LinearLayout>

Note the use of two optional attributes. In conjunction with android:inputType=”text”, android:imeOptions=”actionDone” configures the soft keyboard to show a Done key in place of the Enter key.

The Dialog Code

The dialog extends DialogFragment, and since we want backward compatibility, we’ll import it from the v4 support library. (To add the support library to an Eclipse project, right-click on the project and choose Android Tools | Add Support Library...).

import android.support.v4.app.DialogFragment;
// ...

public class EditNameDialog extends DialogFragment {

private EditText mEditText;

public EditNameDialog() {
// Empty constructor required for DialogFragment
}

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.fragment_edit_name, container);
mEditText = (EditText) view.findViewById(R.id.txt_your_name);
getDialog().setTitle("Hello");

return view;
}
}

The dialog extends DialogFragment and includes the required empty constructor. Fragments implement the onCreateView() method to actually load the view using the provided LayoutInflater.

Showing the Dialog

Now we need some code in our Activity to show the dialog. Here is a simple example that immediately shows the EditNameDialog to enter the user’s name. On completion, it shows a Toast with the entered text.

import android.support.v4.app.FragmentActivity;
import android.support.v4.app.FragmentManager;
// ...

public class FragmentDialogDemo extends FragmentActivity implements EditNameDialogListener {

@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
showEditDialog();
}

private void showEditDialog() {
FragmentManager fm = getSupportFragmentManager();
EditNameDialog editNameDialog = new EditNameDialog();
editNameDialog.show(fm, "fragment_edit_name");
}

@Override
public void onFinishEditDialog(String inputText) {
Toast.makeText(this, "Hi, " + inputText, Toast.LENGTH_SHORT).show();
}
}

There are a few things to notice here. First, because we’re using the support library for backward compatibility with the Fragment API, our Activity extends FragmentActivity from the support library. Because we’re using the support library, we call getSupportFragmentManager() instead of getFragmentManager().

After loading the initial view, the activity immediately shows the EditNameDialog by calling its show() method. This allows the DialogFragment to ensure that what is happening with the Dialog and Fragment states remains consistent. By default, the back button will dismiss the dialog without any additional code.

Using the Dialog

Next, let’s enhance EditNameDialog so it can return a result string to the Activity.

import android.support.v4.app.DialogFragment;
// ...
public class EditNameDialog extends DialogFragment implements OnEditorActionListener {

public interface EditNameDialogListener {
void onFinishEditDialog(String inputText);
}

private EditText mEditText;

public EditNameDialog() {
// Empty constructor required for DialogFragment
}

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.fragment_edit_name, container);
mEditText = (EditText) view.findViewById(R.id.txt_your_name);
getDialog().setTitle("Hello");

// Show soft keyboard automatically
mEditText.requestFocus();
getDialog().getWindow().setSoftInputMode(
LayoutParams.SOFT_INPUT_STATE_VISIBLE);
mEditText.setOnEditorActionListener(this);

return view;
}

@Override
public boolean onEditorAction(TextView v, int actionId, KeyEvent event) {
if (EditorInfo.IME_ACTION_DONE == actionId) {
// Return input text to activity
EditNameDialogListener activity = (EditNameDialogListener) getActivity();
activity.onFinishEditDialog(mEditText.getText().toString());
this.dismiss();
return true;
}
return false;
}
}

For user convenience, we programmatically focus on the EditText with mEditText.requestFocus(). Alternatively, we could have used the <requestFocus/> tag in the layout XML to do this; however, in some cases it’s preferable to request focus programmatically. For example, an OnFocusChangeListener added in the Fragment’s onCreateView() method won’t get called if you request focus in the layout XML.

If the user focuses on an EditText, the soft keyboard will automatically appear. In order to force this to happen with our programmatic focus, we call getDialog().getWindow().setSoftInputMode(). Note that many Window operations you might have done previously in a Dialog can still be done in a DialogFragment, but you have to call getDialog().getWindow() instead of just getWindow(). The resulting dialog is shown on both a handset and tablet (not to scale):

The onEditorAction() method handles the callback when the user presses the Done key. It gets invoked because we’ve set an OnEditorActionListener on the EditText. It calls back to the Activity to send the entered text. To do this, EditNameDialog declares an interface EditNameDialogListener that is implemented by the Activity. This enables the dialog to be reused by many Activities. To invoke the callback method onFinishEditDialog(), it obtains a reference to the Activity which launched the dialog by calling getActivity(), which all Fragments provide, and then casts it to the interface type. In MVC architecture, this is a common pattern for allowing a view to communicate with a controller.

We can dismiss the dialog one of two ways. Here we are calling dismiss() within the Dialog class itself. It could also be called from the Activity like the show() method.

Hopefully this sheds some more light on Fragments as they relate to Dialogs. You can find the sample code in this blog post on Google Code.

References for learning more about Fragments:

Apply to be a Chitika Publisher!
Related Posts Plugin for WordPress, Blogger...
 
android tablet © 2012 | Designed by Cheap TVS, in collaboration with Vegan Breakfast, Royalty Free Images and Live Cricket Score