Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6845507
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T00:30:32+00:00 2026-05-27T00:30:32+00:00

I am developing one Android application having the list view of items. Those listview

  • 0

I am developing one Android application having the list view of items. Those listview records are queried form the sqlite database. Here is the code of list view implementation:

       DataBaseHelper myDbHelper = new DataBaseHelper(null);
        myDbHelper = new DataBaseHelper(this);
        private static final String fields[] = {"c"}; 
        int[] names = new int[] {R.id.name};
          client1 = (ListView)findViewById(R.id.list1 );

   String sql = "SELECT sno,a,b,c,d FROM (SELECT com.sno, com.a, com.b com.c,cd.d from table1 mem inner join table2 cd on mem.e=cd.e inner join table3 com on com.b = mem.b where mem.e =14445 AND a is NULL UNION SELECT com.sno, com.a, com.b,com.c,cd.d from table1 mem inner join table3 com on com.b = mem.b inner join table2 cd on mem.e=cd.e where mem.e =14445  AND a is NOT NULL) a group by a,b;";

  Cursor cdata = myDbHelper.getView(sql);

  SimpleCursorAdapter adapter2 = new SimpleCursorAdapter(this,R.layout.list1, cdata, fields,names );
  client1.setAdapter(adapter2); 

where list1.xml is:

            <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" 
 android:orientation="horizontal" 
 android:layout_width="fill_parent" 
 android:layout_height="fill_parent"  
 android:id="@+id/MainLayout"
 android:padding="5px">  
 <TextView 
android:id="@+id/name" 
android:layout_width="fill_parent"  
android:layout_height="wrap_content" 
android:textSize="12sp"
android:textColor="#104082"
android:textStyle="bold"
android:layout_weight="1" 
/>  
</LinearLayout> 

Here my problem is to differentiate the data records having ‘a’=null and ‘a’=notnull from the same list1.xml by changing the text style of the list view items…. Can I differentiate the text style in the sql query by giving any text style attributes in the query?

Please help me with the sample code/links…… Thanks in advance

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T00:30:32+00:00Added an answer on May 27, 2026 at 12:30 am

    You can do this using a CustomAdapter for the ListView . Since the View is created from the custom data object which incudes all the cursor results.
    You can check if a is null and have a different textstyle for the textview

    Check this exercise for a custom adapter

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am developing one android application, having the listview activity. I displayed the activity.
I have been developing Android application which has 3 ListView and one ContextMenu for
I have been developing Android application, and I have one question - ListView uses
I am developing one android application which select wifi access point from list of
I'm developing one android application in which I'm using one customized ListView which extends
i am developing one application with map view i need display the weather depends
I am developing one Android application in three languages named English,Spanish and German.First I
So I am developing one application on Android with multiple features. Now I am
I am developing an Android application using android sdk v 2.1. In one page
I am developing an android application in I have two GeoPoints in Google map.One

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.