Tuesday, May 7, 2013

Ricky Carmichael's Motocross v1.1.0 APK Android


Try to own your friends and rivals in this newest installment from the team that brought you the hits 2XL Supercross, 2XL MX Offroad, X Games Snocross and XLR8.

Ricky Carmichael Motocross Matchup Pro is an all-new racing game where it’s just you against online competitors from around the globe! This includes the chance to bang bars with some the of best in the business, including Ricky Carmichael himself!


Play Matchup mode and go head-to-head on both indoor (based on the real 2011 Supercross track layouts) and outdoor nationals tracks, including Ricky’s very own backyard.

Collect in-game prizes that you can use to upgrade your ride and give you the edge to beat the competition! Earn in-game currency for free while racing. Currency can also be purchased to speed up your bike and rider progression!

Choose from a wide selection of avatars! Pick a rider outfitted in all of the latest Fox gear riding official Suzuki racing bikes to special characters on their own personalized machines.

Key Features:

- Gesture based stunt system
- Full achievement system and leaderboards
- 5 indoor and 5 outdoor tracks to master
- Track layouts based on the 2011 Supercross season
- 2 modes of play: Practice and Online Multiplayer Matchup
- Select your appearance from a huge selections of bikes and riders
- Special characters you can purchase and race with
- Multiple camera views including first person with handle bars
- Select from multiple preset control schemes
- Responsive tilt steering interface
- Level up to upgrade your bike and rider
- Now supports the AppFinity AppDrive from Spin Master!

Click Here To Download
Direct Download Link - Direct Download Link


Drag Racing v1.6.2 Apk Android


- Drive 50+ officially licensed cars, from hot hatches to american muscle and 1000HP supercars
- Buy your dream car, install performance upgrades and show your skills in 1/4 or 1/2 mile races
- Challenge millions of players online: race 1 on 1, drive your opponent's car, or participate in real-time 10-player races in Pro League


LOTS OF CARS:
Would you pick an iconic Skyline GT-R, a classic 69' Mustang, or a brand new BMW M3 as your ultimate driving machine? Do you dream about seeing 1000+ HP exotics pushed to the limit on a drag strip? This game includes virtually every sports car for you to enjoy.

UNLIMITED DEPTH:
Do you think racing in a straight line is easy? Try to find the right balance between power and grip while staying in your class. Add nitrous oxide for more fun, but don't push the button too early. Go deeper and adjust gear ratios to shave off precious milliseconds. Think you can challenge a world record or win 10 tournaments in a row? Welcome aboard.

COMPETITIVE MULTIPLAYER:
Racing on your own may be fun enough, but the ultimate challenge is in the "Online" section. Go head-to-head against your friends or random racers, beat them while driving their own cars, or race against 9 players at once in real-time competitions. Join a team to exchange tunes, discuss strategy and share your achievements.

TRY THIS ONE:
- Drag Racing: Bike Edition - the long-awaited extension with 17 sportbikes, brand new game modes, upgrades and WHEELIES!

***

REVIEWS IN THE PRESS:
Named among 10 best Android games of 2011 by NY Times blog!

"With so many cars to choose from, a virtually unlimited pool of opponents, and so many parts to upgrade, we think you'll love it."
- Jaymar Cabebe, CNET.com

"Mega-addictive and with bags of longevity to boot. Drag racing is a well-conceived, well executed racer that’ll keep petrolheads coming back for more."
- Michael Brook, Life of Android

***

TIPS:
0. Updating the game
- Your cars and money are saved on your device. DO NOT EVER uninstall the game before updating, or you will lose ALL of your stuff.
1. Racing
- Launch and shift when the dashboard indicator turns blue or green
- If there is too much wheelspin, you are not going anywhere - watch the orange indicator on your dashboard
- Once you learn how to drive properly, ignore the lights and find your own winning strategy
- Nitrous is more effective on underpowered cars with lots of grip. Timing is crucial!

2. Cars and upgrades
- Test drive before you buy a car!
- The more your car costs, the tougher opposition you'll face both offline and online
- Upgrades count towards increasing car cost/level, while tuning doesn't
- Keep your car cost just under your level cap to get an advantage
- Adjusting gear ratios (Garage -> Upgrade -> Tune) is costly, but lets you achieve times that are impossible on stock settings

3. Game modes and winnings
- Race against beginner/amateur AI to get some quick cash and build your car
- Defeat bosses and unlock achievements for extra RP
- Go online and race against others to earn maximum cash/RP
- If your car isn't ready for online races, earn some cash in "Drivers Battle"
- For the ultimate challenge, race against top players in Pro League

4. Misc
- Like http://facebook.com/DragRacingGame for news and strategy
- Visit the official forums: http://www.dragracingforum.net
- Try playing with vibration on (enable it in the "Settings" menu)!
- If the game runs slow on your phone, use the task manager to kill unnecessary background tasks
- XPERIA PLAY Optimized

Click Here To Download
Direct Download Link - Direct Download Link


Set ViewPort of WebView

According to Android Developer document : The method WebSettings.setUseWideViewPort() tells the WebView to use a wide viewport. The default is false. And the method WebSettings.setLoadWithOverviewMode() sets whether the WebView loads pages in overview mode. The default is false.

It's not too clear for me. As my understanding, setUseWideViewPort(true) will try to make the WebView have a normal viewport as desktop browser, setUseWideViewPort(false) make the WebView have a mobile viewport of mobile for phone. setLoadWithOverviewMode(true) will loads the WebView in full zoomed out. In my testing, it's more or less depends on the target html.


WebView with WebSetting.setUseWideViewPort(true)

WebView with WebSetting.setUseWideViewPort(false)


package com.example.androidwebview;

import android.os.Bundle;
import android.app.Activity;
import android.webkit.WebView;
import android.webkit.WebViewClient;

public class MainActivity extends Activity {

WebView myWebView;
//final static String myAddr = "http://android-er.blogspot.com";
final static String myAddr = "http://developer.android.com/";

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
//setContentView(R.layout.activity_main);
myWebView = new WebView(this);

myWebView.getSettings().setUseWideViewPort(true);
myWebView.getSettings().setLoadWithOverviewMode(true);

myWebView.getSettings().setJavaScriptEnabled(true);
myWebView.setWebViewClient(new MyWebViewClient());
myWebView.loadUrl(myAddr);
setContentView(myWebView);

}

private class MyWebViewClient extends WebViewClient {

@Override
public boolean shouldOverrideUrlLoading(WebView view, String url) {
view.loadUrl(url);
return true;
}

}

}


remark: uses-permission of "android.permission.INTERNET" is needed.

download filesDownload the files.

Next:
- Set user-agent string of WebView

Monday, May 6, 2013

Professional NFC Application Development for Android


A practical guide to developing and deploying Near Field Communication (NFC) applications

There has been little practical guidance available on NFC programming, until now. If you're a programmer or developer, get this unique and detailed book and start creating apps for this exciting technology. NFC enables contactless mobile communication between two NFC-compatible devices. It's what allows customers to pay for purchases by swiping their smartphones with Google Wallet, for example. This book shows you how to develop NFC applications for Android, for all NFC operating modes: reader/writer, peer-to-peer, and card emulation.
The book starts with the basics of NFC technology, an overview of the Android OS, and what you need to know about the SDK tools. It then walks you through all aspects of NFC app development, including SE programming. You'll find all you need to create an app, including functioning, downloadable code and a companion website with additional content. Valuable case studies help you understand each operating mode in clear, practical detail.
  • Shows programmers and developers how to develop Near Field Communication (NFC) applications for Android, including Secure Element (SE) programming
  • Expert authors are NFC researchers who have a deep knowledge of the subject
  • Covers app development in all NFC operating modes: reader/writer, peer-to-peer, and card emulation
  • Includes valuable case studies that showcase several system design and analysis methods, such as activity diagram, class diagram, UML, and others
Professional NFC Application Development for Android offers the clear, concise advice you need to create great applications for this emerging and exciting technology.


Sunday, May 5, 2013

How setRetainInstance(true) affect lifecycle of Fragment

It's part of the articles of lifecycle: start reading from Understand lifecycle of Activity and Fragment, Introduction.

The Fragment.setRetainInstance() method control whether a fragment instance is retained across Activity re-creation (such as from a configuration change). This can only be used with fragments not in the back stack. If set, the fragment lifecycle will be slightly different when an activity is recreated:
  • onDestroy() will not be called (but onDetach() still will be, because the fragment is being detached from its current activity).
  • onCreate(Bundle) will not be called since the fragment is not being re-created.
  • onAttach(Activity) and onActivityCreated(Bundle) will still be called.
