Saturday, March 17, 2012

How to In Automatically Start activity after complete video ?

In complete video You have to put Listener for video properties.

This are the basic funda for playing video in android.

So this are the code below.

vd is the VideoView variable.

First of all pass uri.

Uri uri = Uri.parse("PATH OF VIDEO");

Then set media controller And set video uri ....
MediaController mc = new MediaController(this);
vd.setMediaController(mc);
vd.setVideoURI(uri);
vd.start();
Now On complete video setoncompletelistner properties on VideoView this code below....

vd.setOnCompletionListener(new MediaPlayer.OnCompletionListener() {
@Override
public void onCompletion(MediaPlayer mp) {
Log.v("log_tag","Complete Video");
}
});

how to Check Internet Connection in android ?

Hello Friends,


First In androidmanifest.xml file give the permission of internet given below.

<uses-permission android:name="android.permission.INTERNET"></uses-permission>

And Internet Connection code given below. This are simply create one checkinternetconnection() function.

So this code given below.

Code ::::::::::
private boolean checkInternetConnection() {
ConnectivityManager conMgr = (ConnectivityManager) getSystemService (Context.CONNECTIVITY_SERVICE);
// ARE WE CONNECTED TO THE NET
if (conMgr.getActiveNetworkInfo() != null
&& conMgr.getActiveNetworkInfo().isAvailable()
&& conMgr.getActiveNetworkInfo().isConnected()) {
return true;
} else {
Log.v(TAG, "Internet Connection Not Present");
return false;
}
}
Enjoyed.

Visio announces VIA Plus Ecosystem: 4-inch Android Phone, 8-inch Android tablet, Google TV and many more features

Just ahead of CES, Visio has made an announcement on some new offerings in the Android device category. Here’s what we’ve got from them:
  • VIA Phone: 4-inch phone, touting a 1GHz processor, 802.11 n Wifi, GPS, HDMI output, 5MP rear camera, front-facing camera
  • VIA Tablet: 8-inch tablet, complete with 1GHz processor, 802.11n Wifi, GPS, HDMI output, three speaker stereo audio, also a front-facing camera
  • VIA Plus TV’s and Blue-ray players: all with Google TV goodness baked right in. You will also be able to use the phone and tablet as remotes for these devices
The whole lineup of devices will be known as the “Vizio VIA Plus Ecosystem”. We’re hoping to get a sneak peek at these new little bundles of tech joy this week at CES, so be sure to keep it here for updates. Let us know what you think in the comments, and hit the break for the full presser.

