0

I have complicated XML file. Here is a piece:

<LinearLayout
   android:layout_width="match_parent"
   android:layout_height="wrap_content"
   android:orientation="horizontal">

   <android.support.design.widget.TextInputLayout
      android:layout_width="0dp"
      android:layout_weight="1"
      android:layout_height="wrap_content"
      android:hint="@string/tel"
      style="@style/AppTheme.TextInputLayout"
      android:layout_marginBottom="@dimen/space_high">

      <android.support.design.widget.TextInputEditText
         android:id="@+id/point.j_tel"
         android:layout_width="match_parent"
         android:layout_height="wrap_content"
         style="@style/AppTheme.TextInputEditText"/>

   </android.support.design.widget.TextInputLayout>

   <ImageButton
      android:layout_gravity="center"
      android:id="@+id/point.telEdit"
      android:layout_width="wrap_content"
      android:layout_height="wrap_content"
      android:background="@drawable/tab_icon_edit"/>

</LinearLayout>

I'm trying to make phone numbers inside android:id="@+id/point.j_tel" clickable. I tried android:autoLink="all", android:autolink="phone", android:linksClickable="true". But this only led phone numbers become underscored and semi tranceparent but not clickable . I also tried this inside my Java code:

cameraManager = new CameraManager(this);
etNotice = findViewById(R.id.point_c_notice);
getValidations().add(new TextEmptyValidation(this, etNotice));
etNotice.addTextChangedListener(getLastValidation());
tiAddress = findViewById(R.id.point_c_address);
tiTel = findViewById(R.id.point_j_tel);
tiTel.setAutoLinkMask(Linkify.PHONE_NUMBERS);
tiTel.setMovementMethod(new ScrollingMovementMethod());     

I tried a lot of things during two days, but nothing helps and I almost gave up. Maybe somebody has any ideas?

Alex Rmcf
  • 804
  • 7
  • 14

1 Answers1

0

Why do you need to click on EditText to make the call? It should be TextView or add calling button beside the EditText

Duy Khanh Nguyen
  • 454
  • 3
  • 11
  • That EditText may contain several phone numbers depending on how much the user adds and I have to provide possibility so that he can choose one of them. – Alex Rmcf Oct 16 '19 at 18:52
  • At application starts there is nothing inside this EditText. But user can put phone number (or numbers) in it using special form(which consist of name and phone number) from another activity.So finally we can have inside that EditText, for example something like this - "+18889991199 - John, +19998882233 - Mary, +17772221122 - Steve" – Alex Rmcf Oct 16 '19 at 19:02
  • As I understand, you just need to display list of numbers and want to open dialer when user click on a number. In this case you should use TextView instead of EditText. You can add onClickListener to the TextView to start dialer intent – Duy Khanh Nguyen Oct 17 '19 at 01:58
  • how I suppose to choose phone number this way? – Alex Rmcf Oct 17 '19 at 06:15
  • You can use RecyclerView to show a list of phone numbers or add TextView dynamically which contain phone number. For each TextView, set `TextView.setOnClickListener` and call the start dialer method – Duy Khanh Nguyen Oct 17 '19 at 06:53
  • thank you for your advice, but I done it this way before asked my question here. linking text inside this TextView is exactly what i need. – Alex Rmcf Oct 18 '19 at 10:16