title: How to use fonts on TextView from URL (website) - in android?
body: <p>Hi i am trying to build app where some fonts are loaded from <strong>URL</strong> and then apply on <strong><code>TextView</code></strong> but it's don't work.</p>
  
  <p><strong>Here my simple code</strong> </p>
  
  <p>in oncreate()</p>
  
  <pre><code>try {
       if (new File("/sdcard/a/" + MainActivity.pos + ".ttf").exists()){
          mTypeface = Typeface.createFromFile("/sdcard/a/" + MainActivity.pos
           + ".ttf");
           tv.setTypeface(mTypeface);
       } else {
           new DisplayImageFromURL().execute(MainActivity.URL);
       }
  } catch (Exception e) {
  
  }
  </code></pre>
  
  <p>Downloading and show font style on TextView</p>
  
  <pre><code>private class DisplayImageFromURL extends AsyncTask&lt;String, Void, Typeface&gt; {
                  ProgressDialog pd=null;
          @Override
          protected void onPreExecute() {
              super.onPreExecute();
              pd = new ProgressDialog(Working_Class.this);
              pd.setMessage("Downoading file...");
              pd.show();
          }
  
          protected Typeface doInBackground(String... urls) {
              String urldisplay = urls[0];
              Typeface mIcon11 = null;
              try {
                  mIcon11=Typeface.createFromFile(urldisplay);//this line not working properly....
  
              } catch (Exception e) {
                  Log.e("Error", e.getMessage());
                  e.printStackTrace();
              }
              return mIcon11;
          }
  
          protected void onPostExecute(Typeface result) {
              mTextView.setTypeface(result);
              pd.dismiss();
          }
      }
  </code></pre>
  
  <p><strong>and i want to like this</strong></p>
  
  <p><a href="https://i.stack.imgur.com/NMSrt.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/NMSrt.jpg" alt="enter image description here"></a> 
  <a href="https://i.stack.imgur.com/2a0WM.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/2a0WM.jpg" alt="enter image description here"></a></p>