~ reference: http://developer.android.com/reference/android/app/Fragment.html#setRetainInstance(boolean)

Refer to the last exercise, "UI elements lost after Activity/Fragment re-created". Consider the image_c, it is loaded in onCreateView(), only if savedInstanceState == null. Without setRetainInstance(true), it will not be loaded after orientation changed, because savedInstanceState != null.

image_c lost after orientation changed, without setRetainInstance(true)


MYTAG LogCat listed here:

Orientation changed:
  • MainActivity.onPause
  • MyFragment1.onPause
  • MainActivity.onStop
  • MyFragment1.onStop
  • MainActivity.onDestroy
  • MyFragment1.onDestroyView
  • MyFragment1.onDestroy
  • MyFragment1.onDetach
  • MainActivity.onCreate / savedInstanceState != null
  • MyFragment1.onAttach
  • MyFragment1.onCreate / savedInstanceState != null
  • MainActivity.onStart
  • MyFragment1.onCreateView / savedInstanceState != null
  • MyFragment1.onActivityCreated / savedInstanceState != null
  • MyFragment1.onStart
  • MainActivity.onResume
  • MyFragment1.onResume


To know how setRetainInstance(true) affect lifecycle of Fragment, modify MyFragment.java from last exercise "UI elements lost after Activity/Fragment re-created", override onActivityCreated() method to call setRetainInstance(true).

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

setRetainInstance(true);
}

image_c reloaded after orientation changed, with setRetainInstance(true).

LogCat in Orientation Changed:
  • MainActivity.onPause
  • MyFragment1.onPause
  • MainActivity.onStop
  • MyFragment1.onStop
  • MainActivity.onDestroy
  • MyFragment1.onDestroyView
  • MyFragment1.onDetach
  • MainActivity.onCreate / savedInstanceState != null
  • MyFragment1.onAttach
  • MainActivity.onStart
  • MyFragment1.onCreateView / savedInstanceState == null
  • MyFragment1.onActivityCreated / savedInstanceState == null
  • MyFragment1.onStart
  • MainActivity.onResume
  • MyFragment1.onResume



download filesDownload the files.

* the original chart of fragment lifecycle is taken here.

2XL Supercross HD v1.0.0 Apk + Data Android


2XL Supercross brings high-speed arcade racing to your Android device!
"2XL Supercross" just got better! With stunning graphics at higher display resolutions.
Bury the competition as you ride like a pro! Discover secret jump combinations within each track as you master the physics of motocross in this high-speed racing adventure.


“2XL Supercross HD” is an all-new offroad racing experience from the creative team that brought you such popular hits as: Motocross Madness, ATV Offroad Fury and MX Unleashed.

This rhythm-based racing game is easy to pick up and play, but its ever-increasing challenges will keep you in the zone for hours. Blitz your way through carefully crafted doubles, triples and treacherous whoops on custom tracks designed by Motocross champion Stephane Roncada.

You won’t believe what you’re playing in the palm of your hand! “2XL Supercross HD” features liquid-color graphics, fully interactive 3D physics, surround sound, authentic engine recordings, particle effects, projected shadows and lighting.

Share your game with friends by creating up to five independent profiles on your Android device.

Key Features:
- Supercross and Freestyle tracks designed by Motocross champion Stephane Roncada
- 3 modes of play: Time Trials, Practice and Racing
- Select your appearance from hundreds of different bike and rider combinations
- Race with up to 8 bikes and riders
- 4 camera views including first person with handle bars
- Select from 8 preset control schemes
- Responsive tilt steering interface with tune-able sensitivities
- Adjustable level of difficulty
- Comprehensive in-game help


Maybe you need lucky patcher to remove verification
Install APK
Copy 'com.twoxlgames.sxhd' folder to 'sdcard/Android/data' Download SD files
Copy 2 files in TitaniumBackup Zip to 'sdcard/Titaniumbackup' folder and 'Restore' > 'Data only'
Launch the game


Click Here To Download

APK File
Direct Download Link - Direct Download Link

SD Data Files
Direct Download Link - Direct Download Link

Titanium Backup File
Direct Download Link - Direct Download Link


Friday, May 3, 2013

UI elements lost after Activity/Fragment re-created

Last two post "Understand lifecycle of Activity and Fragment" and "Different case in lifecycle of Activity and Fragment", we have introduction about lifecycle. Now we check how it affect on real case.

