Tuesday, June 19, 2012

Re: [android-developers] Trying to use the ListView

On Tuesday, June 19, 2012 4:43:10 AM UTC+2, TreKing wrote:
You don't know Java or how to use your IDE well enough.

I am not using any Java IDE, I am using a script to compile the project and I don't plan on changing that.

Yes, I am not familiar enough with Java to use those complicated things that Android APIs use. If they just used simple methods it would be so much easier... I could just call them all from JNI in Pascal and never use Java. But Google forces developers to use these complicated APIs...

But I would be thankful if anyone could help me getting working.
 
> You could, at the very least, post the errors you're getting if you want anyone to help you.

But I did ... I posted a link to pastebin with the error because if I just copy the text here it will loose the fixed-width font and it won't show anymore where exactly it is pointing too, but since you ask, I will post the error message in raw text here too:

[loading android\R.class(android:R.class)]
[loading android\R$layout.class(android:R$layout.class)]
[loading android\R$id.class(android:R$id.class)]
src\com\pascal\lcltest\LCLActivity.java:676: cannot find symbol
symbol : constructor SimpleAdapter(com.pascal.lcltest.LCLActivity,java.util.Lis
t<com.pascal.lcltest.LCLActivity.LCL_ListViewItem>,int,java.lang.String[],int[])
location: class android.widget.SimpleAdapter
SimpleAdapter listAdapter = new SimpleAdapter(this,
^
[loading java\lang\CloneNotSupportedException.class(java\lang:CloneNotSupportedException.class)]
[loading java\util\Map$Entry.class(java\util:Map$Entry.class)]
[loading java\util\Set.class(java\util:Set.class)]
src\com\pascal\lcltest\LCLActivity.java:719: cannot find symbol
symbol : constructor SimpleAdapter()
location: class android.widget.SimpleAdapter

Source code:

// This method allows us to use the native Android ListView in a dialog
// It is nice for choosing a line in a table with multiple columns of information
// The extra columns appear as sub-info in the Android ListView
//
// output: Calls LCLOnMessageBoxFinished
public void LCLDoShowListViewDialog(String ATitle, String[] AItems, String[] ASubItems)
{
ListView lListView = new ListView(this);
List<LCL_ListViewItem> listItems = new ArrayList<LCL_ListViewItem>();
for (int i = 0; i < AItems.length; i++)
{
listItems.add(new LCL_ListViewItem(AItems[i], ASubItems[i]));
};
SimpleAdapter listAdapter = new SimpleAdapter(this,
listItems,
android.R.layout.simple_list_item_2,
new String[] { "title", "description" },
new int[] { android.R.id.text1, android.R.id.text2 });
lListView.setAdapter(listAdapter);

Dialog dialog = new Dialog(this);
dialog.setTitle(ATitle);
dialog.setContentView(lListView);
dialog.show();
}

//
// Classes for the ListView
//

//
// ListView item
//
public class LCL_ListViewItem extends HashMap
{
public String Title;
public String Description;

public LCL_ListViewItem(String ATitle, String ADescription)
{
this.Title = ATitle;
this.Description = ADescription;
}

@Override public String get(Object k)
{
String key = (String) k;
if (key.equals("title")) return Title;
else if (key.equals("description")) return Description;
return null;
}
}


thanks,

Felipe

--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate