how to use permission_send Manifest android inside subclass? : <p>I made an application using the tab navigation in android studio. On one of the tabs I want to make an SMS sending feature. I've added permissions to AndroidManifest.xml but the feature still won't work</p>

<p>This is My AndroidManifest.xml</p>

<pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
&lt;manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.melani.dprdbkt"&gt;
  &lt;uses-permission android:name="android.permission.SEND_SMS" /&gt;
  &lt;uses-permission android:name="android.permission.INTERNET"/&gt;
  &lt;uses-permission android:name="android.permission.ACCESS_WIFI_STATE"/&gt;
  &lt;uses-permission android:name="android.permission.CHANGE_WIFI_STATE"/&gt;

  &lt;application
      android:allowBackup="true"
      android:icon="@mipmap/ic_launcher"
      android:label="@string/app_name"
      android:roundIcon="@mipmap/ic_launcher_round"
      android:supportsRtl="true"
      android:theme="@style/AppTheme"&gt;
      &lt;activity android:name=".MainActivity"&gt;
          &lt;intent-filter&gt;
              &lt;action android:name="android.intent.action.MAIN" /&gt;
              &lt;category android:name="android.intent.category.LAUNCHER" /&gt;

          &lt;/intent-filter&gt;
      &lt;/activity&gt;
      &lt;activity
          android:name=".SendSMSActivity"
          android:parentActivityName=".MainActivity" /&gt;


  &lt;/application&gt;
&lt;/manifest&gt;
</code></pre>

<p>This is My MainActivity.java</p>

<pre><code>package com.melani.dprdbkt;

import android.os.Build;
import android.os.Bundle;
import android.support.design.widget.TabItem;
import android.support.design.widget.TabLayout;
import android.support.v4.content.ContextCompat;
import android.support.v4.view.ViewPager;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.Toolbar;

public class MainActivity extends AppCompatActivity {

    Toolbar toolbar;
    TabLayout tabLayout;
    ViewPager viewPager;
    PageAdapter pageAdapter;
    TabItem tabHome;
    TabItem tabBerita;
    TabItem tabAgenda;
    TabItem tabAnggota;
    TabItem tabLink;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);

        toolbar = findViewById(R.id.toolbar);
        toolbar.setTitle(getResources().getString(R.string.app_name));
        setSupportActionBar(toolbar);

        tabLayout = findViewById(R.id.tablayout);
        tabHome = findViewById(R.id.tabHome);
        tabBerita = findViewById(R.id.tabBerita);
        tabAgenda = findViewById(R.id.tabAgenda);
        tabAnggota = findViewById(R.id.tabAnggota);
        tabLink = findViewById(R.id.tabLink);
        viewPager = findViewById(R.id.viewPager);

        pageAdapter = new PageAdapter(getSupportFragmentManager(), tabLayout.getTabCount());
        viewPager.setAdapter(pageAdapter);


        tabLayout.addOnTabSelectedListener(new TabLayout.OnTabSelectedListener() {
            @Override
            public void onTabSelected(TabLayout.Tab tab) {
                viewPager.setCurrentItem(tab.getPosition());
                if (tab.getPosition() == 1) {
                    toolbar.setBackgroundColor(ContextCompat.getColor(MainActivity.this,
                            R.color.colorHome));
                    tabLayout.setBackgroundColor(ContextCompat.getColor(MainActivity.this,
                            R.color.colorHome));
                    if (Build.VERSION.SDK_INT &gt;= Build.VERSION_CODES.LOLLIPOP) {
                        getWindow().setStatusBarColor(ContextCompat.getColor(MainActivity.this,
                                R.color.colorHome));
                    }
                } else if (tab.getPosition() == 2) {
                    toolbar.setBackgroundColor(ContextCompat.getColor(MainActivity.this,
                            R.color.colorBerita));
                    tabLayout.setBackgroundColor(ContextCompat.getColor(MainActivity.this,
                            R.color.colorBerita));
                    if (Build.VERSION.SDK_INT &gt;= Build.VERSION_CODES.LOLLIPOP) {
                        getWindow().setStatusBarColor(ContextCompat.getColor(MainActivity.this,
                                R.color.colorBerita));
                    }
                }
                else if (tab.getPosition() == 3) {
                    toolbar.setBackgroundColor(ContextCompat.getColor(MainActivity.this,
                            R.color.colorAgenda));
                    tabLayout.setBackgroundColor(ContextCompat.getColor(MainActivity.this,
                            R.color.colorAgenda));
                    if (Build.VERSION.SDK_INT &gt;= Build.VERSION_CODES.LOLLIPOP) {
                        getWindow().setStatusBarColor(ContextCompat.getColor(MainActivity.this,
                                R.color.colorAgenda));
                    }
                } else if (tab.getPosition() == 4) {
                    toolbar.setBackgroundColor(ContextCompat.getColor(MainActivity.this,
                            R.color.colorAnggota));
                    tabLayout.setBackgroundColor(ContextCompat.getColor(MainActivity.this,
                            R.color.colorAnggota));
                    if (Build.VERSION.SDK_INT &gt;= Build.VERSION_CODES.LOLLIPOP) {
                        getWindow().setStatusBarColor(ContextCompat.getColor(MainActivity.this,
                                R.color.colorAnggota));
                    }
                }
                else {
                    toolbar.setBackgroundColor(ContextCompat.getColor(MainActivity.this,
                            R.color.colorLink));
                    tabLayout.setBackgroundColor(ContextCompat.getColor(MainActivity.this,
                            R.color.colorLink));
                    if (Build.VERSION.SDK_INT &gt;= Build.VERSION_CODES.LOLLIPOP) {
                        getWindow().setStatusBarColor(ContextCompat.getColor(MainActivity.this,
                                R.color.colorLink));
                    }
                }
            }

            @Override
            public void onTabUnselected(TabLayout.Tab tab) {

            }

            @Override
            public void onTabReselected(TabLayout.Tab tab) {

            }
        });
        viewPager.addOnPageChangeListener(new TabLayout.TabLayoutOnPageChangeListener(tabLayout));

    }
}

</code></pre>

<p>Send SMSActivity.java</p>

<pre><code>package com.melani.dprdbkt;

import android.os.Bundle;
import android.telephony.SmsManager;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.Toast;

public class SendSMSActivity extends MainActivity {
private  static final int MY_PERMISSION_REQUEST_SEND_SMS=0;
    private EditText txtMobile;
    private EditText txtMessage;
    private Button btnSms;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.fragment_link);
        txtMobile = (EditText)findViewById(R.id.editTextPhoneNo);
        txtMessage = (EditText)findViewById(R.id.editTextSMS);
        btnSms = (Button)findViewById(R.id.buttonSend);
        btnSms.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                try{
                    SmsManager smgr = SmsManager.getDefault();
                    smgr.sendTextMessage(txtMobile.getText().toString(),null,txtMessage.getText().toString(),null,null);
                    Toast.makeText(SendSMSActivity.this, "SMS Sent Successfully", Toast.LENGTH_SHORT).show();
                }
                catch (Exception e){
                    Toast.makeText(SendSMSActivity.this, "SMS Failed to Send, Please try again", Toast.LENGTH_SHORT).show();
                }
            }
        });
    }
}
</code></pre>

<p>linkFragment.java</p>

<pre><code>package com.melani.dprdbkt;


import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.Menu;
import android.view.MenuInflater;
import android.view.MenuItem;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Toast;
//import android.app.m

/**
 * A simple {@link Fragment} subclass.
 */
public class LinkFragment extends Fragment {

    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container,
                             Bundle savedInstanceState) {
        // Inflate the layout for this fragment
        setHasOptionsMenu(true);
        return inflater.inflate(R.layout.fragment_link, container, false);
    }

    @Override
    public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
        inflater.inflate(R.menu.menu_link, menu);
    }

    @Override
    public boolean onOptionsItemSelected(MenuItem item) {
        if (item.getItemId() == R.id.action_link) {
            Toast.makeText(getActivity(), "Clicked on " + item.getTitle(), Toast.LENGTH_SHORT)
                    .show();
        }
        return true;
    }
}

</code></pre>

<p>fragment_link.xml</p>

<pre><code>&lt;FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    tools:context="com.melani.dprdbkt.LinkFragment"&gt;

    &lt;!-- TODO: Update blank fragment layout --&gt;
    &lt;TextView
        android:id="@+id/textViewPhoneNo"
        android:layout_width="63dp"
        android:layout_height="50dp"
        android:layout_marginTop="10dp"
        android:text="Ke : "

        android:textAppearance="@style/TextAppearance.AppCompat.Medium" /&gt;

    &lt;EditText
        android:id="@+id/editTextPhoneNo"
        android:layout_width="337dp"
        android:layout_height="wrap_content"

        android:layout_gravity="right"
        android:layout_marginTop="0dp"
        android:phoneNumber="true"&gt;&lt;/EditText&gt;

    &lt;TextView
        android:id="@+id/textViewSMS"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_marginTop="45dp"
        android:text="Pesan : "
        android:textAppearance="@style/TextAppearance.AppCompat.Medium" /&gt;

    &lt;EditText
        android:id="@+id/editTextSMS"
        android:layout_width="fill_parent"
        android:layout_height="120dp"
        android:gravity="top"
        android:inputType="textMultiLine"
        android:lines="5"
        android:layout_marginTop="70dp"
         /&gt;

    &lt;Button
        android:id="@+id/buttonSend"
        android:layout_width="180dp"
        android:layout_height="wrap_content"

        android:layout_gravity="center_horizontal"
        android:layout_marginTop="190dp"

        android:text="Send" /&gt;


&lt;/FrameLayout&gt;

</code></pre>
