Android Open Source - googletv_ncid Main Activity






From Project

Back to project page googletv_ncid.

License

The source code is released under:

Apache License

If you think the Android project googletv_ncid 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 net.cwfk.ig88.ncid;
/*from  w  ww  .  j  a  v a2 s.  co  m*/
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.view.WindowManager;
import android.widget.Button;
import android.widget.EditText;
import android.widget.TextView;
import android.widget.Toast;

public class MainActivity extends Activity {

    Config config;

    EditText viewAddress;

    EditText viewPort;

    Button viewSave;

    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.config);

        this.config = new Config( this );

        viewAddress = (EditText) findViewById(R.id.address);
        viewPort = (EditText) findViewById(R.id.port);
        viewSave = (Button) findViewById(R.id.save_button);

        viewAddress.setText( config.getAddress() );
        viewPort.setText( "" + config.getPort() );

        viewSave.setOnClickListener( new View.OnClickListener() {
            public void onClick(View v) {
                config.setAddress( viewAddress.getText().toString() );
                config.setPort( Integer.parseInt( viewPort.getText().toString() ));
                restartService();
                finish();
            }
        });

        restartService();
    }

    private void restartService() {
        startService(new Intent("net.cwfk.ig88.ncid.ACTION_RESTART"));
    }
}




Java Source Code List

net.cwfk.ig88.ncid.CIDHandler.java
net.cwfk.ig88.ncid.Config.java
net.cwfk.ig88.ncid.DisplayActivity.java
net.cwfk.ig88.ncid.MainActivity.java
net.cwfk.ig88.ncid.NCIDClient.java
net.cwfk.ig88.ncid.NCIDService.java
net.cwfk.ig88.ncid.ServiceStarter.java
net.cwfk.ig88.ncid.StatusHandler.java