VIZIO Unveils New Smartphone and Tablet Featuring VIA Plus for Even More Entertainment Freedom
- Part of the VIA Plus Ecosystem, the VIZIO smartphone and tablet Feature a Unified and Intuitive User Experience to Simplify Today’s Connected Lifestyle
- The VIZIO smartphone features a 4″ high-resolution capacitive touch screen with 5 Megapixel camera for photos and HD video capture, and a front-facing camera for video chat
- The VIZIO tablet boasts an 8″ high resolution capacitive touchscreen with 3 speakers for stereo audio in portrait or landscape mode and a front-facing camera for video chat
- Both devices include HD video playback with HDMI video output, high quality audio processing and built-in universal remote control app that make these the ideal handheld companions to the HD entertainment experience
IRVINE, Calif., Jan. 3, 2011 /PRNewswire/ — VIZIO, America’s #1 LCD HDTV Company*, announced today it is expanding into the mobility category with the VIZIO smartphone and tablet (referred to as the “VIA Phone” and “VIA Tablet” below) — both part of the VIA Plus ecosystem, the next generation of VIZIO Internet Apps™, that features a unified, sophisticated and intuitive user experience across multiple CE devices including VIZIO HDTVs, Blu-ray players, smartphones and tablets.
“Both the VIA phone and tablet feature the highest performance coupled with innovative features that tie them into the media consumption experience,” said Matthew McRae, Chief Technology Officer at VIZIO. “And by integrating the VIA Plus user experience also found on our next generation TVs and Blu-ray devices, VIZIO is delivering the multi-screen, unified ecosystem others have talked about for years and never delivered.”
The VIZIO VIA Phone features a 1 GHz processor, 4″ high-resolution capacitive touch screen, 802.11n Wi-Fi and Bluetooth connectivity, GPS, a MicroSD card slot for memory expansion and HDMI output with HD video playback. It also features a front-facing camera for video chats and a 5 megapixel rear camera for photos and HD video capture.
The VIZIO VIA Tablet also features a 1 GHz processor, with an 8″ high-resolution capacitive touch screen, 802.11n Wi-Fi and Bluetooth connectivity, GPS, a MicroSD card slot for additional memory expansion, HDMI output with HD video playback, and a front-facing camera for video chats. It also boasts a unique three-speaker design for stereo audio in both portrait and landscape modes.
Both devices include a built-in IR blaster with universal remote control app for quick access to the entire home theater or nearly any other CE device in the home. Both run on the Android™ Platform, which will also allow users to access thousands of apps through Android Market™.
“As part of the VIA Plus ecosystem, the VIA phone and tablet are natural extensions of the HD entertainment experience that historically has centered around the TV,” added Mr. McRae. “Whether consumers are looking to enjoy content on the big screen, on their tablet or on a mobile phone, VIA Plus delivers on the promise of Entertainment Freedom for All by creating a rich and consistent user experience across all devices that’s accessible to everyone, from the power user to the casual browser.”
VIZIO will be demonstrating the VIA Phone and VIA Tablet in their private CES showcase at the Wynn Hotel from January 6 to 9, 2011.
*Sources: Q3 2010 iSuppli and DisplaySearch Reports
About VIZIO
VIZIO, Inc., “Entertainment Freedom For All,” headquartered in Irvine, California, is America’s HDTV and Consumer Electronics Company. In 2007, VIZIO skyrocketed to the top by becoming the #1 selling brand of flat panel HDTVs in North America and became the first American brand in over a decade to lead in U.S. TV sales. Since 2007 VIZIO HDTV shipments remain in the TOP ranks in the U.S. and was #1 for the total year in 2009. VIZIO is committed to bringing feature-rich consumer electronics to market at a value through practical innovation. VIZIO offers a broad range of award winning consumer electronics. VIZIO’s products are found at Costco Wholesale, Sam’s Club, Walmart, Target, BJ’s Wholesale, and other retailers nationwide along with authorized online partners. VIZIO has won numerous awards including a #1 ranking in the Inc. 500 for Top Companies in Computers and Electronics, Fast Company’s 6th Most Innovative CE Company of 2009, and made the lists of Ad Age’s Hottest Brands, Good Housekeeping’s Best Big-Screens, CNET’s Editor’s Choice, PC World’s Best Buy and OC Metro’s 10 Most Trustworthy Brands among many other prestigious honors. For more information, please call 888-VIZIOCE or visit on the web at www.VIZIO.com.
The V, VIZIO, TruLED, Extreme VIZIO Technology XVT, VIZIO Internet Apps, VIA Plus, 480Hz SPS, 240Hz SPS, Thin Line, Smooth Motion, Razor LED, Smart Dimming, Theater 3D, Cinema HDTV, Entertainment Freedom For All names, phrase and symbols are trademarks or registered trademarks of VIZIO, Inc. Android and Android Market are trademarks of Google, Inc. All other trademarks may be the property of their respective holders.

how to get Version of application In Android Programmatically?

Hello Friends,

Today I have discussed about how to see your version number programmatically in android.

This are the simple code developing android application version name.

And this code given below. So see this code.

try {

packageInfo = getPackageManager().getPackageInfo(getPackageName(),0);

strVersionCode = "Version Code: "+ String.valueOf(packageInfo.versionCode);

strVersionName = packageInfo.versionName;

} catch (NameNotFoundException e) {

// TODO Auto-generated catch block

e.printStackTrace();

strVersionName = "Cannot load Version!";
}

And this code are very simple code for get version name in android.

I hope this are very helpful code for developing android application.

So enjoyed code.

Battleheart And Zombieville USA Developer Quits Android, Calls It ‘Unsustainable’

Zombieville USA is one of the poster children of Unity on iPhone, and I’d go as far to say it’s up there as one of the best designs of what can be done with the middleware. So when designer Mika Cellular announced it was offering up on Os as a action headline headings groundwork, I instantly regarded how it would indicate not just on the game’s developers, but Unity also.

The developer’s Battleheart currently has a position of 81 on assessment aggregator Metacritic, while Zombieville USA 2 is just as fulfilled on 80. Sufficed to say, Mika Cellular has some idea of what it needs to make a fantastic mobile action — information it was more than willing to talk about in a newest, lengthy post:

    Where did your money go? We spent about 20% of our finish man-hours last period getting Os in one way or another — porting, groundwork particular bug fixes, support assistance, etc. I would have suggested committing then on more content for you, but instead I was thanklessly improving shaders and exterior codecs to execute on different GPUs, or pushing out places to support new devices without unable, or walking someone through how to fix an setting up that will not go through.

This necessary the company to shell out “thousands” for evaluate devices, all for a groundwork that offered just five % to its it is important. Is that value interacting 20 % of your alternatives for? As Mika Cellular locations it, the “ratio is unsustainable”.

One of the aspects a designer goes with a product of middleware like Unity is so they never have to worry about creating the primary technology or removing themselves over the ability of a multi-platform release. You can just get on with it. That does not mean you are off the be connected entirely — it’s still up to your specialised artists and developers to make sure the shaders they are on-line go with the capabilities of the concentrate on devices and the specifications they are putting on the elements are cost-effective.

Android tablets will overtake iPad by 2015: IDC

According to a report from IDC, Android tablets will overtake Apple's iPad by 2015. As the sole vendor shipping iOS products, Apple will remain dominant in terms of worldwide vendor unit shipments, said Tom Mainelli, research director, Mobile Connected Devices. "However, the sheer number of vendors shipping low-priced, Android-based tablets means that Google's OS will overtake Apple's in terms of worldwide market share by 2015." The company expects iOS to remain the revenue market share leader through the end of its 2016 forecast period and beyond.
Besides, the company also reported that the worldwide media tablet shipments into sales channels rose by 56.1 per cent on a sequential basis in the fourth calendar quarter of 2011 (4Q11) to 28.2 million units worldwide.
Despite an impressive debut by Amazon, which shipped 4.7 million Kindle Fires into the market, Apple continued to see strong growth in the quarter, shipping 15.4 million units in 4Q11, up from 11.1 million units in 3Q11. Amazon's shipment total put the company in second place with 16.8 per cent of the worldwide market. Third-place Samsung grew its share from 5.5 per cent in 3Q11 to 5.8 per cent in 4Q11.

Android tablets will overtake iPad by 2015: IDC
Android made some strong gains in 4Q11, thanks in large part to the Amazon Kindle Fire's success (as the Fire runs a custom version of Google's Android OS). Android grew its market share from 32.3 per cent in 3Q11 to 44.6 per cent in 4Q11. As a result, iOS slipped from 61.6 per cent market share to 54.7 per cent; Blackberry slipped from 1.1 per cent to 0.7 per cent. WebOS, which owned 5 per cent of the worldwide market in 3Q11, dropped to zero in 4Q11. Looking ahead, IDC expects Android to continue to grow its share of the market at the expense of iOS.
International Data Corporation (IDC) is a market research and analysis firm that provides market intelligence, advisory services, and events for the information technology, telecommunications, and consumer technology markets.

Pull to Refresh in Android

PullToRefreshListView.java :
 
