You cannot get the font family name programmatically if it's defined in XML because when defined in XML it's mapped in compile time to the associated native font family and cannot be retracted, without some ugly reflection (I'll try to find a source for the above claim for a complete answer, the documentation for Typeface seems to be limited).
As mentioned in comments by @Ashwini you can always use a custom font under the assets folder and be able to see it in both the XML file and .java.
Alternatively, if you want to use a native font family you can do something simpler and a bit inelegant; use the android:tag field of TextView to store the font family name:
In XML:
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Hello World!"
android:id='@+id/textView'
android:textSize="30sp"
android:textStyle="bold"
android:fontFamily="@string/myFontFamily"
android:tag="@string/myFontFamily"
/>
In res/values/strings.xml:
<resources>
...
<string name="myFontFamily">sans-serif-thin</string>
...
</resources>
Then you can access the font family name through the android:tag field:
TextView textView = (TextView) findViewById(R.id.textView);
String fontFamily = String.valueOf(textView.getTag());
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…