Posts

Showing posts with the label Android Tutorial

How to calculate total row heights of listView in android?

Developing apps for mobile devices come fun when you get rid of those problems which are not so easy at all. Your apps development are getting stuck but you are passionate guys who love to write code for android devices. Few days ago I got same problem that was so painful to me as well as to my clients. As I am not good writer but share it to you and helping other programmers, I like to solve this issue through hands on code sample. Along this discussion I will help you to calculate total row heights of android listview .  What was my problems:  My problem was to add comments under VideoView where A scrollview has covered videoview and commentsview. Actually commentsview was a listview. I had to calculate the total heights of listview rows.  Mostly it calculated the accurate height of the listview but when comments content is too much then it cannot provide you the actual height.  Way to calculate total row heights of listView in android:  To solve this problem,...

How to show only month and year fields in android Date-picker?

Image
Android default DatePicker show day/month/year fields but you have to customize this DatePicker as your requirements. Suppose that you want to show only month and year fields in android datepicker . To do this, you have to customize the Dialog DatePicker source code but it is not an easy task. In this tutorial I will show you a tricky way to solve this problem. Lets see how to show only month and year field in android DatePicker as a dialog.   Step to show only month and year fields in android date-picker: Some days ago I got this same problem and here I am trying to explain this in a sequential manner. I want to show a dialog datepicker when user click on an EditText. So if user click on EditText, A dialog datepicker will be invocked and it will show only month and year fields. To do this, at first we have to create a xml layout to hold the EditText fields. So create an android project and name it DatePickerExample. In the main.xml file just try to write this simple code....

Supported HTML tag for Android TextView

Android TextView show the text but you can format this text by using HTML tag. Sometime it's necessary to use HTML tag in TextView. Android TextView support some HTML tag. To get you know, here I provide the lists of supported HTML tag for Android TextView. Useful HTML tag for Android TextView:  You can use this tag inside TextView or other android widget like Button as a text.  Before starting your works, you have to look over the supported HTML tag for TextView. Check this list below: <a href="..."> <b> <big> <blockquote> <br> <cite> <dfn> <div align="..."> <em> <font size="..." color="..." face="..."> <h1> <h2> <h3> <h4> <h5> <h6> <i> <img src="..."> <p> <small> <strike> <strong> <sub> <sup> <tt> <u> Now the question is how I can use this tag inside TextView. If you ...

Select only one radion button from listview (Example with source code)

I got this same problem few days ago and I searched it over and over but I did not come out with a perfect solution. And I know that many guys already got this problem. Here is the step by step procedure that will show you how to implement this scenario for android. I think you have basic idea to implement Listview in android. For this project we have to use two xml templates one will hold the listview and another will hold the listview template(where we can put the radio button). We can name one template main_listview.xml and another template item_listview.xml. Lets see how I created this.  First of all create a project and name it RadioListSingle and create two xml layout. One for main_listview.xml and another one for item_listview.xml.  The main_listview.xml: <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"     xmlns:tools="http://schemas.android.com/tools"     android:layout_width="match_parent"     an...