TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Chevy Mark Sunderland
NA
188
166.8k
Android ListViews with Dynamic Data
Apr 11 2014 12:36 PM
I tried loading dynamic data for the ListView in android application.
I don't have error, but the ListView is empty.
If try the same class java with static values the ListView worked.
The input of dynamic data is this string :
Title of article<br />Autor of article
repeated for each item in the database, for example:
Academic writing and publishing<br />Hartley, J.<br /><br />
A practical guidebook<br />Hays, J. C.<br /><br />
JEPS<br />Jamali, H. R.<br /><br />
...
...
Static values
public static final String[] titles = new String[] { "Strawberry",
"Banana", "Orange", "Mixed" };
public static final String[] descriptions = new String[] {
"It is an aggregate accessory fruit",
"It is the largest herbaceous flowering plant", "Citrus Fruit",
"Mixed Fruits" };
public static final Integer[] images = { R.drawable.image1,
R.drawable.image2, R.drawable.image3, R.drawable.image4 };
Dynamic values
try {
httpTransport.call(SOAP_ACTION, envelope);
SoapPrimitive response = (SoapPrimitive) envelope.getResponse();
String myString = response.toString();
String myStringnew = myString.replaceAll("<br />", "\n");
String[] myStrings = myStringnew.split("\n");
final String[] titles = new String[] { myStrings[0].toString() };
final String[] descriptions = new String[] { myStrings[1].toString() };
final Integer[] images = { R.drawable.image1, R.drawable.image2,
R.drawable.image3, R.drawable.image4 };
rowItems = new ArrayList<RowItem>();
for (int i = 0; i < titles.length; i++) {
RowItem item = new RowItem(images[i], titles[i],
descriptions[i]);
rowItems.add(item);
}
listView = (ListView) findViewById(R.id.list);
CustomListViewAdapter adapter = new CustomListViewAdapter(this,
R.layout.list_item, rowItems);
listView.setAdapter(adapter);
listView.setOnItemClickListener(this);
} catch (Exception exception) {
}
Reply
Answers (
0
)
Connect sql server database in android in c#
Scroll multiple image simultaneously.