Android Open Source - konashi-android-sdk Main Activity






From Project

Back to project page konashi-android-sdk.

License

The source code is released under:

Apache License

If you think the Android project konashi-android-sdk 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.uxxu.konashi.sample.multi_activity;
//from   w w w. j a v  a2 s  . c o  m
import com.uxxu.konashi.lib.Konashi;
import com.uxxu.konashi.lib.KonashiObserver;

import android.os.Bundle;
import android.renderscript.Sampler;
import android.app.Activity;
import android.content.Intent;
import android.util.Log;
import android.view.Menu;
import android.view.View;
import android.widget.Button;

public class MainActivity extends Activity {
    private static final String TAG = "konashi";

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        
        Button findButton = (Button)findViewById(R.id.find);
        findButton.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                Konashi.getManager().find(MainActivity.this);
            }
        });
        
        Konashi.initialize(getApplicationContext());
        Konashi.getManager().addObserver(mKonashiObserver);
        
    }
    
    @Override
    protected void onDestroy() {
        Konashi.close();
        
        super.onDestroy();
    }

    @Override
    protected void onResume() {
        super.onResume();
        
        if(Konashi.getManager()!=null){
            Konashi.getManager().disconnect();
        }
    }

    private final KonashiObserver mKonashiObserver = new KonashiObserver(MainActivity.this) {
        @Override
        public void onReady(){
            Log.d(TAG, "onKonashiReady");
            
            Konashi.getManager().pwmMode(Konashi.LED2, Konashi.PWM_ENABLE_LED_MODE);

            Intent intent = new Intent(MainActivity.this, ControllerActivity.class);
            startActivity(intent);            
        }
    };
}




Java Source Code List

com.uxxu.konashi.lib.BleDeviceListAdapter.java
com.uxxu.konashi.lib.BleDeviceSelectionDialog.java
com.uxxu.konashi.lib.KonashiActivity.java
com.uxxu.konashi.lib.KonashiApiInterface.java
com.uxxu.konashi.lib.KonashiBaseManager.java
com.uxxu.konashi.lib.KonashiErrorReason.java
com.uxxu.konashi.lib.KonashiEvent.java
com.uxxu.konashi.lib.KonashiManager.java
com.uxxu.konashi.lib.KonashiNotifier.java
com.uxxu.konashi.lib.KonashiObserver.java
com.uxxu.konashi.lib.KonashiUUID.java
com.uxxu.konashi.lib.KonashiUtils.java
com.uxxu.konashi.lib.Konashi.java
com.uxxu.konashi.sample.basic.MainActivity.java
com.uxxu.konashi.sample.input.MainActivity.java
com.uxxu.konashi.sample.multi_activity.ControllerActivity.java
com.uxxu.konashi.sample.multi_activity.MainActivity.java