Application Crashes every time I run it on my phone. Is there something wrong? It says Unfortunately "appname" has stopped working. I have also tried other approaches to checking for googleplay services but it always crashes. I updated my google play services and have a working google map v2 working perfectly. Any solutions to this code? It crashes on my phone running android 4.1.2 and on my AVD.
package com.example.checkgoogleplayproject;
import android.app.Activity;
import android.app.Dialog;
import android.os.Bundle;
import android.view.Menu;
import android.widget.TextView;
import com.google.android.gms.common.ConnectionResult;
import com.google.android.gms.common.GooglePlayServicesUtil;
public class MainActivity extends Activity {
    @Override
    protected void onResume() {
        super.onResume();
        // Getting reference to TextView to show the status
        TextView tvStatus = (TextView)findViewById(R.id.tv_status);
        // Getting status
        int status = GooglePlayServicesUtil.isGooglePlayServicesAvailable(getBaseContext());
        // Showing status
        if(status==ConnectionResult.SUCCESS)
            tvStatus.setText("Google Play Services are available");
        else{
            tvStatus.setText("Google Play Services are not available");
            int requestCode = 10;
            Dialog dialog = GooglePlayServicesUtil.getErrorDialog(status, this, requestCode);
            dialog.show();
        }
    }
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
    }
    @Override
    public boolean onCreateOptionsMenu(Menu menu) {
        // Inflate the menu; this adds items to the action bar if it is present.
        getMenuInflater().inflate(R.menu.main, menu);
        return true;
    }
}
