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
Related
I am studying Android application development with XML in Android Studio at an educational institution. I saw a code like this:
<EditText
android:id=”#+id/MU_EditText_id”
android:layout_width="match_parent"
android:layout_height="wrap-content"
android:hint="Please login e-mail adress"
android:textSize="15px"
android:inputType="textEmailAdress"
android:maxLines="1"
/>
The android:id part caught my attention. Why is this id so long? Couldn't there be a simpler use? Thanks in advance for your valuable information.
The id can be as long or as short as you like it to be. android:id=”#+id/ is necessary, but everything after that is the id that your ui element is referenced by and is up to you to name. The id could also just be a character, but the best practice is to name your ids corresponding to what they are or what they are used for.
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.
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 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
I have a TextView with android:autoLink="email".
If I put my email address in there then a link appears that I can click.
How do I have different text appear (for example 'Send Feedback') instead of the email address but still behave the same when clicked?
Thanks
To achieve what I wanted required a different approach:
TextView feedback = (TextView) findViewById(R.id.TextViewSendFeedback);
feedback.setText(Html.fromHtml("Send Feedback"));
feedback.setMovementMethod(LinkMovementMethod.getInstance());
This basically places HTML in the TextView so I get a link saying 'Send Feedback' but clicking it opens the default email application.
Word of warning: Trying this in the emulator didn't initially work for me, saying it was unsupported. This was just because I didn't have an email account setup. Setting one up in the emulator made the link work as I wanted.
You can use both links and email if you set the following param in the TextView
android:autoLink="web|email"
the links will be opened in the browser and the mails will be sent by the default mail client
Another simple way in layout:
...
<TextView
android:id="#+id/tvTelefone"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="#string/sobre_telefone"
android:textColor="#000000"
android:autoLink="phone" />
...
...
<string name="sobre_telefone">Contato: (45) 9145-0000</string>
}
Read more here: http://developer.android.com/reference/android/widget/TextView.html#attr_android:autoLink
It might be easier to create a button and inside your onClickListener() pull an email from maybe R.string.email.
Fro the Strings From strings.xml :
<string name="your_string"><![CDATA[ contact us at recipient#mail.com for more help.]]></string>
tvObject.setText(Html.fromHtml(getString(R.string.your_string)));
tvObject.setMovementMethod(LinkMovementMethod.getInstance());