Multiple Layouts in a ListView

by Loki117 » Fri, 06 Nov 2009 06:01:58 GMT


Sponsored Links
 Hey Guys,

I am looking for some help around ListViews. I would like to use a
ListView to hold a number of rows of data however in between some of
these rows of data may appear a header indicating a new section of
data types. Can someone tell me have they implemented a ListView that
uses multiple layout types and if so how do you determine which layout
type is being passed back in the convertView in order to make sure you
do not try to recast it to the wrong type.

Tom

--



Multiple Layouts in a ListView

by Mark Murphy » Fri, 06 Nov 2009 06:10:55 GMT


 > I am looking for some help around ListViews. I would like to use a

You can use:

* Jeff Sharkey's original SeparatedListAdapter (GPL)
[ http://jsharkey.org/blog/2008/08/18/separating-lists-with-headers-in-android-09/ ]

* My updated rendition (GPL)
[ http://github.com/commonsguy/cw-advandroid/tree/master/ListView/Sections/ ]

* My MergeAdapter, which can be used for this scenario as well (Apache)
[ http://github.com/commonsguy/cwac-merge ]

Here is a StackOverflow discussion of the techniques for doing it yourself:

 http://stackoverflow.com/questions/1660417/android-efficientadapter-with-two-different-views 

-- 
Mark Murphy (a Commons Guy)
 http://commonsware.com 
Android App Developer Books:  http://commonsware.com/books.html 


--


Sponsored Links


Multiple Layouts in a ListView

by Loki117 » Fri, 06 Nov 2009 06:45:10 GMT


 Great thanks the StackOverflow thread done the trick I did not know
about those overrides.




--



Other Threads

1. cupcake how to support multi-touch and linux kernel version?

Hi, the multitouch APIs were added in 2.0 so you can not officially support
them prior to that.  You could of course hack the system to do something,
but third party apps will not be able to use whatever you do.




> website: 

2. Android SDK and AVD Manager Crash

I got this crash after downloading all the packages, then clicking on
"Available Packages"  then clicking on the checkbox in the right hand
pane

Exception occurred
java.lang.NullPointerException
        at
com.android.sdklib.internal.repository.LocalSdkParser.scanTools
(LocalSdkParser.java:173)
        at
com.android.sdklib.internal.repository.LocalSdkParser.parseSdk
(LocalSdkParser.java:88)
        at
com.android.sdkuilib.internal.repository.UpdaterData.getInstalledPackage
(UpdaterData.java:241)
        at
com.android.sdkuilib.internal.repository.RepoSourcesAdapter.filteredPackages
(RepoSourcesAdapter.java:281)
        at
com.android.sdkuilib.internal.repository.RepoSourcesAdapter.access$300
(RepoSourcesAdapter.java:42)
        at com.android.sdkuilib.internal.repository.RepoSourcesAdapter
$TreeContentProvider.getRepoSourceChildrenRepoSourcesAdapter.java:205)
        at com.android.sdkuilib.internal.repository.RepoSourcesAdapter
$TreeContentProvider.getChildren(RepoSourcesAdapter.java:172)
        at
com.android.sdkuilib.internal.repository.RemotePackagesPage.onTreeCheckStateChanged
(RemotePackagesPage.java:265)
        at
com.android.sdkuilib.internal.repository.RemotePackagesPage.access$000
(RemotePackagesPage.java:54)
        at com.android.sdkuilib.internal.repository.RemotePackagesPage
$1.checkStateChanged(RemotePackagesPage.java:91)
        at org.eclipse.jface.viewers.CheckboxTreeViewer$1.run
(CheckboxTreeViewer.java:134)
        at org.eclipse.jface.util.SafeRunnable$1.run(SafeRunnable.java:
128)
        at org.eclipse.jface.util.SafeRunnable.run(SafeRunnable.java:
175)
        at
org.eclipse.jface.viewers.CheckboxTreeViewer.fireCheckStateChanged
(CheckboxTreeViewer.java:132)
        at org.eclipse.jface.viewers.CheckboxTreeViewer.handleSelect
(CheckboxTreeViewer.java:268)
        at org.eclipse.jface.viewers.StructuredViewer$4.widgetSelected
(StructuredViewer.java:1168)
        at org.eclipse.jface.util.OpenStrategy.fireSelectionEvent
(OpenStrategy.java:227)
        at org.eclipse.jface.util.OpenStrategy.access$3
(OpenStrategy.java:221)
        at org.eclipse.jface.util.OpenStrategy$1.handleEvent
(OpenStrategy.java:388)
        at org.eclipse.swt.widgets.EventTable.sendEvent(Unknown
Source)
        at org.eclipse.swt.widgets.Widget.sendEvent(Unknown Source)
        at org.eclipse.swt.widgets.Display.runDeferredEvents(Unknown
Source)
        at org.eclipse.swt.widgets.Display.readAndDispatch(Unknown
Source)
        at
com.android.sdkuilib.internal.repository.UpdaterWindowImpl.open
(UpdaterWindowImpl.java:104)
        at com.android.sdkuilib.repository.UpdaterWindow.open
(UpdaterWindow.java:110)
        at com.android.sdkmanager.Main.showMainWindow(Main.java:281)
        at com.android.sdkmanager.Main.doAction(Main.java:251)
        at com.android.sdkmanager.Main.run(Main.java:92)
        at com.android.sdkmanager.Main.main(Main.java:81)
The system cannot find the path specified.

-- 

3. ROM Baru Cyan 4.2.7

4. How to handle person extensions in Android 2.0

5. layout and activity doubt

6. How to layout 3 ImageButton evenly distributed on a row

7. How to move a image in timer?...