Android Open Source - Swinedroid Network Runnable Manager






From Project

Back to project page Swinedroid.

License

The source code is released under:

GNU General Public License

If you think the Android project Swinedroid 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.legind.swinedroid.NetworkRunnable;
/*  w  w  w  .  j a  v  a2 s . co  m*/
import android.content.ComponentName;
import android.content.Intent;
import android.content.ServiceConnection;
import android.os.IBinder;

import com.legind.sqlite.ServerDbAdapter;
import com.legind.swinedroid.RequestService.Request;


public class NetworkRunnableManager{
  private final NetworkRunnableBindRequires parent;
  private ServerDbAdapter mDbHelper;
  private Request mBoundRequest;

  private ServiceConnection mConnection = new ServiceConnection() {
    public void onServiceConnected(ComponentName className, IBinder service) {
        mBoundRequest = ((Request.RequestBinder)service).getService();
        parent.onBoundRequestSet();
    }
    
    public void onServiceDisconnected(ComponentName className) {
      mBoundRequest = null;
    }
  };
    
  public void startRequestService() {
        Intent newIntent = new Intent(parent.getContext(), Request.class);
        newIntent.putExtra(Request.ROW_ID_TAG, parent.getRowId());
        parent.startService(newIntent);
        parent.bindService(newIntent, mConnection, 0);
  }

  public NetworkRunnableManager(NetworkRunnableBindRequires parent){
    this.parent = parent;
    mDbHelper = new ServerDbAdapter(parent.getContext());
    mDbHelper.open();
  }
  
  public void close(){
  mDbHelper.close();
  if(mBoundRequest != null)
    parent.unbindService(mConnection);
  }
  
  public Request getBoundRequest(){
    return mBoundRequest;
  }
  
  public ServerDbAdapter getDbHelper(){
    return mDbHelper;
  }
  
}




Java Source Code List

com.legind.Dialogs.ErrorMessageHandler.java
com.legind.Dialogs.MessageHandler.java
com.legind.sqlite.AlertDbAdapter.java
com.legind.sqlite.DbAdapter.java
com.legind.sqlite.ServerDbAdapter.java
com.legind.ssl.CertificateInspect.CertificateInspect.java
com.legind.ssl.SSLHandler.SSLHandler.java
com.legind.ssl.TrustManagerFactory.TrustManagerFactory.java
com.legind.swinedroid.AlertList.java
com.legind.swinedroid.AlertSearch.java
com.legind.swinedroid.AlertView.java
com.legind.swinedroid.ServerEdit.java
com.legind.swinedroid.ServerHashDialog.java
com.legind.swinedroid.ServerView.java
com.legind.swinedroid.Swinedroid.java
com.legind.swinedroid.NetworkRunnable.NetworkRunnableBindRequires.java
com.legind.swinedroid.NetworkRunnable.NetworkRunnableManager.java
com.legind.swinedroid.NetworkRunnable.NetworkRunnableRequires.java
com.legind.swinedroid.NetworkRunnable.NetworkRunnableUniqueRequires.java
com.legind.swinedroid.NetworkRunnable.NetworkRunnable.java
com.legind.swinedroid.RequestService.RequestElement.java
com.legind.swinedroid.RequestService.Request.java
com.legind.swinedroid.xml.AlertListXMLElement.java
com.legind.swinedroid.xml.AlertListXMLHandler.java
com.legind.swinedroid.xml.AlertXMLElement.java
com.legind.swinedroid.xml.AlertXMLHandler.java
com.legind.swinedroid.xml.OverviewXMLElement.java
com.legind.swinedroid.xml.OverviewXMLHandler.java
com.legind.swinedroid.xml.XMLHandlerException.java
com.legind.swinedroid.xml.XMLHandler.java
com.legind.web.WebTransport.WebTransportConnection.java
com.legind.web.WebTransport.WebTransportException.java
com.legind.web.WebTransport.WebTransport.java
org.achartengine.chartlib.AbstractChart.java
org.achartengine.chartlib.AlertChart.java