Created
September 27, 2011 16:00
-
-
Save elevine/1245475 to your computer and use it in GitHub Desktop.
Couchbase Android Test Application
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import com.couchbase.android.CouchbaseMobile; | |
| import com.couchbase.android.ICouchbaseDelegate; | |
| import android.app.Activity; | |
| import android.content.ServiceConnection; | |
| import android.os.Bundle; | |
| import android.util.Log; | |
| import android.widget.Toast; | |
| public class Main extends Activity { | |
| private long start = 0; | |
| private ServiceConnection couchServiceConnection; | |
| private final ICouchbaseDelegate mDelegate = new ICouchbaseDelegate() { | |
| @Override | |
| public void couchbaseStarted(String host, int port) { | |
| long length = (System.currentTimeMillis() - start); | |
| String logMsg = "Couch Started in : " + length; | |
| Toast.makeText(getApplicationContext(), logMsg, Toast.LENGTH_LONG).show(); | |
| Log.d("**MainActivity**",logMsg); | |
| } | |
| @Override | |
| public void exit(String error) {} | |
| }; | |
| /** Called when the activity is first created. */ | |
| @Override | |
| public void onCreate(Bundle savedInstanceState) { | |
| super.onCreate(savedInstanceState); | |
| setContentView(R.layout.main); | |
| start = System.currentTimeMillis(); | |
| Toast.makeText(getApplicationContext(), "Starting Couch", Toast.LENGTH_LONG).show(); | |
| startCouchbase(); | |
| } | |
| public void startCouchbase() { | |
| CouchbaseMobile couch = new CouchbaseMobile(getBaseContext(), mDelegate); | |
| this.couchServiceConnection = couch.startCouchbase(); | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment