Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: Java Eclipse
hello, I am developing a simple application of send message
my design should be a same as which is in android phones.I have 3 Edit text, one button and keyboard.My problem is I dont know how to make focus to say if edit text1 is focused then the text which on edit text3 wil be there by clicking on button else if edit text2 is focused then the text which on edit text3 wil be on edit text2.
I used this but it dose not work and there is no error.
  public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_nada_saif_70126172);
        
        Button bq=(Button)findViewById(R.id.button2);
       
        EditText et1=(EditText)findViewById(R.id.editText1);
        EditText et2=(EditText)findViewById(R.id.editText2);
        final EditText et3=(EditText)findViewById(R.id.editText3);
        
         
        if (et2.requestFocus())
        {
        	bq.setOnClickListener(new View.OnClickListener() {
            	
    			@Override
    			public void onClick(View v) {
    				// TODO Auto-generated method stub
    				et3.setText(et3.getText()+"q");
    				final EditText et2=(EditText)findViewById(R.id.editText2);
    				Button bsend=(Button)findViewById(R.id.button1);
    				bsend.setOnClickListener(new View.OnClickListener() {
    					
    					@Override
    					public void onClick(View v) {
    						// TODO Auto-generated method stub
    						et2.setText(et3.getText());
    						
    												}
    																	});
    				
    										}
    														});
        }
         else 
        	 //if
         
        // (et1.requestFocus())
         
        bq.setOnClickListener(new View.OnClickListener() {
        	
			@Override
			public void onClick(View v) {
				// TODO Auto-generated method stub
				et3.setText(et3.getText()+"q");
				final EditText et1=(EditText)findViewById(R.id.editText1);
				Button bsend=(Button)findViewById(R.id.button1);
				bsend.setOnClickListener(new View.OnClickListener() {
					
					@Override
					public void onClick(View v) {
						// TODO Auto-generated method stub
						et1.setText(et3.getText());
						
												}
																	});
				
										}
														});
Posted 6-Dec-12 2:10am
Edited 6-Dec-12 2:29am
33.1K
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 OriginalGriff 310
1 PhilLenoir 164
2 Richard MacCutchan 160
3 Sharmanuj 146
4 Magic Wonder 129
0 Sergey Alexandrovich Kryukov 6,081
1 OriginalGriff 5,115
2 CPallini 2,473
3 Richard MacCutchan 1,597
4 Abhinav S 1,505


Advertise | Privacy | Mobile
Web03 | 2.8.140814.1 | Last Updated 6 Dec 2012
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100