I have an EditText like this:
<EditText
android:id="#+id/txt_login_username"
android:layout_width="300dp"
android:layout_height="40dp"
android:layout_above="#+id/pengala_logo"
android:layout_alignLeft="#+id/txt_login_pwd"
android:ems="10"
android:hint="Please enter Email"
android:inputType="textAutoComplete"
android:textColorHint="#ffffff"
android:textSize="20sp" />
I want to show all email ids as suggestion when a user starts typing in the EditText. Similar to this
For that use Autocomplete TextView.
When user enter userName in Autocomplete TextView and press login you need to store username in sharedpreferences. For sharedpreferences see This tutorial.
Select entred values from sharedpreferences and display it in your Autocomplete TextView when user comes again.
Use this library for achieving this
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent">
<jp.yokomark.widget.account.autocomp.AccountAutoCompleteEditText
android:id="#+id/any"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="#string/label_account_type_any"
app:accountType="any"/>
AccountAutoCompleteEditText has a custom attribute of accountType. This attribute accepts any of the following value.
Value Meaning
any Show the candidate account of all type.
email Show the candidate account using email address.
phoneNumber Show the candidate account using phone number.
By this you can easily use it
Related
Modifying an APK to try to make something slightly more user friendly. There is a login screen with username and password and a server portal field. The portal field now never needs to change. So I want to set a default text so the user does not have to type in the full portal URL
Currently looks like this
<EditText android:textSize="15.0dip"
android:textColor="#color/black"
android:textColorHint="#color/white"
android:id="#id/et_sever_url"
android:background="#drawable/selector_login_fields"
android:paddingLeft="20.0dip"
android:paddingRight="20.0dip"
android:focusable="true"
android:nextFocusUp="#id/et_password"
android:nextFocusDown="#id/bt_submit"
android:layout_width="fill_parent"
android:layout_height="50.0dip"
android:layout_marginLeft="25.0dip"
android:layout_marginTop="20.0dip"
android:layout_marginRight="25.0dip"
android:text="#string/serverurl"
android:hint="#string/serverurl"
android:maxLines="1" android:lines="1"
android:layout_below="#id/et_password"
android:layout_centerHorizontal="true"
android:inputType="textUri"
android:textCursorDrawable="#null"
android:fontFamily="sans-serif" />
The text and the hint just put the server url in the field but it still has to be manually typed in. I tried to use android:setText="#string/serverurl" but then the apk fails to compile again.
There is no edittext properties like this : android:setText="#string/serverurl"
All you want to do set default string to your editext then in xml just use below property.
android:text="#string/serverurl"
Also remove the hint property you really don't need that because you are seting default text so hint won't be shown.
Also second why to do this in java code like below.
EditText edtServerUrl =findViewById(R.id.et_sever_url);
edtServerUrl.setText(R.string.serverurl)
Put above code inside onCreate() method of activity.
How I should provide id of EditText for filling credentials for pre-launch reports on Google Play (Beta/Alpha versions of the app)?
I tried
#+id/editTextLogin, editTextLogin, R.id.editTextLogin and always get description "wrong resource name".
What is correct schema for resource name there?
As information icon says:
The Android resource name of the text field within your app where the given username should be entered.
AND Android Resources documentations says:
<resource name> is either the resource filename without the extension or the android:name attribute value in the XML element (for simple values).
So in your case editTextLogin will go in that field.
I would like to share my case as it is quite different than normal sign-in:
It is quite similar to Google sign-in. I am asking for username first and after validating it, on next fragment I am showing his/her name and designation and asking for password.
For above scenario I used two fragments. In Username fragment I kept one EditText with resource name username and next Button with resource name login and in other fragment (Password fragment) I used EditText with resource name password and again one Button with resource name login.
And this is how I provided my credentials:
Example Username field:
<android.support.v7.widget.AppCompatEditText
android:id="#+id/username"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
Example Password field:
<android.support.v7.widget.AppCompatEditText
android:id="#+id/password"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:inputType="textPassword" />
Example Login button:
<android.support.v7.widget.AppCompatButton
android:id="#+id/login"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="8dp" />
EDIT
Reference of new Google Play Store console
I am trying to do agent training using api.ai.
I wanted to read a secret key from user expression. Is it possible to allow the user text entry in secured format (Like we enter passwords - the big black dots)?
You can use an EditText with the inputType set to textPassword like this:
<EditText
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:inputType="textPassword"/>
I'm working on an Android app and need to email to various users.
Currently I have an 'EditText' which is configured as:
android:inputType="textEmailAddress"
Once a button is pressed an email is sent to the address specified in this field.
But I would to create a multi address input list.
Is there a way to do it without change the 'EditText' to multiple lines and parsing the string myself?
Googled it but could not find a solution.
Any suggestions?
Thanks in advance.
There is a lines and minLines attribute in EditText. Example would be:
<EditText
android:inputType="textEmailAddress" <!-- email address -->
android:lines="8" <!-- Total Lines prior display -->
android:minLines="6" <!-- Minimum lines -->
</EditText>
See this answer for further details.
You may use a separator to separate the emails:
first_email#gmail.com, second_email#gmail.com and so on. In your code call split() method to get an array of emails from this long line.
I used the xml below to design the layout of my android app. I used the EditText field to get an input from the user.
<EditText android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="#+id/editText1"
android:tag="Tag Me"
android:inputType="text">
<requestFocus></requestFocus>
</EditText>
How do I get the text typed in that EditText and print it using Python?
You can't use Python, Android programming is done in Java. You can get the text from the EditText as follows (in Java):
EditText et = (EditText)findViewById( R.id.editText1 );
String s = et.getText().toString();
If you're asking how to send that text to a webserver that uses Python, that's quite a bit more complicated.