Registrating with only #csus.edu email - android

I am building a registration page for a carpool app and I would like to only have a school email address used in the registration. How to input #csus.edu email into Android Studio app?
Currently I have:
<TextView
android:layout_width="wrap_content"
android:text="Email"
android:layout_height="wrap_content" />
<EditText
android:id="#+id/etEmail"
android:layout_height="match_parent"
android:layout_marginBottom="10dp"
android:layout_width="wrap_content" />

Don't let them type it, and don't make it appear in the input box.
Something like:
Name: [text box] #csus.edu
so in this case, "Name:" and "#csus.edu" are both labels.

Client side validation. Just Substring whatever they enter
String end = EmailInput.substring(EmailInput.length() - 9, EmailInput.length());
boolean isValid = end.equals("#csus.edu);
That being said, I also agree with ergonaut in that save the user the time and trouble by not giving the option to enter a wrong email.

Related

Android custom fonts (nunito) not set properly in TextView

I am using custom fonts in my android TextView.
Typeface tf = Typeface.createFromAsset(getAssets(),
"nunitomedium.ttf");
txt2= (TextView) findViewById(R.id.txt2);
txt2.setTypeface(tf);
But padding between lines are not properly show.
<TextView
android:id="#+id/txt2"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="#dimen/_10sdp"
android:layout_marginRight="#dimen/_10sdp"
android:layout_marginTop="#dimen/_15sdp"
android:text="You can send emergency blast to friends and family whenever you feel uncomfortable. Once activated, you will be able to send an emergency blast to your safety network within seconds with the pressing of one button."
android:textColor="#color/colorBlack"
android:textSize="#dimen/_15sdp" />
Here is my output :
I also tried with following code :
android:includeFontPadding="false"
but still same issue. Not sure but I also tried to use justifyTextView from Here but same issue. Does anybody faced same issue before?
Thanks in advance.
EDIT :
If i use android:lineSpacingExtra 1st line have more space then other lines. Here is my code and output.
<TextView
android:id="#+id/txt2"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="#dimen/_10sdp"
android:layout_marginRight="#dimen/_10sdp"
android:layout_marginTop="#dimen/_15sdp"
android:lineSpacingExtra="#dimen/_5sdp" <<<<<<<
android:text="You can send emergency blast to friends and family whenever you feel uncomfortable. Once activated, you will be able to send an emergency blast to your safety network within seconds with the pressing of one button."
android:textColor="#color/colorBlack"
android:textSize="#dimen/_15sdp" />
Late to the party on this - we had exactly the same issue, was fixed completely by replacing the .ttf font file with the latest from Google Fonts - there's a bad early version of this font doing the rounds. Don't forget to remove any android:lineSpacingMultiplier fudges you've put in place int he meanwhile.
Add linespacingMultiplier in your XML
<TextView
android:id="#+id/textview_font"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="#dimen/_10sdp"
android:layout_marginRight="#dimen/_10sdp"
android:layout_marginTop="#dimen/_15sdp"
android:text="You can send emergency blast to friends and family whenever you feel uncomfortable. Once activated, you will be able to send an emergency blast to your safety network within seconds with the pressing of one button."
android:textColor="#android:color/black"
android:lineSpacingMultiplier="3"
android:textSize="#dimen/_15sdp" />
Or
Add these line in your code:-
mTextViewFont=(TextView)findViewById(R.id.textview_font);
Typeface tf = Typeface.createFromAsset(getAssets(),
"nunitomedium.ttf");
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
mTextViewFont.setLineSpacing((float) 5.5,(float) 1.2);
}
mTextViewFont.setTypeface(tf);
There was issue in the font file that is because of the site from where you downloaded it. I download the file from
dafontfree.net/download-nunito-f92263.htm
and then replace your file from asset folder.
and this is the output of it.

How to check DND status of a mobile number in Android?

I have an application built that works for checking DND Status, it has an edittext field and a button. In edittext the user enters a mobile number and on click of button I want to check the DND status of in android. How to check DND status of a mobile number?
<EditText
android:id="#+id/edtNumber"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#+id/txtHeading"
android:layout_centerHorizontal="true"
android:ems="10"
android:inputType="number"
android:maxLength="12">
<requestFocus />
</EditText>
<Button
android:id="#+id/btnCheckCheckDND"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#+id/edtNumber"
android:layout_centerHorizontal="true"
android:text="Check Status"
/>
For DND check you need a membership of TRAI http://www.nccptrai.gov.in/nccpregistry/ then TRAI provide you all DND active database in CSV formate.
Also you can use third part toll of http apis eg. http://checkdnd.com/api/check_dnd_no_api.php?mobiles=9999999999
Free DND Check API

Phone number formatting in EditText

I have been trying to get
XML File
<EditText
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="#+id/phoneEditText"
android:layout_marginTop="10dp"
android:padding="16dp"
android:inputType="phone"/>
Java
etContact = (EditText)findViewById( R.id.phoneEditText );
etContact.addTextChangedListener(new PhoneNumberFormattingTextWatcher() );
To successfully format the number entered by the user but it fails to perform the formatting on my Nexus 5 test device, while on lower API levels it does work. I am not sure if this has been changed of phased out since KitKat but it refuses to work now. Is there a work around or additional calls to enable this to work on KitKat?

Android TextView link email containing apostrophes

I have a TextView:
<TextView
android:text="Contact details go here"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:id="#+id/tvContactDetails"
android:autoLink="email" />
I then put an e-mail address in (I'm using Monodroid, but it doesn't really make any difference here):
TextView tvContactDetails = FindViewById(Resource.Id.tvContactDetails)
tvContactDetails.Text = sEmail;
If I give it an e-mail address like joe#bloggs.com it's fine. But when I give it kevin.o'donnel#abc.com it only hyperlinks donnel#abc.com. How can I get it to recognise apostrophes as part of the e-mail address?
After a while of searching and trying things I found a solution which worked for me at:
TextView to send email when clicked
TextView now looks like this:
<TextView
android:text="Contact details go here"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:id="#+id/tvContactDetails"/>
(autoLink taken out)
The code now looks like this:
TextView tvContactDetails = FindViewById(Resource.Id.tvContactDetails)
string sHtmlEmail = "" + sEmail + "";
tvContactDetails.TextFormatted = Html.FromHtml(sHtmlEmail);
tvContactDetails.MovementMethod = Android.Text.Method.LinkMovementMethod.Instance;
Thanks for the suggestions though.

Android Linkify Email Is Not Supported

I tried to linkify an email address in my Android app, but it didn't work.
Method 1:
<TextView
android:id="#+id/email"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="#string/email_address"
android:autoLink="email"/>
Method 2:
Linkify.addLinks((TextView)view.findViewById(R.id.email), Linkify.EMAIL_ADDRESSES);
I got "That action is not currently supported" using both methods. Is it a bug? Or I just can't try it out in a
Method 1 is sufficient.
If Android does recognize and "linkify" the email address but you receive an "action is not currently supported" message when you press it in the emulator, ensure that you have configured an email address in the Email app.
Once your email address is configured, pressing one of these links should jump straight to an email composition Activity.
use both methods for Linkify email address.as
TextView textView = (TextView)findViewById(R.id.email);
Linkify.addLinks(textView, Linkify.EMAIL_ADDRESSES);
and in Layout xml:
<TextView
android:id="#+id/email"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="#string/email_address"
android:autoLink="email"/>

Categories

Resources