Android Open Source - CenteredContentButton Main Activity






From Project

Back to project page CenteredContentButton.

License

The source code is released under:

Apache License

If you think the Android project CenteredContentButton 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.skd.centeredcontentbutton_toggletest;
// w ww .j  a  va 2s . c  o m
import android.app.Activity;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Toast;

import com.skd.centeredcontentbutton.CenteredContentToggleButton;

public class MainActivity extends Activity {

  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.main);
    
    final CenteredContentToggleButton btn1 = (CenteredContentToggleButton) findViewById(R.id.btn1);
    btn1.setOnClickListener(new OnClickListener() {
      @Override
      public void onClick(View v) {
        String state = (btn1.isChecked()) ? "On" : "Off";
        Toast.makeText(getApplicationContext(), btn1.getText() + " - " + state, Toast.LENGTH_SHORT).show();
      }
    });
    
    final CenteredContentToggleButton btn2 = (CenteredContentToggleButton) findViewById(R.id.btn2);
    btn2.setOnClickListener(new OnClickListener() {
      @Override
      public void onClick(View v) {
        String state = (btn2.isChecked()) ? "On" : "Off";
        Toast.makeText(getApplicationContext(), btn2.getText() + " - " + state, Toast.LENGTH_SHORT).show();
      }
    });
  }
  
}




Java Source Code List

com.skd.centeredcontentbutton.CenteredContentButton.java
com.skd.centeredcontentbutton.CenteredContentToggleButton.java
com.skd.centeredcontentbutton.CenteredContentToggleGroup.java
com.skd.centeredcontentbutton_tabstest.MainActivity.java
com.skd.centeredcontentbutton_toggletest.MainActivity.java
com.skd.centeredcontentbuttontest.MainActivity.java