public class MainActivity extends AppCompatActivity {
Switch swi;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
//init switch
swi = (Switch) findViewById(R.id.switch1);
//swi.setOnClickListener(new View.OnClickListener() {
}
protected void ClickMe(View v){
//init switch
//Switch swi = (Switch) findViewById(R.id.switch1);
swi.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked)
{
if (isChecked){ //init editText
EditText userEditText = (EditText) findViewById(R.id.editText);
//new activity
Intent intent = new Intent(MainActivity.this, Parsed.class);
// в ключ url пихаем текст из первого текстового поля
intent.putExtra("url", userEditText.getText().toString());
//start new activity
startActivity(intent);}
else { }
}
});
}
}
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
//init switch
Switch swi = (Switch) findViewById(R.id.switch1);
}
protected void ClickMe(View v){
swi.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener()
{
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked)
{
if (isChecked){ //init editText
//init editText
EditText userEditText = (EditText) findViewById(R.id.editText);
//new activity
Intent intent = new Intent(MainActivity.this, Parsed.class);
// в ключ url пихаем текст из первого текстового поля
intent.putExtra("url", userEditText.getText().toString());
//start new activity
startActivity(intent);
else { }
}
});
}
//init switch
Switch swi = (Switch) findViewById(R.id.switch1);
swi.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
}
});