In the layout of our fragment, we have 4 ImageView.
  • image_a: With android:src defined in XML.
  • image_b: Load image in onCreateView().
  • image_c: Load image in onCreateView(), only if savedInstanceState == null.
  • image_d: Load image in runtime, triggered by button clicked
In case image_c and image_d, the image will lost when orientation changed, or "Don't keep activities".




Code List -

Modify our custom FragmentActivity (MyFragmentActivity.java) and Fragment (MyFragment.java.java) to display savedInstanceState also.

MyFragmentActivity.java
package com.example.androidfragmenttest;

import android.os.Bundle;
import android.support.v4.app.FragmentActivity;
import android.util.Log;
import android.widget.Toast;

public class MyFragmentActivity extends FragmentActivity {

@Override
protected void onCreate(Bundle savedInstanceState) {
recLifeCycle_with_savedInstanceState(savedInstanceState);
super.onCreate(savedInstanceState);
}

@Override
protected void onStart() {
recLifeCycle();
super.onStart();
}

@Override
protected void onRestart() {
recLifeCycle();
super.onRestart();
}

@Override
protected void onResume() {
recLifeCycle();
super.onResume();
}

@Override
protected void onPause() {
recLifeCycle();
super.onPause();
}

@Override
protected void onStop() {
recLifeCycle();
super.onStop();
}

@Override
protected void onDestroy() {
recLifeCycle();
super.onDestroy();
}

public void recLifeCycle(){

String className = getClass().getSimpleName();
StackTraceElement[] s = Thread.currentThread().getStackTrace();
String methodName = s[3].getMethodName();

Toast.makeText(getApplicationContext(),
className + "." + methodName, Toast.LENGTH_SHORT).show();
Log.i("MYTAG", className + "." + methodName);

}

public void recLifeCycle(String note){
String className = getClass().getSimpleName();
StackTraceElement[] s = Thread.currentThread().getStackTrace();
String methodName = s[3].getMethodName();

Toast.makeText(getApplicationContext(),
className + "." + methodName, Toast.LENGTH_SHORT).show();
Log.i("MYTAG", className + "." + methodName + " / " + note);
}

public void recLifeCycle_with_savedInstanceState(Bundle state){

String stateMsg;
if(state == null){
stateMsg = "savedInstanceState == null";
}else{
stateMsg = "savedInstanceState != null";
}

String className = getClass().getSimpleName();
StackTraceElement[] s = Thread.currentThread().getStackTrace();
String methodName = s[3].getMethodName();

Toast.makeText(getApplicationContext(),
className + "." + methodName, Toast.LENGTH_SHORT).show();
Log.i("MYTAG", className + "." + methodName + " / " + stateMsg);
}

}


MyFragment.java
package com.example.androidfragmenttest;

import android.app.Activity;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Toast;

public class MyFragment extends Fragment {

@Override
public void onAttach(Activity activity) {
recLifeCycle();
super.onAttach(activity);
}

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

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {

recLifeCycle_with_savedInstanceState(savedInstanceState);
return super.onCreateView(inflater, container, savedInstanceState);
}

@Override
public void onActivityCreated(Bundle savedInstanceState) {
recLifeCycle_with_savedInstanceState(savedInstanceState);
super.onActivityCreated(savedInstanceState);
}

@Override
public void onStart() {
recLifeCycle();
super.onStart();
}

@Override
public void onResume() {
recLifeCycle();
super.onResume();
}

@Override
public void onPause() {
recLifeCycle();
super.onPause();
}

@Override
public void onStop() {
recLifeCycle();
super.onStop();
}

@Override
public void onDestroyView() {
recLifeCycle();
super.onDestroyView();
}

@Override
public void onDestroy() {
recLifeCycle();
super.onDestroy();
}

@Override
public void onDetach() {
recLifeCycle();
super.onDetach();
}

public void recLifeCycle(){

String className = getClass().getSimpleName();
StackTraceElement[] s = Thread.currentThread().getStackTrace();
String methodName = s[3].getMethodName();

String msg = className + "." + methodName;

Toast.makeText(getActivity(),
msg, Toast.LENGTH_SHORT).show();
Log.i("MYTAG", msg);
}

public void recLifeCycle(String note){

String className = getClass().getSimpleName();
StackTraceElement[] s = Thread.currentThread().getStackTrace();
String methodName = s[3].getMethodName();

String msg = className + "." + methodName;

Toast.makeText(getActivity(),
msg, Toast.LENGTH_SHORT).show();
Log.i("MYTAG", msg + " / " + note);
}

public void recLifeCycle_with_savedInstanceState(Bundle state){

String stateMsg;
if(state == null){
stateMsg = "savedInstanceState == null";
}else{
stateMsg = "savedInstanceState != null";
}

String className = getClass().getSimpleName();
StackTraceElement[] s = Thread.currentThread().getStackTrace();
String methodName = s[3].getMethodName();

String msg = className + "." + methodName + " / " + stateMsg;

Toast.makeText(getActivity(),
msg, Toast.LENGTH_SHORT).show();
Log.i("MYTAG", msg);
}

}


