Why I can't create repeated images and put these into an ImageView of my application?
<p>I am absolutly new in Android development and I have the followind doubt.</p>

<p>I have to draw images one next to each other into a Canvas object.</p>

<p>So let to do an example of what I neeed: </p>

<p>Into the <strong>/res/drawable/</strong> folder of my project I have this icon (I have resized it before put it into my project but I think that this is not so important):</p>

<p><a href="https://i.stack.imgur.com/u4y4k.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/u4y4k.png" alt="enter image description here"></a></p>

<p>So I have to put 3 of these icon one next to each other into a specific <strong>ImageView</strong> of my activity view (adding some white space between an image and the next one).</p>

<p>So I have done something like this:</p>

<p>1) This is the code of my <strong>fragment_screen_slide.xml</strong> file that represent the layout where these images have to be placed:</p>

<pre><code>&lt;LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:orientation="vertical"
    android:padding="0dp"&gt;

    &lt;ImageView
        android:id="@+id/imageView1"
        android:layout_width="fill_parent"
        android:scaleType="fitXY"
        android:layout_height="250dp" /&gt;

    &lt;TextView android:id="@android:id/text1"
        style="@style/pastaTitleTextStyle" /&gt;

    &lt;LinearLayout
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:orientation="horizontal"&gt;

        &lt;LinearLayout
            android:layout_width="0px"
            android:layout_weight="1"
            android:layout_height="wrap_content"
            android:orientation="horizontal"&gt;

            &lt;TextView
                style="@style/HeaderTextStyle"
                android:text="Difficoltà:" /&gt;

            &lt;ImageView
                android:id="@+id/starContainer"
                android:layout_width="fill_parent"
                android:scaleType="fitXY"
                android:layout_height="250dp" /&gt;

        &lt;/LinearLayout&gt;

    &lt;/LinearLayout&gt;

&lt;/LinearLayout&gt;
</code></pre>

<p>In particular these images have to be placed into this <strong>ImageView</strong> contained in the previous code snippet:</p>

<pre><code>&lt;ImageView
    android:id="@+id/starContainer"
    android:layout_width="fill_parent"
    android:scaleType="fitXY"
    android:layout_height="250dp" /&gt;
</code></pre>

<p>Here I have a first doubt because Androi Studio report an error on this line:</p>

<pre><code>android:id="@+id/starContainer"
</code></pre>

<p>The reported error is a red underline on the <strong>@</strong> and when I pass the mouse pointer on it I can read the following error message:</p>

<pre><code>&lt;interface declaration&gt;, &lt;perceable declaration&gt;, AidToken.import or AidTokenTye.package expected, got '@'
</code></pre>

<p>It seems strange to me because I am only creatin an id for the <strong>ImageView</strong> and because I have not problem when Gradle build the project.</p>

<p>Then, into the Java code that actually put the images into the previous <strong>ImageView</strong> I have done something like this:</p>

<pre><code>@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
        Bundle savedInstanceState) {

   System.out.println("PAGE NUMBER: "+ mPageNumber + 1);

   // Create the Canvas where the images are putted:
   Canvas difficultyCanvas = creaImgDifficulty();

    switch (mPageNumber + 1) {

    case 1:
        imgSlideView.setImageResource(R.drawable.carbonara);
        ((TextView) rootView.findViewById(android.R.id.text1)).setText(getString(R.string.carbonara));

            difficultyCanvas = creaImgDifficulty();
            ImageView starContainer = (ImageView) rootView.findViewById(R.id.starContainer);
            starContainer.draw(difficultyCanvas);

            break;

        // OTHER CASES
    }



    private Canvas creaImgDifficulty() {
        Canvas canvas;
        Bitmap chefHatOk = BitmapFactory.decodeResource(getResources(), R.star);
        Bitmap output = Bitmap.createBitmap(1, 1, Bitmap.Config.ARGB_8888);
        canvas = new Canvas(output);

        int space = 10; // the space between images

        for(int i = 0; i &lt; 3; i++) {
            canvas.drawBitmap(chefHatOk, i * (chefHatOk.getWidth() + space), 0, null);
        }

        return canvas;
    }

}
</code></pre>

<p>So, as you can see in the previous code sippet, when the view is created first I create a new <strong>Canvas</strong> object (that contains the repeated images) calling the <strong>creaImgDifficulty()</strong> and then I try to draw this <strong>Canvas</strong> object into the previous <strong>ImageView</strong> having <strong>id=starContainer</strong>.</p>

<p>The <strong>creaImgDifficulty()</strong> create the <strong>Canvas</strong> object and draw the bitmap on it 3 times.</p>

<p>I obtain no error when I run the application but the images is not displayed into my <strong>ImageView</strong>.</p>

<p>Why? What is wrong? What am I missing? How can I try to solve this issue? </p>