Android Open Source - userapp-android Main Activity






From Project

Back to project page userapp-android.

License

The source code is released under:

MIT License

If you think the Android project userapp-android listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

package com.example.demo;
/*  w ww  . j a v a  2 s.  co m*/
import io.userapp.client.android.UserApp;
import android.os.Bundle;
import android.support.v4.app.FragmentActivity;
import android.view.Menu;
import android.view.MenuItem;

public class MainActivity extends FragmentActivity {
  // Instances for session and its UI helper
  UserApp.Session session;
  UserApp.UIHelper uiHelper;
  
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);
    
    // Initiate the session and create a new UI helper bound to it
    session = new UserApp.Session(this);
    uiHelper = session.createUIHelper(R.id.loginFragment, R.id.mainFragment, R.id.signupFragment);
  }
  
  @Override
  public boolean onCreateOptionsMenu(Menu menu) {
    getMenuInflater().inflate(R.menu.main, menu);
    return true;
  }
  
  @Override
  public boolean onOptionsItemSelected(MenuItem item) {
      // Handle presses on the action bar items
      switch (item.getItemId()) {
        // Logout action
          case R.id.action_logout:
              session.logout();
              return true;
          default:
              return super.onOptionsItemSelected(item);
      }
  }
  
  @Override
  public void onResume() {
      super.onResume();
      uiHelper.onResume();
  }

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




Java Source Code List

com.example.demo.LoginFragment.java
com.example.demo.MainActivity.java
com.example.demo.MainFragment.java
com.example.demo.SignupFragment.java
io.userapp.client.JsonHelper.java
io.userapp.client.UserAppClient.java
io.userapp.client.android.AuthFragment.java
io.userapp.client.android.Feature.java
io.userapp.client.android.Lock.java
io.userapp.client.android.OAuthFragment.java
io.userapp.client.android.Permission.java
io.userapp.client.android.Property.java
io.userapp.client.android.Subscription.java
io.userapp.client.android.UserApp.java
io.userapp.client.android.User.java
io.userapp.client.android.WebViewRelativeLayout.java
io.userapp.client.exceptions.InvalidMethodException.java
io.userapp.client.exceptions.InvalidServiceException.java
io.userapp.client.exceptions.ServiceException.java
io.userapp.client.exceptions.TransportException.java
io.userapp.client.exceptions.UserAppException.java
io.userapp.client.rest.RestfulContext.java
io.userapp.client.rest.Restful.java
io.userapp.client.rest.UserCredentials.java
io.userapp.client.rest.core.HttpHeaderCollection.java
io.userapp.client.rest.core.HttpMethodType.java
io.userapp.client.rest.core.HttpProtocolVersionType.java
io.userapp.client.rest.core.HttpResponseHead.java
io.userapp.client.rest.core.HttpResponseStatusHead.java
io.userapp.client.rest.core.HttpResponse.java
io.userapp.client.rest.core.HttpStatusCode.java