LogCat?
On Wed, Aug 17, 2011 at 2:40 AM, masterodst <[email protected]> wrote:
> I've been working on figuring out how to get my onListItemClick to
> work. Here is my code.
>
> package com.at.masterodst.list;
>
> import java.util.ArrayList;
>
> import android.app.ListActivity;
> import android.content.Intent;
> import android.os.Bundle;
> import android.view.View;
> import android.widget.ListView;
>
> import com.at.masterodst.list.item.EntryAdapter;
> import com.at.masterodst.list.item.EntryItem;
> import com.at.masterodst.list.item.Item;
> import com.at.masterodst.list.item.SectionItem;
>
> public class SectionListExample2Activity extends ListActivity {
> /** Called when the activity is first created. */
>
> ArrayList<Item> items = new ArrayList<Item>();
>
> @Override
> public void onCreate(Bundle savedInstanceState) {
> super.onCreate(savedInstanceState);
>
>
> items.add(new SectionItem("Category 1"));
> items.add(new EntryItem("Item 1", "This is item 1.1"));
> items.add(new EntryItem("Item 2", "This is item 1.2"));
> items.add(new EntryItem("Item 3", "This is item 1.3"));
>
>
> items.add(new SectionItem("Category 2"));
> items.add(new EntryItem("Item 4", "This is item 2.1"));
> items.add(new EntryItem("Item 5", "This is item 2.2"));
> items.add(new EntryItem("Item 6", "This is item 2.3"));
> items.add(new EntryItem("Item 7", "This is item 2.4"));
>
> items.add(new SectionItem("Category 3"));
> items.add(new EntryItem("Item 8", "This is item 3.1"));
> items.add(new EntryItem("Item 9", "This is item 3.2"));
> items.add(new EntryItem("Item 10", "This is item 3.3"));
> items.add(new EntryItem("Item 11", "This is item 3.4"));
> items.add(new EntryItem("Item 12", "This is item 3.5"));
>
> EntryAdapter adapter = new EntryAdapter(this, items);
>
> setListAdapter(adapter);
> }
>
> @Override
> protected void onListItemClick(ListView l, View v, int position,
> long id) {
> if(!items.get(position).isSection()){
> EntryItem item = (EntryItem)items.get(position);
> startActivity(new Intent(null, Item12.class));
> }
>
> }
>
> }
>
>
> I click Item12 and it errors out... Any help would be awesome!
> Thanks!
>
> --
> You received this message because you are subscribed to the Google
> Groups "Android Developers" group.
> To post to this group, send email to [email protected]
> To unsubscribe from this group, send email to
> [email protected]
> For more options, visit this group at
> http://groups.google.com/group/android-developers?hl=en
--
--------------------
Raghav Sood
CEO/Founder/Owner/Dictator/Tyrant at Appaholics (Basically all titles
required to have complete control)
http://www.raghavsood.com/
https://market.android.com/developer?pub=Appaholics
http://www.appaholics.in/
--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en