The basic process is to create a Custom Adapter which will contain the layout R.layout. List_item.
The basic process is to create a Custom Adapter which will contain the layout R.layout. List_item Thus, you replace this line setListAdapter(new ArrayAdapter(this,android.R.layout. Simple_list_item_1, results)); in your code by setListAdapter(new CustomAdapter(this,R.layout.
List_item, results)); Now you need to create a CustomAdapter which extends ArrayAdapter or BaseAdapter and override the getView method to inflate R.layout. List_item Please refer to this excellent tutorial by Mark Murphy Custom ListView Adapter If you do have any other doubts after trying this, please post it over here.
I revised the code above -PLZ c REVISED in my Q. Thx @chaitanya – camelCaser Apr 26 at 17:08 You may want to pass the Activity rather than use getApplicationContext(), could you do me a favor and just zip your project up and send me a link, I could fix it up and post the answer over here. Also, use LayoutInflater of the Activity instead of the Context – chaitanya Apr 26 at 18:27 Thx @chaitanya here is a link to the zip.
Let me know when you have it so I can delete this comment. Also I only sent the supporting files/structure for this activity. The db is in the assets folder and you will have to manually put it on the emulators sd card under: "extStorageDirectory + "/xxx/xxx/dB/flyDroid.
Db". I had to omit as much data from the project and put some dummy info into the db (This is a Govt project) sorry. Thank-you ahead of time for your help - I have lots to learn... – camelCaser Apr 26 at 19:41.
Everything is fine, just add a class extends from ArrayAdapter and do something like this: public class CustomAdapter extends ArrayAdapter { List Title= new ArrayList(); List Label= new ArrayList(); Context myContext; public CustomAdapter (Context context, int resource, int textviewresourceid, List aTitle, List aLabel) { super(context, resource,textviewresourceid,aType); myContext = context; Title= aTitle; Label= aLabel; } @Override public View getView(int position, View convertView, ViewGroup parent) { View v = convertView; if (v == null) { LayoutInflater vi = (LayoutInflater)myContext. GetSystemService(Context. LAYOUT_INFLATER_SERVICE); v = vi.
Inflate(R.layout. List_view, null); } TextView tv_title = (TextView) v. FindViewById(R.id.
Id_tv_Title); TextView tv_Label= (TextView) v. FindViewById(R.id. Id_tv_Label); if(tv_title!
= null) { tv_title. SetText(Title. Get(position)); } if(tv_Label!
= null) { tv_Label. SetText(Label. Get(position)); } return v; } And then use this adapter like: CustomAdapter adapter = new CustomAdapter(getAppContext(),R.layout.
List_view,Textview Title Id,your lists...); setListAdapter(adapter); Something like this.... Hope it helps...
First I would like to thank-you for you fast response: @Farhan and @chaitanya (Sorry I couldn't get back to this sooner). I followed your recommendation as well as I know how and the activity displays w/o force closing or any DDMS errors but there is no data returned (Blank screen) I am sure I have something wrong so if you can take a look, I'd appreciate it. I made the changes to my Q above.Thnx.
– camelCaser Apr 26 at 15:02 I revised the code above -PLZ c REVISED in my Q. Thx @Farhan – camelCaser Apr 26 at 17:07 one more error: passing of result 3 times in adapter, whereas you are expecting 3 different lists... so why don't you break the results into 3 diff lists and pass it to adapter. – Farhan Apr 26 at 18:40 I need it to display 3 db columns in the same list (not three rows)- using three text views in that list.
I cant figure out how to do this - as per my original question. Thnx – camelCaser Apr 26 at 21:10 you didn't get right. Ok i'll explain again.
First I am guessing that list_view has a linearlayout having 3 textviews... (just make this file exactly what you want in each row of your list. ) and then passing 3 lists and setting those textviews with these lists, you will get 3 coloumns... got my point. – Farhan Apr 267 at 4:28.
I have the correct anwser HERE along with the correct code.
I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.