<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Ali Khan on Medium]]></title>
        <description><![CDATA[Stories by Ali Khan on Medium]]></description>
        <link>https://medium.com/@alikhane?source=rss-a7174e354935------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*F5aqweUKlWlziqmY.jpeg</url>
            <title>Stories by Ali Khan on Medium</title>
            <link>https://medium.com/@alikhane?source=rss-a7174e354935------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Tue, 01 Dec 2026 22:36:15 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@alikhane/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Spannable In Android]]></title>
            <link>https://medium.com/@alikhane/spannable-in-android-eee86b5742c4?source=rss-a7174e354935------2</link>
            <guid isPermaLink="false">https://medium.com/p/eee86b5742c4</guid>
            <category><![CDATA[android]]></category>
            <dc:creator><![CDATA[Ali Khan]]></dc:creator>
            <pubDate>Sat, 19 Aug 2017 09:11:58 GMT</pubDate>
            <atom:updated>2017-08-21T05:51:38.965Z</atom:updated>
            <content:encoded><![CDATA[<p>Spannable is the interface for text to which markup objects can be attached and detached.</p><pre>//set content in spannable<br>int flag = Spannable.<em>SPAN_EXCLUSIVE_EXCLUSIVE</em>;<br>SpannableStringBuilder ssb = new SpannableStringBuilder ();<br>ssb.append(&quot;content&quot;)</pre><p>To make the content bold</p><pre>ssb.setSpan (new StyleSpan (Typeface.<em>BOLD</em>), 0, 6, flag);</pre><p>To make the content italic</p><pre>ssb.setSpan (new StyleSpan (Typeface.ITALIC), 0, 6, flag);</pre><p>To make the content underline</p><pre>ssb.setSpan (new UnderlineSpan (), 0, 6, flag);</pre><p>To make the content strike</p><pre>ssb.setSpan (new StrikethroughSpan (), 0, 6, flag);</pre><p>To change background color of the text</p><pre>ssb.setSpan (new BackgroundColorSpan (Color.<em>YELLOW</em>), 6, flag);</pre><p>To make the content in bullet</p><pre>ssb.setSpan (new BulletSpan (20), 0, 6, flag);</pre><p>To set the text color</p><pre>ssb.setSpan (new TextAppearanceSpan(<em>getContext</em>(),R.style.<em>LinkColor</em>), 0, 6, flag);</pre><p>Clickable span</p><pre>ClickableSpan url = new ClickableSpan () {<br>    @Override<br>    public void onClick(View widget)<br>    {<br>        //open new activity based on use case<br>    }<br>    @Override<br>    public void updateDrawState(TextPaint textPaint) {textPaint.setColor(ContextCompat.<em>getColor</em>(ApplicationContext.<em>getContext </em>(), R.color.<em>appbar</em>));}<br>};<br>ssb.setSpan (url, 0, 6, flag);</pre><pre>//to enable activity open<br>textView.setMovementMethod (LinkMovementMethod.<em>getInstance </em>());</pre><p>Load image in Image Span</p><pre>//using levelListDrawable for first show loading image, after image loaded show the actual image<br>LevelListDrawable levelListDrawable = new LevelListDrawable ();<br>levelListDrawable.addLevel (0, 0, ContextCompat.<em>getDrawable</em>(context, R.drawable.<em>embed_img</em>));</pre><pre>ssb.setSpan (new ImageSpan (levelListDrawable, ImageSpan.<em>ALIGN_BOTTOM</em>), 0, 6, flag);</pre><pre>//load image in async task and then set to levelListDrawable</pre><pre>levelListDrawable.addLevel (1, 1, no);<br>levelListDrawable.setLevel(1);<br>textView.setText(textView.getText ());</pre><p>Set content in text view</p><pre>textView.setText (ssb, TextView.BufferType.<em>SPANNABLE</em>);</pre><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=eee86b5742c4" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Hybrid Android app using Webview]]></title>
            <link>https://medium.com/@alikhane/hybrid-android-app-7193bfc0b0e?source=rss-a7174e354935------2</link>
            <guid isPermaLink="false">https://medium.com/p/7193bfc0b0e</guid>
            <category><![CDATA[android]]></category>
            <dc:creator><![CDATA[Ali Khan]]></dc:creator>
            <pubDate>Sat, 24 Jun 2017 11:05:52 GMT</pubDate>
            <atom:updated>2017-06-24T13:46:32.423Z</atom:updated>
            <content:encoded><![CDATA[<p>We can easily support hybrid app.</p><p>Load url in web view, I have used <a href="https://google.com/">https://google.com</a></p><pre>w.loadUrl (&quot;https://google.com&quot;);</pre><p>We have set WebChromeClient for open in webview, else it will be opened in some browser.</p><pre>w.setWebChromeClient (new WebChromeClient ());</pre><p>You have enable javascript to render ui and js functionality work</p><pre>w.getSettings ().setJavaScriptEnabled (true);</pre><p>Actual code to open in web view:</p><pre>public class MainActivity extends Activity  <br>{<br>   WebView w;<br>   @Override<br>   protected void onCreate(Bundle savedInstanceState)<br>   {<br>      super.onCreate (savedInstanceState);<br>      setContentView (R.layout.<em>activity_main</em>);<br>      w = (WebView)findViewById (R.id.<em>web_cont</em>);<br>      w.setWebViewClient(new WebViewClient ());<br>      //set url to loaded in web view<br>      w.loadUrl (&quot;https://google.com&quot;);<br>      //set Web chrome client to open in webview browser. else it will be opened in browser </pre><pre>      w.setWebChromeClient (new WebChromeClient ());<br>      w.getSettings ().setJavaScriptEnabled (true);<br>      w.setWebChromeClient (new WebChromeClient ()<br>      {<br>         @Override<br>         public boolean onJsAlert(WebView view, String url, String message, JsResult result) {<br>            return super.onJsAlert (view, url, message, result);<br>         }<br>      });<br>   }<br>   @Override<br>   public void onBackPressed()<br>   {<br>      if(w.canGoBack ())<br>      {<br>         w.goBack ();<br>      }<br>      else<br>      {<br>         super.onBackPressed ();<br>      }<br>   }<br>}</pre><p>In <em>activity_main, it contains only webview</em></p><pre>&lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt;<br>&lt;WebView<br>    android:layout_height=&quot;match_parent&quot;<br>    android:layout_width=&quot;match_parent&quot;<br>    android:id=&quot;@+id/web_cont&quot;<br>    xmlns:android=&quot;http://schemas.android.com/apk/res/android&quot;/&gt;</pre><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=7193bfc0b0e" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[To display image horizontally centred in textview]]></title>
            <link>https://medium.com/@alikhane/to-display-image-horizontally-centred-in-textview-59d11daae4e7?source=rss-a7174e354935------2</link>
            <guid isPermaLink="false">https://medium.com/p/59d11daae4e7</guid>
            <category><![CDATA[android]]></category>
            <dc:creator><![CDATA[Ali Khan]]></dc:creator>
            <pubDate>Tue, 06 Jun 2017 05:12:39 GMT</pubDate>
            <atom:updated>2017-06-06T05:12:39.449Z</atom:updated>
            <content:encoded><![CDATA[<pre>//init SpannableStringBuilder<br>final SpannableStringBuilder ssb = new SpannableStringBuilder (&quot;a img b&quot;);</pre><pre>final LevelListDrawable levelListDrawable = new LevelListDrawable ();<br>//loading existing image in levelListDrawable<br>levelListDrawable.addLevel (0, 0, ContextCompat.<em>getDrawable</em>(activity.getBaseContext (), R.drawable.<em>img_to_display</em>));</pre><pre>//set left position<br>//Get display(screen) width in pixel from DisplayMetrics<br>DisplayMetrics d = activity.getResources ().getDisplayMetrics ();<br>int imgWidth = 400;<br>int height =100;<br>int left = (d.widthPixels - imgWidth)/2;<br>levelListDrawable.setBounds (left,0,imgWidth+left,height);</pre><pre>final ImageSpan iss = new ImageSpan (levelListDrawable, ImageSpan.<em>ALIGN_BOTTOM</em>);<br>ssb.setSpan (iss, 2, 5, flag);</pre><pre>//set data in textview<br>textView.setText (ssb, TextView.BufferType.<em>SPANNABLE</em>);<br></pre><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=59d11daae4e7" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Android Drawables]]></title>
            <link>https://medium.com/@alikhane/android-drawables-fb63b5440dab?source=rss-a7174e354935------2</link>
            <guid isPermaLink="false">https://medium.com/p/fb63b5440dab</guid>
            <category><![CDATA[android]]></category>
            <dc:creator><![CDATA[Ali Khan]]></dc:creator>
            <pubDate>Thu, 01 Jun 2017 03:21:17 GMT</pubDate>
            <atom:updated>2017-06-01T03:21:17.471Z</atom:updated>
            <content:encoded><![CDATA[<p>1) AnimationDrawable: — An object used to create frame-by-frame animations, defined by a series of Drawable objects, which can be used as a View object’s background.</p><p>2) BitmapDrawable: — A Drawable that wraps a bitmap and can be tiled, stretched, or aligned.</p><p>3) ClipDrawable:- A Drawable that clips another Drawable based on this Drawable’s current level value.</p><p>4) ColorDrawable:-A specialized Drawable that fills the Canvas with a specified color.</p><p>5) Drawable: — A Drawable is a general abstraction for “something that can be drawn.” Most often you will deal with Drawable as the type of resource retrieved for drawing things to the screen; the Drawable class provides a generic API for dealing with an underlying visual resource that may take a variety of forms.</p><p>6) Drawable.ConstantState:- This abstract class is used by Drawables to store shared constant state and data between Drawables.</p><p>7) DrawableContainer: — A helper class that contains several Drawables and selects which one to use.</p><p>8) DrawableContainer.DrawableContainerState:- A ConstantState that can contain several Drawables.</p><p>9) GradientDrawable: — A Drawable with a color gradient for buttons, backgrounds, etc.</p><p>10) InsetDrawable: — A Drawable that insets another Drawable by a specified distance.</p><p>11) LayerDrawable: — A Drawable that manages an array of other Drawables.</p><p>12) LevelListDrawable: — A resource that manages a number of alternate Drawables, each assigned a maximum numerical value.</p><p>13) NinePatchDrawable: — A resizable bitmap, with stretchable areas that you define.</p><p>14) PaintDrawable: — Drawable that draws its bounds in the given paint, with optional rounded corners.</p><p>15) PictureDrawable: — Drawable subclass that wraps a Picture, allowing the picture to be used wherever a Drawable is supported.</p><p>16) RotateDrawables: — A Drawable that can rotate another Drawable based on the current level value.</p><p>17) ScaleDrawable: — A Drawable that changes the size of another Drawable based on its current level value.</p><p>18) ShapeDrawable: — A Drawable object that draws primitive shapes.</p><p>19) ShapeDrawable.ShaderFactory:- Base class defines a factory object that is called each time the drawable is resized (has a new width or height).</p><p>20) StateListDrawable: — Lets you assign a number of graphic images to a single Drawable and swap out the visible item by a string ID value.</p><p>21) TransitionDrawable: — An extension of LayerDrawables that is intended to cross-fade between the first and second layer.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=fb63b5440dab" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Debugging WebView in Android]]></title>
            <link>https://medium.com/@alikhane/debugging-webview-in-android-2865cd724789?source=rss-a7174e354935------2</link>
            <guid isPermaLink="false">https://medium.com/p/2865cd724789</guid>
            <category><![CDATA[android]]></category>
            <dc:creator><![CDATA[Ali Khan]]></dc:creator>
            <pubDate>Thu, 01 Jun 2017 01:50:32 GMT</pubDate>
            <atom:updated>2017-06-01T01:50:32.139Z</atom:updated>
            <content:encoded><![CDATA[<pre>Webview w = (WebView) findViewById (R.id.editor);<br>w.loadUrl(&#39;http://example.com&#39;);<br><br>//To debug html from browser<br>webview.setWebContentsDebuggingEnabled (true);<br><br>//Enable javascript<br>w.getSettings().setJavaScriptEnabled(true);<br><br>open this url in browser <br><a href="https://inspect/#devices"><strong>chrome://inspect/#devices</strong></a></pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/944/1*IOQG5TWzHNOIPzAmlQ-58w.png" /></figure><pre>click on the <strong>inspect</strong> link. It will be opened in new tab.</pre><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=2865cd724789" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Frequently using Jquery Methods to get Element(s)]]></title>
            <link>https://medium.com/@alikhane/frequently-using-jquery-methods-to-get-element-s-3fddab0fd873?source=rss-a7174e354935------2</link>
            <guid isPermaLink="false">https://medium.com/p/3fddab0fd873</guid>
            <category><![CDATA[jquery]]></category>
            <dc:creator><![CDATA[Ali Khan]]></dc:creator>
            <pubDate>Fri, 27 Nov 2015 10:27:42 GMT</pubDate>
            <atom:updated>2015-12-01T02:57:55.133Z</atom:updated>
            <cc:license>http://creativecommons.org/publicdomain/zero/1.0/</cc:license>
            <content:encoded><![CDATA[<p>Frequently using Jquery Methods to get Element(s)</p><p>.parent()</p><p>To get the parent of each element in matched elements</p><p>.parents()</p><p>To get the ancestors of each element in matched elements</p><p>.closest()</p><p>To get the first element that matches the selector of a element</p><p>.find()</p><p>To get the descendants of each element in the current set of matched elements</p><p>.children()</p><p>To get the children of each element of matched elements</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=3fddab0fd873" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>