Android Open Source - Cardeto Test Activity






From Project

Back to project page Cardeto.

License

The source code is released under:

Apache License

If you think the Android project Cardeto 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.ggt.cardetosample;
/* w w w  .ja  v  a 2  s. com*/
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.ScrollView;
import android.widget.TextView;

import com.ggt.cardeto.CardetoService;
import com.ggt.cardetosample.database.CardetoSampleDatabaseDataSource;

/**
 * A simple sample activity showing usage of cardeto.
 *
 * @author guiguito
 */
public class TestActivity extends Activity {

    private ScrollView mLogsScrollView;
    private TextView mLogsTextView;
    private CardetoSampleDatabaseDataSource mCardetoSampleDatabaseDataSource;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_test);
        mLogsScrollView = (ScrollView) findViewById(R.id.logsScrollView);
        mLogsTextView = (TextView) findViewById(R.id.logsTextView);
        mCardetoSampleDatabaseDataSource = new CardetoSampleDatabaseDataSource(
                getApplicationContext());
        mCardetoSampleDatabaseDataSource.open();
    }

    private void addLog(String log) {
        mLogsTextView.setText(mLogsTextView.getText() + "\n" + log);
        mLogsScrollView.fullScroll(ScrollView.FOCUS_DOWN);
    }

    public void onStartCardetoServiceButtonClicked(View view) {
        Intent intent = new Intent(this, CardetoService.class);
        intent.putExtra(CardetoService.CARDETO_PORT, 2000);
        startService(intent);
        addLog("Service started");
    }

    public void onStopCardetoServiceButtonClicked(View view) {
        stopService(new Intent(this, CardetoService.class));
        addLog("Service stopped");
    }

    public void onAddRandomLogButtonClicked(View view) {
        mCardetoSampleDatabaseDataSource.createLog(System.currentTimeMillis() + "");
        addLog("Log added");
    }

    public void onClearLogsButtonClicked(View view) {
        mCardetoSampleDatabaseDataSource.clearLogs();
        addLog("Logs cleared");
    }

}




Java Source Code List

com.ggt.cardeto.CardetoService.java
com.ggt.cardeto.embeddedwebserver.CardetoWebServerModule.java
com.ggt.cardeto.embeddedwebserver.CardetoWebServer.java
com.ggt.cardeto.embeddedwebserver.appinfomodule.AppInfoModule.java
com.ggt.cardeto.embeddedwebserver.clipboardmodule.ClipboardModule.java
com.ggt.cardeto.embeddedwebserver.logcatmodule.LogcatModule.java
com.ggt.cardeto.embeddedwebserver.sqlitemodule.GenericSQLiteDatabaseHelper.java
com.ggt.cardeto.embeddedwebserver.sqlitemodule.SQLiteModule.java
com.ggt.cardeto.embeddedwebserver.sqlitemodule.tableouputrenderers.CSVRenderer.java
com.ggt.cardeto.embeddedwebserver.sqlitemodule.tableouputrenderers.HtmlRenderer.java
com.ggt.cardeto.embeddedwebserver.sqlitemodule.tableouputrenderers.JsonRenderer.java
com.ggt.cardeto.embeddedwebserver.sqlitemodule.tableouputrenderers.TableOutputRenderer.java
com.ggt.cardeto.embeddedwebserver.sqlitemodule.tableouputrenderers.XmlRenderer.java
com.ggt.cardeto.embeddedwebserver.staticvarsmodule.StaticVarsModule.java
com.ggt.cardeto.externallib.NanoHTTPD.java
com.ggt.cardeto.utils.CardetoConstants.java
com.ggt.cardeto.utils.NetworkUtilsOld.java
com.ggt.cardeto.utils.NetworkUtils.java
com.ggt.cardetosample.TestActivity.java
com.ggt.cardetosample.database.CardetoSampleDatabaseDataSource.java
com.ggt.cardetosample.database.CardetoSampleDatabaseHelper.java
com.ggt.cardetosample.database.Log.java