Advertisement
Guest User

Untitled

a guest
Oct 5th, 2015
56
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.81 KB | None | 0 0
  1. package com.iiitd.sahilbabbar.walkthecampusv1;
  2.  
  3. import android.app.Activity;
  4. import android.os.Bundle;
  5. import android.view.Menu;
  6. import android.view.MenuItem;
  7. import android.view.View;
  8.  
  9. import com.google.android.gms.common.Scopes;
  10. import com.google.android.gms.common.api.GoogleApiClient;
  11. import com.google.android.gms.common.api.Scope;
  12. import com.google.android.gms.plus.Plus;
  13.  
  14. public class MainActivity extends Activity implements
  15. GoogleApiClient.ConnectionCallbacks,
  16. GoogleApiClient.OnConnectionFailedListener,
  17. View.OnClickListener {
  18.  
  19. @Override
  20. protected void onCreate(Bundle savedInstanceState) {
  21. super.onCreate(savedInstanceState);
  22. setContentView(R.layout.activity_main);
  23.  
  24. // Build GoogleApiClient with access to basic profile
  25. mGoogleApiClient = new GoogleApiClient.Builder(this)
  26. .addConnectionCallbacks(this)
  27. .addOnConnectionFailedListener(this)
  28. .addApi(Plus.API)
  29. .addScope(new Scope(Scopes.PROFILE))
  30. .addScope(new Scope(Scopes.EMAIL))
  31. .build();
  32. }
  33.  
  34.  
  35. @Override
  36. public boolean onCreateOptionsMenu(Menu menu) {
  37. // Inflate the menu; this adds items to the action bar if it is present.
  38. getMenuInflater().inflate(R.menu.menu_main, menu);
  39. return true;
  40. }
  41.  
  42. @Override
  43. public boolean onOptionsItemSelected(MenuItem item) {
  44. // Handle action bar item clicks here. The action bar will
  45. // automatically handle clicks on the Home/Up button, so long
  46. // as you specify a parent activity in AndroidManifest.xml.
  47. int id = item.getItemId();
  48.  
  49. //noinspection SimplifiableIfStatement
  50. if (id == R.id.action_settings) {
  51. return true;
  52. }
  53.  
  54. return super.onOptionsItemSelected(item);
  55. }
  56. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement