I want to use Service for Phone number - android

See the view here
I want to do this only, like when someone click on a number format, then my app should also be visible in the OPEN WITH list...

Add android:autoLink="phone" into the TextView.
For example:
<TextView
android:id="#+id/tvMsg"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:autoLink="phone"
android:textColorLink="#color/purple_500"/>
For more info please check these questions: Question1 and Question2

Related

How to make a android textview autolink its value as a phone number

So Ive currently made a working app that when the user puts in an employees name and searches it searches my sql database and returns with a name, phone number, id and address all in a list so that each result is kinda separated from the next. Im trying to make the phone number auto link as a phone number so that the user can click on it and it will call it but Im unsure of how to do this. Yes I have followed and looked at the other tutorials for that on this site and haven't been able to make it work. hoping you guys can help me out. For starters, yes I have added the permission to the manifest.
Here is the xml layout for the textview I wish to make clickable
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceSmall"
android:text="Phone Number"
android:id="#+id/textType"
android:layout_marginLeft="5dp"
android:layout_below="#id/textSize"
android:textColor="#666"
android:clickable="true" />
And here the java that setups up how the number will be displayed. Not sure if this is needed or even helps.
myHolder.textType.setText("Mobile Phone# " + current.Phonenum);
Try adding the android:autoLink="phone" attribute, so your code should look like this:
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceSmall"
android:text="123 456 7890"
android:id="#+id/textType"
android:layout_marginLeft="5dp"
android:layout_below="#id/textSize"
android:autoLink="phone"
android:textColor="#666"
android:clickable="true"
/>
On the TextView in the xml add:
android:inputType="phone"

How can I implement in my application something like the additional fields of the field "name" realized in Android contacts?

I want to do something like that, realized in the "add new contact" form
Additional fields ( details ) of the "name" field in the "add new contact" form
Simplified mode of the field, when additional fields do not shown
I want to do something like that, so when user clicks on the show\hide button on the right, additional form fields appear. How it works in the native Android contacts? Is it ExpendableListView with adapter, or just a imagebutton with OnClick action that shows additional fields, or something else? How can i do something like that in my application?
Updated
Details of my application
I have an xActivity, where user should use a NumberPicker to pick a number of pupils he want to add to the database. After that, application will show to the form that number of "pupil fields", that user picked before. But each of that pupil fields should have a details, with fields such as "Name", "Surname", "Age", and other.
User can pick a number from 1 to 10.
All that I have now - a NumberPicker, so user can choose a number, but I just want to show other fields to user the best way i can. I like the way Android contacts do it with additional fields, so I think that I can do exactly as realized in my screenshots of Android contacts
A simple way to achieve the behavior you want to get is described below:
On your layout.xml, you will define the ImageView that will contain the drawable needed to indicate there are extra fields:
​<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<EditText
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:inputType="textPersonName"
android:id="#+id/edtName"
android:layout_alignParentTop="true"
android:layout_alignParentLeft="true"
android:layout_alignRight="#+id/edtSurname"
android:layout_alignEnd="#+id/edtSurname"/>
<EditText
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:inputType="textPersonName"
android:id="#+id/edtSurname"
android:layout_below="#+id/edtName"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"/>
<EditText
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:inputType="textEmailAddress"
android:id="#+id/edtEmail"
android:layout_below="#+id/edtSurname"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"/>
<EditText
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:inputType="phone"
android:id="#+id/edtPhone"
android:layout_below="#+id/edtEmail"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"/>
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="#+id/imageView"
android:src="#android:drawable/ic_menu_more"
android:layout_alignTop="#+id/edtName"
android:layout_toRightOf="#+id/edtName"
android:layout_toEndOf="#+id/edtName"
android:onClick="expandOptions"/>
</RelativeLayout>
Note the android:onCLick field on the ImageView. It is telling the method expandOptions will be called when clicking the drawable. You should code it in your Activity and, to obtain the behaviour you describe, you may need something like:
public void expandOptions(View v) {
if(isExpanded) {
edtSurname.setVisibility(View.GONE);
edtEmail.setVisibility(View.GONE);
edtPhone.setVisibility(View.GONE);
} else {
edtSurname.setVisibility(View.VISIBLE);
edtEmail.setVisibility(View.VISIBLE);
edtPhone.setVisibility(View.VISIBLE);
}
isExpanded = !isExpanded;
}
This sample is very basic. I am assuming you load all hidden components when your activity starts, but you may prefer to dynamically inflate the extra fields when the user presses the expand button. You may also need to control if fields are required once expanded or not, it is up to you.

How do you create a 'read more' layout in Android?

I want to display a 'read more' link when the obtained text increases to a certain limit, so that if user wants to read in detail, they can click on read more just like the Application installation page of Play Store
Please suggest me on how to implement this
You can refer this. Layout available on git hub
https://github.com/traex/ExpandableLayout
Thank you all for giving answer, here is how i solved it.
There is a property called android:maxLines=""
using this property we can add Read More text view below the text view by making it clickable so that when user clicks on the text view we can perform any action we wanted
Example:
<TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceSmall"
android:text="Device supports NFS etc....."
android:maxLines="4"
android:id="#+id/description" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:clickable="true"
android:textAppearance="?android:attr/textAppearanceMedium"
android:text="Read More"
android:layout_gravity="center_horizontal"
android:textColor="#0066FF"
android:id="#+id/readmore" />
I hope this helps.
Look like on google play this link opens other activity. So, it is just button with startActivity() behavior.

Simple non interactive ListView Android

Please cope with me as im new to android and i have done a lot of searching on my own, about this, and im fed up not finding a proper way.
This is my custom listview template. rowbuttonlayout.xml.
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content" >
<TextView
android:id="#+id/label"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="#+id/label"
android:textSize="19.6dp" >
</TextView>
<CheckBox
android:id="#+id/check"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_marginLeft="3.6dp"
android:layout_marginRight="9.6dp" >
</CheckBox>
<TextView
android:id="#+id/result"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBaseline="#+id/check"
android:layout_alignBottom="#+id/check"
android:layout_toLeftOf="#+id/check"
android:text="#string/nothing" />
</RelativeLayout>
What i want is to create something like this in this pic without the header and footer.
http://www.vogella.com/articles/AndroidListView/images/xinteractive10.png.pagespeed.ic.V0cVgp99SN.png
As on my layout ill be having another textview just before the checkbox as well. Also ill be adding a dynamic button at the footer.
Now i dont want the users to interact with my listview. Only the button should be clickable and when they click it i want to run some calculations and show them in the relevant "result" textview and to check the checkbox next to it to show that i have calculated it. Meaning i have to access each and every "result" textview and "check" checkbox in the code.
Please provide me some guidance for coding this app. Im fed up looking through very complex codes trying learn on my own. Many many thanks for your help.
Shavinka
Check out below links...
ListView + CheckBox =?
How to get checked items from android listview?
http://sunil-android.blogspot.in/2013/04/android-listview-checkbox-example.html
http://fundoocode.net/android-listview-checkbox-example-onitemclicklistener-and-onclicklistener/
http://www.mysamplecode.com/2012/07/android-listview-checkbox-example.html

EdtiText: Invisible number and how to make link to google map

I have a very simple layout made of TextViews and disabled EditTexts put by turns. Most of the EditTexts contain plain text but I have two special fields and I have problem with them:
Phone number: as an autoLink type I set "phone". The problem is that a phone number is invisible until I click inside the edit:
<EditText
android:id="#+id/service_order_contact_phone"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_gravity="right"
android:focusable="false"
android:enabled="false"
android:inputType="phone"
android:gravity="right"
android:autoLink="phone" >
</EditText>
I would like to enable user to click address to open google map. I set an autoLink attribute to "map" but it seems not to work. Do you know how to do it?
<EditText
android:id="#+id/service_order_address"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_gravity="right"
android:enabled="false"
android:focusable="false"
android:singleLine="false"
android:lines="2"
android:inputType="textPostalAddress|textMultiLine"
android:autoLink="map"
android:gravity="right" >
</EditText>
I don't think EditText and autoLink are designed to work together... Think about this scenario when the user is editing a value:
The user enters a phone number, say: 5557891234
The user made a mistake and clicks in the middle of the EditText to be able to change a digit in the middle of the phone number...
Instead of being allowed to edit the number, the link action takes them to the dialer with the incorrect phone number.

Categories

Resources