The fragment layout, /res/layout/fragment_layout1.xml
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingBottom="@dimen/activity_vertical_margin"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
android:orientation="vertical"
tools:context=".MainActivity" >

<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Fragment 1"/>

<ScrollView
android:layout_width="match_parent"
android:layout_height="match_parent"
>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">

<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="image_a"/>
<ImageView
android:id="@+id/image_a"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/ic_launcher"/>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="image_b"/>
<ImageView
android:id="@+id/image_b"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="image_c"/>
<ImageView
android:id="@+id/image_c"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
</LinearLayout>
<TextView
android:id="@+id/textstate"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="image_d"/>
<ImageView
android:id="@+id/image_d"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
<Button
android:id="@+id/loadimage_d"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Load image_d"/>
</LinearLayout>

</LinearLayout>
</ScrollView>

</LinearLayout>


MainActivity.java
package com.example.androidfragmenttest;

import android.os.Bundle;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentTransaction;
import android.view.LayoutInflater;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.ViewGroup;
import android.widget.Button;
import android.widget.FrameLayout;
import android.widget.ImageView;
import android.widget.TextView;

public class MainActivity extends MyFragmentActivity {

static public class MyFragment1 extends MyFragment {

ImageView image_b, image_c, image_d;
TextView textState;
Button buttonLoadImage_d;

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
super.onCreateView(inflater, container, savedInstanceState);
View view = inflater.inflate(R.layout.fragment_layout1, null);

image_b = (ImageView)view.findViewById(R.id.image_b);
image_c = (ImageView)view.findViewById(R.id.image_c);
image_d = (ImageView)view.findViewById(R.id.image_d);
textState = (TextView)view.findViewById(R.id.textstate);
buttonLoadImage_d = (Button)view.findViewById(R.id.loadimage_d);

image_b.setImageDrawable(getResources().getDrawable(R.drawable.ic_launcher));

if(savedInstanceState == null){
image_c.setImageDrawable(getResources().getDrawable(R.drawable.ic_launcher));
textState.setText("MyFragment1.savedInstanceState == null");
}else{
textState.setText("MyFragment1.savedInstanceState != null");
}

buttonLoadImage_d.setOnClickListener(new OnClickListener(){

@Override
public void onClick(View arg0) {
image_d.setImageDrawable(getResources().getDrawable(R.drawable.ic_launcher));
}});

return view;
}

}

FrameLayout fragmentContainer;
Button buttonFinish;

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

buttonFinish = (Button)findViewById(R.id.finish);
buttonFinish.setOnClickListener(new OnClickListener(){

@Override
public void onClick(View arg0) {
finish();
}});

fragmentContainer = (FrameLayout) findViewById(R.id.container);
if (savedInstanceState == null) {
// if's the first time created

MyFragment1 myListFragment1 = new MyFragment1();
FragmentManager supportFragmentManager = getSupportFragmentManager();
FragmentTransaction fragmentTransaction = supportFragmentManager
.beginTransaction();
fragmentTransaction.add(R.id.container, myListFragment1);
fragmentTransaction.commit();
}
}

}


Main layout, /res/layout/activity_main.xml
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingBottom="@dimen/activity_vertical_margin"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
android:orientation="vertical"
tools:context=".MainActivity" >

<Button
android:id="@+id/finish"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="finish()"/>
<FrameLayout
android:id="@+id/container"
android:layout_width="match_parent"
android:layout_height="match_parent" >
</FrameLayout>

</LinearLayout>




download filesDownload the files.