Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9089221
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T22:06:07+00:00 2026-06-16T22:06:07+00:00

Hello I am making a jigsaw puzzle application and for that i have 16

  • 0

Hello I am making a jigsaw puzzle application and for that i have 16 made smaller bitmaps out of a large scaled bitmap with height = width = 240. Now I have to dynamically display these bitmaps in a single activity at one time. The code I tried is not working properly as it is displaying all images in a single row and size of image is too small. Here is the code:

public void display()
    {
        float x =0;
        float y = 0;
        LinearLayout llMain = new LinearLayout(this);
        for(int i=0;i<3;i++)
        {
            LinearLayout llRow = new LinearLayout(this);
            for(int j=0;j<tiles.length/4;j++)
            {
                ImageView iv = new ImageView(this);
                iv.setImageBitmap(tiles[j]);// get bitmap from image path
                iv.setX(x);
                iv.setY(y);
                x = y = x + 60;
                llRow.addView(iv);
            }
            llMain.addView(llRow);
        }
        setContentView(llMain);
       }
}

Here is the LogCat:

01-05 00:32:35.820: D/dalvikvm(11346): GC_EXTERNAL_ALLOC freed 47K, 52% free 2599K/5379K, external 1990K/2108K, paused 135ms
01-05 00:32:44.183: D/dalvikvm(11346): GC_EXTERNAL_ALLOC freed 43K, 50% free 2739K/5379K, external 2477K/2527K, paused 18ms
01-05 00:32:45.156: I/dalvikvm(11346): Could not find method android.widget.ImageView.setX, referenced from method com.maju.jigsawpuzzle.PlayBoard.display
01-05 00:32:45.156: W/dalvikvm(11346): VFY: unable to resolve virtual method 3236: Landroid/widget/ImageView;.setX (F)V
01-05 00:32:45.156: D/dalvikvm(11346): VFY: replacing opcode 0x6e at 0x002e
01-05 00:32:45.156: D/dalvikvm(11346): VFY: dead code 0x0031-003e in Lcom/maju/jigsawpuzzle/PlayBoard;.display ()V
01-05 00:32:45.179: D/AndroidRuntime(11346): Shutting down VM
01-05 00:32:45.179: W/dalvikvm(11346): threadid=1: thread exiting with uncaught exception (group=0x40015578)
01-05 00:32:45.187: E/AndroidRuntime(11346): FATAL EXCEPTION: main
01-05 00:32:45.187: E/AndroidRuntime(11346): java.lang.NoSuchMethodError: android.widget.ImageView.setX
01-05 00:32:45.187: E/AndroidRuntime(11346):    at com.maju.jigsawpuzzle.PlayBoard.display(PlayBoard.java:164)
01-05 00:32:45.187: E/AndroidRuntime(11346):    at com.maju.jigsawpuzzle.PlayBoard.shuffleArray(PlayBoard.java:143)
01-05 00:32:45.187: E/AndroidRuntime(11346):    at com.maju.jigsawpuzzle.PlayBoard.breakImage(PlayBoard.java:123)
01-05 00:32:45.187: E/AndroidRuntime(11346):    at com.maju.jigsawpuzzle.PlayBoard.onCreate(PlayBoard.java:40)
01-05 00:32:45.187: E/AndroidRuntime(11346):    at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
01-05 00:32:45.187: E/AndroidRuntime(11346):    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1615)
01-05 00:32:45.187: E/AndroidRuntime(11346):    at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1667)
01-05 00:32:45.187: E/AndroidRuntime(11346):    at android.app.ActivityThread.access$1500(ActivityThread.java:117)
01-05 00:32:45.187: E/AndroidRuntime(11346):    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:935)
01-05 00:32:45.187: E/AndroidRuntime(11346):    at android.os.Handler.dispatchMessage(Handler.java:99)
01-05 00:32:45.187: E/AndroidRuntime(11346):    at android.os.Looper.loop(Looper.java:123)
01-05 00:32:45.187: E/AndroidRuntime(11346):    at android.app.ActivityThread.main(ActivityThread.java:3687)
01-05 00:32:45.187: E/AndroidRuntime(11346):    at java.lang.reflect.Method.invokeNative(Native Method)
01-05 00:32:45.187: E/AndroidRuntime(11346):    at java.lang.reflect.Method.invoke(Method.java:507)
01-05 00:32:45.187: E/AndroidRuntime(11346):    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:842)
01-05 00:32:45.187: E/AndroidRuntime(11346):    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:600)
01-05 00:32:45.187: E/AndroidRuntime(11346):    at dalvik.system.NativeStart.main(Native Method)

Line 164 is the line:

iv.setX(x);

Does anybody know the solution? Moreover I have to register onClick with them…

Thanks in advancce

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-16T22:06:08+00:00Added an answer on June 16, 2026 at 10:06 pm

    Do not use setX/setY if you want to support old android versions.
    Instead set LayoutParams (LinearLayout.LayoutParams) to specify ImageView’s x/y params. Read this post: Android – Use of view.setX() and setY in api 8

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Hello guys I'm making an application that accesses MySQL & MsSQL databases that fiddles
Hello I have a tool tip I am making with jquery, that loads the
Hello I’m making a budget application that will allow you to look at expeances
Hello i am Making an application To login To Nexon.net , I cant Get
Hello Android programmers, I am making a currency application and to do this, I
Hello making a small program that reads a text file then creates an ouput
Hello i am making an small application in which i want search functionality i
I was making this hello world application using Struts2 and I've encountered an HTTP
hello I am very beginer of haskell I am making GUI program that open
I'm making an iOS app (first actual app that isn't Hello World), and it

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.