package com.markupartist.android.widget;
import android.content.Context;
import android.util.AttributeSet;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.MotionEvent;
import android.view.View;
import android.view.ViewGroup;
import android.view.animation.LinearInterpolator;
import android.view.animation.RotateAnimation;
import android.widget.AbsListView;
import android.widget.ImageView;
import android.widget.ListAdapter;
import android.widget.ListView;
import android.widget.ProgressBar;
import android.widget.RelativeLayout;
import android.widget.TextView;
import android.widget.AbsListView.OnScrollListener;
import com.markupartist.android.widget.pulltorefresh.R;
public class PullToRefreshListView extends ListView implements OnScrollListener {
    private static final int TAP_TO_REFRESH = 1;
    private static final int PULL_TO_REFRESH = 2;
    private static final int RELEASE_TO_REFRESH = 3;
    private static final int REFRESHING = 4;
    private static final String TAG = "PullToRefreshListView";
    private OnRefreshListener mOnRefreshListener;
    /**
* Listener that will receive notifications every time the list scrolls.
*/
    private OnScrollListener mOnScrollListener;
    private LayoutInflater mInflater;
    private RelativeLayout mRefreshView;
    private TextView mRefreshViewText;
    private ImageView mRefreshViewImage;
    private ProgressBar mRefreshViewProgress;
    private TextView mRefreshViewLastUpdated;
    private int mCurrentScrollState;
    private int mRefreshState;
    private RotateAnimation mFlipAnimation;
    private RotateAnimation mReverseFlipAnimation;
    private int mRefreshViewHeight;
    private int mRefreshOriginalTopPadding;
    private int mLastMotionY;
    private boolean mBounceHack;
    public PullToRefreshListView(Context context) {
        super(context);
        init(context);
    }
    public PullToRefreshListView(Context context, AttributeSet attrs) {
        super(context, attrs);
        init(context);
    }
    public PullToRefreshListView(Context context, AttributeSet attrs, int defStyle) {
        super(context, attrs, defStyle);
        init(context);
    }
    private void init(Context context) {
        // Load all of the animations we need in code rather than through XML
        mFlipAnimation = new RotateAnimation(0, -180,
                RotateAnimation.RELATIVE_TO_SELF, 0.5f,
                RotateAnimation.RELATIVE_TO_SELF, 0.5f);
        mFlipAnimation.setInterpolator(new LinearInterpolator());
        mFlipAnimation.setDuration(250);
        mFlipAnimation.setFillAfter(true);
        mReverseFlipAnimation = new RotateAnimation(-180, 0,
                RotateAnimation.RELATIVE_TO_SELF, 0.5f,
                RotateAnimation.RELATIVE_TO_SELF, 0.5f);
        mReverseFlipAnimation.setInterpolator(new LinearInterpolator());
        mReverseFlipAnimation.setDuration(250);
        mReverseFlipAnimation.setFillAfter(true);
        mInflater = (LayoutInflater) context.getSystemService(
                Context.LAYOUT_INFLATER_SERVICE);
mRefreshView = (RelativeLayout) mInflater.inflate(
R.layout.pull_to_refresh_header, this, false);
        mRefreshViewText =
            (TextView) mRefreshView.findViewById(R.id.pull_to_refresh_text);
        mRefreshViewImage =
            (ImageView) mRefreshView.findViewById(R.id.pull_to_refresh_image);
        mRefreshViewProgress =
            (ProgressBar) mRefreshView.findViewById(R.id.pull_to_refresh_progress);
        mRefreshViewLastUpdated =
            (TextView) mRefreshView.findViewById(R.id.pull_to_refresh_updated_at);
        mRefreshViewImage.setMinimumHeight(50);
        mRefreshView.setOnClickListener(new OnClickRefreshListener());
        mRefreshOriginalTopPadding = mRefreshView.getPaddingTop();
        mRefreshState = TAP_TO_REFRESH;
        addHeaderView(mRefreshView);
        super.setOnScrollListener(this);
        measureView(mRefreshView);
        mRefreshViewHeight = mRefreshView.getMeasuredHeight();
    }
    @Override
    protected void onAttachedToWindow() {
        setSelection(1);
    }
    @Override
    public void setAdapter(ListAdapter adapter) {
        super.setAdapter(adapter);
        setSelection(1);
    }
    /**
* Set the listener that will receive notifications every time the list
* scrolls.
*
* @param l The scroll listener.
*/
    @Override
    public void setOnScrollListener(AbsListView.OnScrollListener l) {
        mOnScrollListener = l;
    }
    /**
* Register a callback to be invoked when this list should be refreshed.
*
* @param onRefreshListener The callback to run.
*/
    public void setOnRefreshListener(OnRefreshListener onRefreshListener) {
        mOnRefreshListener = onRefreshListener;
    }
    /**
* Set a text to represent when the list was last updated.
* @param lastUpdated Last updated at.
*/
    public void setLastUpdated(CharSequence lastUpdated) {
        if (lastUpdated != null) {
            mRefreshViewLastUpdated.setVisibility(View.VISIBLE);
            mRefreshViewLastUpdated.setText(lastUpdated);
        } else {
            mRefreshViewLastUpdated.setVisibility(View.GONE);
        }
    }
    @Override
    public boolean onTouchEvent(MotionEvent event) {
        final int y = (int) event.getY();
        mBounceHack = false;
        switch (event.getAction()) {
            case MotionEvent.ACTION_UP:
                if (!isVerticalScrollBarEnabled()) {
                    setVerticalScrollBarEnabled(true);
                }
                if (getFirstVisiblePosition() == 0 && mRefreshState != REFRESHING) {
                    if ((mRefreshView.getBottom() >= mRefreshViewHeight
                            || mRefreshView.getTop() >= 0)
                            && mRefreshState == RELEASE_TO_REFRESH) {
                        // Initiate the refresh
                        mRefreshState = REFRESHING;
                        prepareForRefresh();
                        onRefresh();
                    } else if (mRefreshView.getBottom() < mRefreshViewHeight
                            || mRefreshView.getTop() <= 0) {
                        // Abort refresh and scroll down below the refresh view
                        resetHeader();
                        setSelection(1);
                    }
                }
                break;
            case MotionEvent.ACTION_DOWN:
                mLastMotionY = y;
                break;
            case MotionEvent.ACTION_MOVE:
                applyHeaderPadding(event);
                break;
        }
        return super.onTouchEvent(event);
    }
    private void applyHeaderPadding(MotionEvent ev) {
        // getHistorySize has been available since API 1
        int pointerCount = ev.getHistorySize();
        for (int p = 0; p < pointerCount; p++) {
            if (mRefreshState == RELEASE_TO_REFRESH) {
                if (isVerticalFadingEdgeEnabled()) {
                    setVerticalScrollBarEnabled(false);
                }
                int historicalY = (int) ev.getHistoricalY(p);
                // Calculate the padding to apply, we divide by 1.7 to
                // simulate a more resistant effect during pull.
                int topPadding = (int) (((historicalY - mLastMotionY)
                        - mRefreshViewHeight) / 1.7);
                mRefreshView.setPadding(
                        mRefreshView.getPaddingLeft(),
                        topPadding,
                        mRefreshView.getPaddingRight(),
                        mRefreshView.getPaddingBottom());
            }
        }
    }
    /**
* Sets the header padding back to original size.
*/
    private void resetHeaderPadding() {
        mRefreshView.setPadding(
                mRefreshView.getPaddingLeft(),
                mRefreshOriginalTopPadding,
                mRefreshView.getPaddingRight(),
                mRefreshView.getPaddingBottom());
    }
    /**
* Resets the header to the original state.
*/
    private void resetHeader() {
        if (mRefreshState != TAP_TO_REFRESH) {
            mRefreshState = TAP_TO_REFRESH;
            resetHeaderPadding();
            // Set refresh view text to the pull label
            mRefreshViewText.setText(R.string.pull_to_refresh_tap_label);
            // Replace refresh drawable with arrow drawable
            mRefreshViewImage.setImageResource(R.drawable.ic_pulltorefresh_arrow);
            // Clear the full rotation animation
            mRefreshViewImage.clearAnimation();
            // Hide progress bar and arrow.
            mRefreshViewImage.setVisibility(View.GONE);
            mRefreshViewProgress.setVisibility(View.GONE);
        }
    }
    private void measureView(View child) {
        ViewGroup.LayoutParams p = child.getLayoutParams();
        if (p == null) {
            p = new ViewGroup.LayoutParams(
                    ViewGroup.LayoutParams.FILL_PARENT,
                    ViewGroup.LayoutParams.WRAP_CONTENT);
        }
        int childWidthSpec = ViewGroup.getChildMeasureSpec(0,
                0 + 0, p.width);
        int lpHeight = p.height;
        int childHeightSpec;
        if (lpHeight > 0) {
            childHeightSpec = MeasureSpec.makeMeasureSpec(lpHeight, MeasureSpec.EXACTLY);
        } else {
            childHeightSpec = MeasureSpec.makeMeasureSpec(0, MeasureSpec.UNSPECIFIED);
        }
        child.measure(childWidthSpec, childHeightSpec);
    }
    @Override
    public void onScroll(AbsListView view, int firstVisibleItem,
            int visibleItemCount, int totalItemCount) {
        // When the refresh view is completely visible, change the text to say
        // "Release to refresh..." and flip the arrow drawable.
        if (mCurrentScrollState == SCROLL_STATE_TOUCH_SCROLL
                && mRefreshState != REFRESHING) {
            if (firstVisibleItem == 0) {
                mRefreshViewImage.setVisibility(View.VISIBLE);
                if ((mRefreshView.getBottom() >= mRefreshViewHeight + 20
                        || mRefreshView.getTop() >= 0)
                        && mRefreshState != RELEASE_TO_REFRESH) {
                    mRefreshViewText.setText(R.string.pull_to_refresh_release_label);
                    mRefreshViewImage.clearAnimation();
                    mRefreshViewImage.startAnimation(mFlipAnimation);
                    mRefreshState = RELEASE_TO_REFRESH;
                } else if (mRefreshView.getBottom() < mRefreshViewHeight + 20
                        && mRefreshState != PULL_TO_REFRESH) {
                    mRefreshViewText.setText(R.string.pull_to_refresh_pull_label);
                    if (mRefreshState != TAP_TO_REFRESH) {
                        mRefreshViewImage.clearAnimation();
                        mRefreshViewImage.startAnimation(mReverseFlipAnimation);
                    }
                    mRefreshState = PULL_TO_REFRESH;
                }
            } else {
                mRefreshViewImage.setVisibility(View.GONE);
                resetHeader();
            }
        } else if (mCurrentScrollState == SCROLL_STATE_FLING
                && firstVisibleItem == 0
                && mRefreshState != REFRESHING) {
            setSelection(1);
            mBounceHack = true;
        } else if (mBounceHack && mCurrentScrollState == SCROLL_STATE_FLING) {
            setSelection(1);
        }
        if (mOnScrollListener != null) {
            mOnScrollListener.onScroll(view, firstVisibleItem,
                    visibleItemCount, totalItemCount);
        }
    }
    @Override
    public void onScrollStateChanged(AbsListView view, int scrollState) {
        mCurrentScrollState = scrollState;
        if (mCurrentScrollState == SCROLL_STATE_IDLE) {
            mBounceHack = false;
        }
        if (mOnScrollListener != null) {
            mOnScrollListener.onScrollStateChanged(view, scrollState);
        }
    }
    public void prepareForRefresh() {
        resetHeaderPadding();
        mRefreshViewImage.setVisibility(View.GONE);
        // We need this hack, otherwise it will keep the previous drawable.
        mRefreshViewImage.setImageDrawable(null);
        mRefreshViewProgress.setVisibility(View.VISIBLE);
        // Set refresh view text to the refreshing label
        mRefreshViewText.setText(R.string.pull_to_refresh_refreshing_label);
        mRefreshState = REFRESHING;
    }
    public void onRefresh() {
        Log.d(TAG, "onRefresh");
        if (mOnRefreshListener != null) {
            mOnRefreshListener.onRefresh();
        }
    }
    /**
* Resets the list to a normal state after a refresh.
* @param lastUpdated Last updated at.
*/
    public void onRefreshComplete(CharSequence lastUpdated) {
        setLastUpdated(lastUpdated);
        onRefreshComplete();
    }
    /**
* Resets the list to a normal state after a refresh.
*/
    public void onRefreshComplete() {
        Log.d(TAG, "onRefreshComplete");
        resetHeader();
        // If refresh view is visible when loading completes, scroll down to
        // the next item.
        if (mRefreshView.getBottom() > 0) {
            invalidateViews();
            setSelection(1);
        }
    }
    /**
* Invoked when the refresh view is clicked on. This is mainly used when
* there's only a few items in the list and it's not possible to drag the
* list.
*/
    private class OnClickRefreshListener implements OnClickListener {
        @Override
        public void onClick(View v) {
            if (mRefreshState != REFRESHING) {
                prepareForRefresh();
                onRefresh();
            }
        }
    }
    /**
* Interface definition for a callback to be invoked when list should be
* refreshed.
*/
    public interface OnRefreshListener {
        /**
* Called when the list should be refreshed.
* <p>
* A call to {@link PullToRefreshListView #onRefreshComplete()} is
* expected to indicate that the refresh has completed.
*/
        public void onRefresh();
    }
}
 
 XML file: 
 
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:orientation="vertical"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    >
    <!--
