Note that there are some explanatory texts on larger screens.

plurals
  1. POAndroid: Can i put some image (Logo etc.) in <item></item> tag together with title
    primarykey
    data
    text
    <p>I have xml layout in values/menu_items.xml for menu items:</p> <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt; </code></pre> <p></p> <pre><code>&lt;string-array name="menu_items"&gt; &lt;item &gt;&lt;/item&gt; &lt;item &gt;&lt;/item&gt; &lt;item &gt;&lt;/item&gt; &lt;item &gt;&lt;/item&gt; &lt;/string-array&gt; </code></pre> <p></p> <p>I populate these items from my database with following code from MainActivity.java class:</p> <pre><code>protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); mLayout = (MainLayout) this.getLayoutInflater().inflate( R.layout.activity_main, null); setContentView(mLayout); //opens database datasource = new CommentsDataSource(this); datasource.open(); //menu_items list lvMenuItems = getResources().getStringArray(R.array.menu_items); ArrayList&lt;Category&gt; meniVrednosti; meniVrednosti = new ArrayList&lt;Category&gt;(); //returns number of requested elements: int i= datasource.vratiBrojElemenataSaZadatimId(0); //for loop to populate menu_items.xml between tags &lt;item&gt;&lt;/item&gt;: for(int j=0;j&lt;i;j++) { lvMenuItems[j] = (datasource.getCategoryViaParentIDandID(0, 10+j).toString()).replaceAll("\\[", "").replaceAll("\\]",""); } ... </code></pre> <p><strong>So, my question is</strong> <em><strong>how i can put images</em></strong> (picture, logo etc..) <strong><em>together with that names</em></strong> from <strong>database</strong>. For <strong>Example</strong>:</p> <ul> <li>(This is where picture goes) (this is MenuItemNO1, text between tags are from database)</li> <li>(This is where picture goes) MenuItemNO2</li> <li>(This is where picture goes) MenuItemNO3</li> </ul> <p>I tried so many ways to do it, but i couldn't. Nothing worked for me far by now. I hope so that you can help me. Tell me if u need more info. Thanks in advance. Regards.</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.
    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