package com.example.myapplication;

import android.os.Build;
import android.os.Bundle;
import android.support.annotation.RequiresApi;
import android.support.v7.app.AppCompatActivity;
import android.view.View;
import android.widget.EditText;
import android.widget.TextView;

import java.io.StringWriter;

public class MainActivity extends AppCompatActivity {
    TextView text;
    EditText edit_query;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        edit_query = findViewById(R.id.edit_query);
        text = findViewById(R.id.text);
        findViewById(R.id.buttonPanel).setOnClickListener(new View.OnClickListener() {
            @RequiresApi(api = Build.VERSION_CODES.KITKAT)
            @Override
            public void onClick(View v) {
                if (!edit_query.getText().toString().isEmpty()) {
                    StringWriter sw = new StringWriter();
                    sw.append("String Writer :   ");
                    sw.append(edit_query.getText().toString());
                    text.setText(sw.toString());
                }
            }
        });

    }

}