The PullToRefreshListView replaces a standard ListView widget.
-->
    <com.markupartist.android.widget.PullToRefreshListView
        android:id="@+id/android:list"
        android:layout_height="fill_parent"
        android:layout_width="fill_parent"
        />
</LinearLayout>
 
 
 
PullToRefreshActivity.java  
 
package com.markupartist.android.example.pulltorefresh;
import java.util.Arrays;
import java.util.LinkedList;
import android.app.ListActivity;
import android.os.AsyncTask;
import android.os.Bundle;
import android.widget.ArrayAdapter;
import com.markupartist.android.widget.PullToRefreshListView;
import com.markupartist.android.widget.PullToRefreshListView.OnRefreshListener;
public class PullToRefreshActivity extends ListActivity {
    private LinkedList<String> mListItems;
    /** Called when the activity is first created. */
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.pull_to_refresh);
        // Set a listener to be invoked when the list should be refreshed.
        ((PullToRefreshListView) getListView()).setOnRefreshListener(new OnRefreshListener() {
            @Override
            public void onRefresh() {
                // Do work to refresh the list here.
                new GetDataTask().execute();
            }
        });
        mListItems = new LinkedList<String>();
        mListItems.addAll(Arrays.asList(mStrings));
        ArrayAdapter<String> adapter = new ArrayAdapter<String>(this,
                android.R.layout.simple_list_item_1, mListItems);
        setListAdapter(adapter);
    }
    private class GetDataTask extends AsyncTask<Void, Void, String[]> {
        @Override
        protected String[] doInBackground(Void... params) {
            // Simulates a background job.
            try {
                Thread.sleep(2000);
            } catch (InterruptedException e) {
                ;
            }
            return mStrings;
        }
        @Override
        protected void onPostExecute(String[] result) {
            mListItems.addFirst("Added after refresh...");
            // Call onRefreshComplete when the list has been refreshed.
            ((PullToRefreshListView) getListView()).onRefreshComplete();
            super.onPostExecute(result);
        }
    }
    private String[] mStrings = {
            "Abbaye de Belloc", "Abbaye du Mont des Cats", "Abertam",
            "Abondance", "Ackawi", "Acorn", "Adelost", "Affidelice au Chablis",
            "Afuega'l Pitu", "Airag", "Airedale", "Aisy Cendre",
            "Allgauer Emmentaler"};
}