Note that there are some explanatory texts on larger screens.

plurals
  1. POThe variable from if statment doesn't work
    primarykey
    data
    text
    <p>I have a spinner. Now I want to compare the variable from the spinner in a if statement. And than I want to change a variable, but I can't get the variable changed. Here is the code from my spinner:</p> <pre><code>&lt;resources&gt; &lt;string name="app_name"&gt;Groep kiezer&lt;/string&gt; &lt;string name="Mijngroep"&gt;Selecteer jouw groep&lt;/string&gt; &lt;string name="groep1"&gt;Admiraal kruysgroep&lt;/string&gt; &lt;string name="groep2"&gt;Admiraal van Kinsbergen&lt;/string&gt; &lt;string name="groep3"&gt;Alexandergroep&lt;/string&gt; &lt;string name="groep4"&gt;Anthonie van diemenstam&lt;/string&gt; &lt;/resources&gt; </code></pre> <p>And here is the file (a simple rss reader) in witch it's compared:</p> <pre><code>public class RSSReaderscoutingnl extends Activity implements OnItemClickListener{ public final String tag = "RSSReaderscoutingnl"; private RSSFeed feed = null; private String RSSFEEDOFCHOICE; /** Called when the activity is first created. */ public void onCreate(Bundle icicle) { super.onCreate(icicle); setContentView(R.layout.main); final Spinner feedbackSpinner = (Spinner) findViewById(R.id.SpinnerFeedbackType); final String groep = feedbackSpinner.getSelectedItem().toString(); if (groep.equals("groep1")) { RSSFEEDOFCHOICE = "http://www.scout.org/rss/feed/all"; } else if (groep.equals("groep2")) { RSSFEEDOFCHOICE = "http://www.scout.org/rss/feed/all"; } else if (groep.equals("groep3")) { RSSFEEDOFCHOICE = "http://www.scout.org/rss/feed/all"; } else if (groep.equals("groep4")) { RSSFEEDOFCHOICE = "http://www.scout.org/rss/feed/all"; } // get rss feed! feed = getFeed(RSSFEEDOFCHOICE); UpdateDisplay(); } private RSSFeed getFeed(String urlToRssFeed) { try { // setup the url URL url = new URL(urlToRssFeed); // create the factory SAXParserFactory factory = SAXParserFactory.newInstance(); // create a parser SAXParser parser = factory.newSAXParser(); // create the reader (scanner) XMLReader xmlreader = parser.getXMLReader(); // instantiate our handler RSSHandler theRssHandler = new RSSHandler(); // assign our handler xmlreader.setContentHandler(theRssHandler); // get our data via the url class InputSource is = new InputSource(url.openStream()); // perform the synchronous parse xmlreader.parse(is); // get the results - should be a fully populated RSSFeed instance, or null on error return theRssHandler.getFeed(); } catch (Exception ee) { // if we have a problem, simply return null return null; } } private void UpdateDisplay() { TextView feedtitle = (TextView) findViewById(R.id.feedtitle); TextView feedpubdate = (TextView) findViewById(R.id.feedpubdate); ListView itemlist = (ListView) findViewById(R.id.itemlist); if (feed == null) { feedtitle.setText("No RSS Feed Available"); return; } feedtitle.setText(feed.getTitle()); feedpubdate.setText(feed.getPubDate()); ArrayAdapter&lt;RSSItem&gt; adapter = new ArrayAdapter&lt;RSSItem&gt; (this,android.R.layout.simple_list_item_1,feed.getAllItems()); itemlist.setAdapter(adapter); itemlist.setOnItemClickListener(this); itemlist.setSelection(0); } public void onItemClick(AdapterView parent, View v, int position, long id) { Log.i(tag,"item clicked! [" + feed.getItem(position).getTitle() + "]"); Intent itemintent = new Intent(this,ShowDescription.class); Bundle b = new Bundle(); b.putString("title", feed.getItem(position).getTitle()); b.putString("description", feed.getItem(position).getDescription()); b.putString("link", feed.getItem(position).getLink()); b.putString("pubdate", feed.getItem(position).getPubDate()); itemintent.putExtra("android.intent.extra.INTENT", b); startActivityForResult(itemintent,0); } } </code></pre> <p>I just can't get it to change RSSFEEDOFCHOICE. I hope someone can help me out.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload