The default way to print an array is
String [] array;
System.out.println(
For an array of Strings, this will print out
["a","b",...
If thi is unacceptable, it's better to loop through:
for (int i = 0; i < array.length; i++) {
// Do something with array[i]
}
-----Original Message-----
From: soren.j.winslow@
Subj: [Java] Static Array Help in Eclipse/Android
Date: Tue Mar 16, 2010 4:08 pm
Size: 12K
To: Java_Official@
I am just starting to work on building Android apps. I have some basic
knowledge of programming, but have never done any Java based stuff. I
apologize in advance for my questions being remedial. Most of what I do is
web based using ASP (vbscript) or PHP, plus I do some VBA.
I am just trying to figure out how to display a static array.
I have an arrays.xml file:
<?xml version="1.0" encoding="utf-
<resources>
<string-array name="history"
<item>Some text<item>
<item>more text<item>
<item>even more text<item>
</string-array>
</resources>
In my main.xml file I have:
<TextView xmlns:android=
android:text=
android:layout_
I know that I need to decare my array. The code that I found to do this
is:
String[] history = getResources(
What I dont know is where in my main java file I put it. Currently my main
java file (TriumphHistory.
package com.TriumphHistory.
import android.app.
import android.os.Bundle;
public class TriumphHistory extends Activity {
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(
setContentView(
}
}
Thanks for your help,
Soren
[Non-text portions of this message have been removed]
Java Official Group is created for the following topics: Java 2 Enterprise Edition - J2EE, Java 2 Standard Edition - J2SE, Java 2 Micro Edition - J2ME, XML, XSL, XSD, XPATH, Web Services, Jini, JXTA for all type of Java Geeks.
Whoever posts spam / ads / job related message will be BANNED IMMEDIATELY
No comments:
Post a Comment