Skip to main content

Android Text Fields

Android Text Fields 


  • Introduction to android text fields in Hindi
  • Creating android text fields in Hindi
  • Input types of android text fields in Hindi
  • Keyboard actions of android text fields in Hindi

Introduction to Android Text Fields 

आप अपनी android application में text fields क्रिएट कर सकते है। Text fields को text boxes भी कहते है। एक text field के द्वारा आप यूज़र से input लेते है। जैसे की यूज़र का नाम और ईमेल एड्रेस। 

ज्यादातर text fields एक ही लाइन के होते है। लेकिन आप चाहे तो android में multiple lines के भी text फ़ील्ड्स क्रिएट कर सकते है। 

Text एंटर करने के लिए यूज़र text field पर क्लिक करते है। यूज़र के क्लिक करने पर typing cursor text field में शो हो जाता है। साथ ही टाइप करने के लिए keyboard भी शो हो जाता है। ये सब automatically होता है।  

आप text fields को अलग अलग तरह की input values के लिए भी configure कर सकते है। जैसे की किसी text box को आप सिर्फ email के लिए configure कर सकते है।  

Android text fields के लिए आप actions भी define कर सकते है। जो यूज़र input करने के बाद perform करता है। 


Creating Android Text Fields 

Text fields आप अपने layout में add कर सकते है। इसके लिए आप XML layout file में <EditText> element define करते है। <EditText> element के basic attributes वही है जो सब view elements define करते है -

android:id - ये attribute text field की id define करता है।  

android:layout_width - ये attribute text field की width define करता है।  

android:layout_height - इस एट्रिब्यूट के द्वारा आप text field की height define करते है।  

android:hint - इस attribute के द्वारा आप input type की hint दे सकते है।  

android:inputType - इस attribute के द्वारा आप input type डिफाइन करते है।  

android:imeOptions - इस attribute के द्वारा आप action define करते है।      


Example 



<EditText 
android:id="id for text field"
android:layout_width="width of text field"
android:layout_height="height of text field"
android:hint="hint of  input type"
android:inputType="input type"
android:imeOptions="action" /> 





Input Types of Android Text Fields 

Text fields में अलग अलग तरह की values डाली जा सकती है। जैसे की text, number, date और email address. एक text field में आप किस तरह की वैल्यू enter कर सकते है ये आप android:inputType attribute के द्वारा डिफाइन करते है।

इस attribute के लिए common input types निचे दिए जा रहे है। ये सभी input types अलग अलग keyboard शो करते है।  

text - ये input type साधारण text enter करने के लिए declare किया जाता है। ये normal text कीबोर्ड शो करता है।   

textEmailAddress - ये input type email address इनपुट करने के लिए यूज़ किया जाता है। इससे normal keyboard शो होता है @ sign के साथ।    

textUri - इस इनपुट टाइप से आप text field में URL enter कर सकते है। ये input type साधारण text keyboard शो करता है / के साथ।    

number - ये input type numbers एंटर करने के लिए यूज़ किया जाता है। और numbers का keyboard शो करता है।   

phone - इस input type को phone style keyboard के लिए यूज़ किया जाता है।  


Example


<EditText 
android:id="id for text field"
android:layout_width="width of text field"
android:layout_height="height of text field"
android:hint="hint of  input type"
android:inputType="textEmailAddress"
android:imeOptions="action" /> 



Keyboard Actions of Android Text Fields

User के information input करने के बाद action लिया जाता है। ये action क्या होता है ये आपकी एप्लीकेशन पर depend करता है। जैसे की यदि आपकी एप्लीकेशन searching की service provide करती है तो action search हो सकता है और यदि आपकी एप्लीकेशन messaging की service provide करती है तो ये action send हो सकता है।

किस तरह का action आप लेना चाहते है ये आपकी application पर निर्भर होता है। यदि आप कोई action डिफाइन नहीं करते है तो next का option निचे right hand side corner में शो होता है। नहीं तो जो action आप डिफाइन करते है वो शो होता है।

Keyboard action आप android:imeOptions attribute के द्वारा डिफाइन कर सकते है।

Example


<EditText 
android:id="id for text field"
android:layout_width="width of text field"
android:layout_height="height of text field"
android:hint="hint of  input type"
android:inputType="textEmailAddress"
android:imeOptions="actionSend" /> 

Comments

Popular posts from this blog

Android Services

Android Services Introduction to  android services in Hindi  Declaring  services in Hindi Creating a  android service in Hindi Introduction to Android Services इससे पहले की आप जाने की service क्या होती है आइये जानते है की service क्या नहीं होती है - एक service separate प्रोसेस नहीं होती है। ये आपकी एप्लीकेशन का ही पार्ट होती है।  एक service thread नहीं होती है।  आइये अब देखते है service क्या होती है - Service एक facility होती है जिससे आप android system को बता सकते है की आप कोई काम background में करते रहना चाहते है।  Service एक facility होती है जिससे एक एप्लीकेशन अपनी कुछ functionality दूसरी applications को expose कर सकती है।    हर service क्लास का <service> declaration AndroidManifest.xml file में होना चाहिए। Services को आप context.startService() और context.bindService() मेथड्स से स्टार्ट कर सकते है।            जब service component क्रिएट होता है तो android syst...

Android Fragments

Android Fragments Introduction to android fragments in Hindi Android fragments life cycle in Hindi Types of android fragments in Hindi Creating android fragment in Hindi Introduction to Android Fragments एक fragment किसी activity के अंदर एक separate UI (user interface) होता है। Fragments की खुद की life cycle और input events होते है। आप एक fragment को कई activities में use कर सकते है। जब आपकी activity running state में हो तब भी आप fragments को add और remove कर सकते है। Fragments को आप sub activity भी कह सकते है।   Android fragments को android के Honeycomb version में introduce किया गया था।  Android fragments से पहले आप user को एक बार में एक activity ही show कर सकते थे इसलिए आप स्क्रीन को अलग अलग parts में divide नहीं कर सकते थे। Fragments के आने से application design और भी ज्यादा flexible हो गयी क्योंकि आप यूजर को एक साथ एक से ज्यादा interface शो कर सकते है और उन्हें separately manage भी कर सकते है। अब आपके पास activity तो एक ही रहेगी लेकिन आप इसमें ब...

Android Development Tools

Android Development Tools  Android SDK in Hindi  Android Debug bridge in Hindi Android gradle in Hindi Android studio in Hindi Android run time and delvik in Hindi  Android SDK  Android SDK (Software Development Kit) -  Android SDK  में वो सभी टूल्स होते है जिनकी आपको एंड्राइड एप्लीकेशन क्रिएट करने में, कम्पाइल करने में और एप्लीकेशन को पैकेज करने के लिए जरुरत पड़ेगी।  Android SDK में आपको सोर्स कोड के साथ सैंपल प्रोजेक्ट्स, डेवलपमेंट टूल्स, एक इमुलेटर और एप्लीकेशन डेवेलप करने के लिए रिक्वायर्ड लाइब्रेरीज मिलती है। सभी एप्लीकेशन java में डेवेलप की जाती है और डेलविक वर्चुअल मशीन पर रन की जाती है। Android debug bridge  ADB  (Android Debug Bridge  ) - ADB android SDK का एक कमांड लाइन  टूल है जिसकी मदद से आप अपनी एप्लीकेशन को वर्चुअल डिवाइस या किसी रियल डिवाइस पर रन करवा सकते है और डिबग कर सकते है। ये एक क्लाइंट सर्वर प्रोग्राम होता है जिसमे एक क्लाइंट होता है, एक सर्वर...