0

I have a custom numeric keyboard. I want to use it to write a PIN but I dont know how to get the data after pressing each button and how to save it like in a password with String. Anyones knows how to do it ? Resultat doesn't show on EditText but I need to use it to send to server and check if is correct.

This is my keyboard class. Now it only shows the keyboard.xml.

How to obtain the information from each button and save it in String??

public class PinFragment extends FragmentActivity implements View.OnClickListener {

    private StatusFragment.StatusListener statusListener;
    public static VerificationFragment newInstance() {
        return new VerificationFragment();
    }


    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.fragment_pin);
        // Obtain the SupportMapFragment and get notified when the map is ready to be used.

        TextView text_log_small_pass = (TextView) findViewById(R.id.text_log_small_pass);
        TextView t9_key_forgot = (TextView) findViewById(R.id.t9_key_forgot);
        TextView text_button_back_to_log = (TextView) findViewById(R.id.button_back_to_log);


        //font to use
        Typeface fonts = Typeface.createFromAsset(getAssets(), "fonts/Itelma_Kor_Net_Normal_6.ttf");


        text_log_small_pass.setTypeface(fonts);
        t9_key_forgot.setTypeface(fonts);
        text_button_back_to_log.setTypeface(fonts);


        Button button_back_to_log = (Button) findViewById(R.id.button_back_to_log);
        button_back_to_log.setOnClickListener(this);
        button_back_to_log.getElevation();
    }

    @Override
    public void onClick(View v) {
        switch (v.getId()) {

            case R.id.button_back_to_log:
                {
                    Intent intent = new Intent(this, LoginFragment.class);
                    startActivity(intent);
                }
            case R.id.t9_key_1:
                {

                }
            case R.id.t9_key_2:
                {

                }
            case R.id.t9_key_3:
                {

                }
            case R.id.t9_key_4:
                {

                }
            case R.id.t9_key_5:
                {

                }
            case R.id.t9_key_6:
                {

                }
            case R.id.t9_key_7:
                {

                }
            case R.id.t9_key_8:
                {

                }
            case R.id.t9_key_9:
                {

                }
            case R.id.t9_key_0:
                {

                }
            default:
                {
                    break;
                }
        }
    }
}
Quintin Balsdon
  • 5,484
  • 10
  • 54
  • 95
Singorenko
  • 473
  • 2
  • 7
  • 19
  • use interface in ur fragment to pass your data to ur rquired places and then u can use string builder to append it – Ak9637 Jan 20 '17 at 13:55
  • try this for ur reference http://stackoverflow.com/questions/24777985/how-to-implement-onfragmentinteractionlistener – Ak9637 Jan 20 '17 at 14:01

0 Answers0