@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); requestWindowFeature(Window.FEATURE_NO_TITLE); setContentView(R.layout.gplus_signin); btnSignIn = (SignInButton) findViewById(R.id.btn_sign_in); btnSignOut = (Button) findViewById(R.id.btn_sign_out); btnStart = (Button) findViewById(R.id.btn_launch_app); btnOnTime = (Button) findViewById(R.id.btn_note_on_time); btnOffTime = (Button) findViewById(R.id.btn_note_off_time); btnEntryStn = (Button) findViewById(R.id.btn_entry_station); btnExitStn = (Button) findViewById(R.id.btn_exit_station); imgProfilePic = (ImageView) findViewById(R.id.imgProfilePic); txtName = (TextView) findViewById(R.id.txtName); txtFileUpload = (TextView) findViewById(R.id.txt_file_upload); txtDatasent = (TextView) findViewById(R.id.txtDatasent); imgAppName = (ImageView) findViewById(R.id.imgappname); imgAppIcon = (ImageView) findViewById(R.id.imgicon); context = getApplicationContext(); // Button click listeners btnStart.setOnClickListener(this); btnEntryStn.setOnClickListener(this); btnExitStn.setOnClickListener(this); btnOnTime.setOnClickListener(this); btnOffTime.setOnClickListener(this); btnSignIn.setOnClickListener(this); btnSignOut.setOnClickListener(this); sharedPref = PreferenceManager.getDefaultSharedPreferences(getApplicationContext()); // Initializing google plus api client mGoogleApiClient = new GoogleApiClient.Builder(this) .addConnectionCallbacks(this) .addOnConnectionFailedListener(this) .addApi(Plus.API) .addScope(Plus.SCOPE_PLUS_LOGIN) .build(); mNotificationManager = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE); // opening file to record time of entry and exit logFile = new File(CommonUtils.getFilepath("TimeLog.txt")); try { timeBuf = new BufferedWriter(new FileWriter(logFile, true)); Log.i("File opened:", "Preparing to write data"); isBufferWriterOpen = true; } catch (IOException e) { e.printStackTrace(); } }