When switching orientation the activity restarts.

You need to put this code somewhere in onCreate:
EditText editText = (EditText) findViewById(R.id.EditText01);
editText.setInputType(
InputType.TYPE_TEXT_VARIATION_PASSWORD); //also available from designer
editText.setTransformationMethod(new PasswordTransformationMethod());

How exactly are you managing NOT to set the properties in onCreate? Are you
reusing the EditTexts?


Please play with this code and see the results - comment and uncomment the
instructions in onCreate and also see the button clicks.

package com.tests;

import android.app.Activity;
import android.content.res.Configuration;
import android.os.Bundle;
import android.text.InputType;
import android.text.method.PasswordTransformationMethod;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.EditText;

public class Main extends Activity implements OnClickListener {
    /** Called when the activity is first created. */
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);

        Button button = (Button) findViewById(R.id.Button01);
        button.setOnClickListener(this);

        // EditText editText = (EditText) findViewById(R.id.EditText01);
        // editText.setInputType(InputType.TYPE_TEXT_VARIATION_PASSWORD);
        // editText.setTransformationMethod(new
PasswordTransformationMethod());
    }

    @Override
    public void onClick(View v) {
        EditText editText = (EditText) findViewById(R.id.EditText01);
        editText.setInputType(InputType.TYPE_TEXT_VARIATION_PASSWORD);
        editText.setTransformationMethod(new
PasswordTransformationMethod());
    }
}



BR,
Adrian Vintu

http://adrianvintu.com


On Mon, Mar 15, 2010 at 6:12 PM, ahamed <[email protected]> wrote:

>
> I tried the following but no luck.  on landscape mode on fullscreen
> vkp mode text doenst masked.
>  text1 = (EditText) this.findViewById(R.id.EditText01);
>  text1.setTransformationMethod(new PasswordTransformationMethod());
>
> Please let me know how can i mask the password in fullscreen VKP mode.
>
> thanks
> ahamed
>
> On Mar 11, 5:20 pm, ahamed <[email protected]> wrote:
> > Thanks for the reply Adrian.
> >
> > I tried editText.setTransformationMethod(new
> > PasswordTransformationMethod()); and
> > editText.setInputType(InputType.TYPE_TEXT_VARIATION_PASSWORD); for
> > masking password in extracted view softkeyboard. but no luck.
> >
> > how would initialization vary  for edit text.
> > Im initializing by using  EditText setPinEditText= new
> > EditText(context);  But you wrote  EditText editText = (EditText)
> > findViewById(R.id.EditText01);
> >
> > I havnt set id for parent Edittext and also so R.id.EditText01 is
> > undefined in my class.  And also  how can extracted soft keyboard UI
> > view links to parent edittext.
> > please clarify.
> > many thanks in advance.
> >
> > On Mar 3, 5:06 pm, Adrian Vintu <[email protected]> wrote:
> >
> >
> >
> > > EditText editText = (EditText) findViewById(R.id.EditText01);
> > > editText.setInputType(InputType.TYPE_TEXT_VARIATION_PASSWORD); //also
> > > available from designer
> > > editText.setTransformationMethod(new PasswordTransformationMethod());
> >
> > > BR,
> > > Adrian Vintu
> >
> > >http://adrianvintu.com
> >
> > > On Thu, Feb 25, 2010 at 4:44 PM, ahamed <[email protected]> wrote:
> > > > Dear Experts,
> >
> > > > Can you please assist how can we mask password input in fullscreen
> > > > virtual keypad.
> > > > EditText setPinEditText= new EditText(context);
> > > > setPinEditText.setImeOptions(EditorInfo.IME_ACTION_UNSPECIFIED);)
> >
> > > > I tried using
> > > > setPinEditText.setTransformationMethod(new
> > > > PasswordTransformationMethod());
> >
> > > > Masking the password input in portrait vkp mode works fine with this
> > > > change but when I rotate to landscape mode, in fullscreen virtual
> > > > keyboard mode it doenst worked.
> >
> > > > Any help would be highly appreciated.
> >
> > > > --
> > > > You received this message because you are subscribed to the Google
> > > > Groups "Android Developers" group.
> > > > To post to this group, send email to
> [email protected]
> > > > To unsubscribe from this group, send email to
> > > > [email protected]<android-developers%[email protected]>
> <android-developers%2bunsubsĀ­[email protected]>
> > > > For more options, visit this group at
> > > >http://groups.google.com/group/android-developers?hl=en- Hide quoted
> text -
> >
> > - Show quoted text -
>
> --
> You received this message because you are subscribed to the Google
> Groups "Android Developers" group.
> To post to this group, send email to [email protected]
> To unsubscribe from this group, send email to
> [email protected]<android-developers%[email protected]>
> For more options, visit this group at
> http://groups.google.com/group/android-developers?hl=en
>

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to