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

  • Home
  • SEARCH
  • 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 8924727
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T07:29:44+00:00 2026-06-15T07:29:44+00:00

I am using some code for a coverflow from the website, http://www.inter-fuser.com/2010/01/android-coverflow-widget.html this coverflow

  • 0

I am using some code for a coverflow from the website,

http://www.inter-fuser.com/2010/01/android-coverflow-widget.html

normal working coverflow

this coverflow works great and no problems. however when I tried to put it inside of a xml layout it would not show up, only the black backgroud wallpaper for the coverflow showed up but the coverfow is missing.

missing coverflow in layout

the reason that I wanted put it inside of an xml layout is because of the need to put buttons on the bottom of the page. so I decided to make an xml layout with buttons on the lower part of the screen below the coverflow.

what is wrong or what am I missing that makes the coverflow not work inside of an xml layout?

there is probably something i am missing in my code for this to work. I did the following things to try and get this to work. the code author makes it look like all you have to do is use the included example code to set content view. and make a simple xml file in layouts and it should work.

i don’t understand why the coverflow works so well by itself, and not work when placed inside of a layout.

is there a check list of things that are needed to be done for something like this to work?

the author for the coverflow code added the two commented out lines as a sample that can be used when you make your own cusom xml view

         //Use this if you want to use XML layout file
    //setContentView(R.layout.main);
    //coverFlow =  (CoverFlow) findViewById(R.id.coverflow);

I removed the comment out for these lines so I can use them.

next i added the following code to the xml layout

      <com.vagina.destruction.CoverFlow
        android:id="@+id/coverflow"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content" >
      </com.vagina.destruction.CoverFlow>

this is the error message i am getting from the visual layout editor in eclipse

The following classes could not be instantiated:
– com.vagina.destructon.CoverFlow (Open Class, Show Error Log) – com.vagina.destruction.CoverFlowExample (Open Class, Show Error Log)
See the Error Log (Window > Show View) for more details.
Tip: Use View.isInEditMode() in your custom views to skip code when shown in Eclipse

and here is the part of the code at the start of the coverflow example activity

 public class CoverFlowExample extends Activity implements OnItemClickListener {
 /** Called when the activity is first created. */

int imageCount = 0;
Cursor cur;
String toastResult;
String pathName;
 ArrayList<String> list1 = new ArrayList<String>();
private int blocker = 0;
private int imagePosition;
private int pathIndex;
private int indexer;

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    CoverFlow coverFlow;
    coverFlow = new CoverFlow(this);

    Bundle extras = getIntent().getExtras();
    if(extras !=null) {

     imagePosition = extras.getInt("imagePosition");

    }


    String[] proj2 = {MediaStore.Images.Media.DATA};
    Cursor cur2 = getContentResolver().query(MediaStore.Images.Media.EXTERNAL_CONTENT_URI, proj2,  MediaStore.Images.Media.IS_PRIVATE + "='" + 1 +"'", null, null);

    imageCount = cur2.getCount();


    cur2.close();

    coverFlow.setAdapter(new ImageAdapter(this));

    ImageAdapter coverImageAdapter =  new ImageAdapter(this);

    coverFlow.setAdapter(coverImageAdapter);

    coverFlow.setSpacing(-10);
    coverFlow.setSelection(imageCount, true);

 //  setContentView(coverFlow);

    coverFlow.setOnItemClickListener(this);

    coverFlow.setSelection(imagePosition);


    coverFlow =  (CoverFlow) findViewById(R.id.coverflow);

    //Use this if you want to use XML layout file
         setContentView(R.layout.activity_coverflow);
    coverFlow =  (CoverFlow) findViewById(R.id.coverflow);

    // centers the image on coverflow to the same image selected in the previous activity
      coverFlow.setBackgroundResource(R.drawable.blanklarge);
  • 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-15T07:29:46+00:00Added an answer on June 15, 2026 at 7:29 am

    Use this

         public class CoverFlowExample extends Activity implements OnItemClickListener {
         /** Called when the activity is first created. */
    
        int imageCount = 0;
        Cursor cur;
        String toastResult;
        String pathName;
         ArrayList<String> list1 = new ArrayList<String>();
        private int blocker = 0;
        private int imagePosition;
        private int pathIndex;
        private int indexer;
    
        @Override
        public void onCreate(Bundle savedInstanceState) {
            super.onCreate(savedInstanceState);
            //Use this if you want to use XML layout file
            setContentView(R.layout.activity_coverflow);
            CoverFlow coverFlow;
            coverFlow =  (CoverFlow) findViewById(R.id.coverflow);
    
    /*        CoverFlow coverFlow;
            coverFlow = new CoverFlow(this); */
    
            Bundle extras = getIntent().getExtras();
            if(extras !=null) {
    
             imagePosition = extras.getInt("imagePosition");
    
            }
    
    
            String[] proj2 = {MediaStore.Images.Media.DATA};
            Cursor cur2 = getContentResolver().query(MediaStore.Images.Media.EXTERNAL_CONTENT_URI, proj2,  MediaStore.Images.Media.IS_PRIVATE + "='" + 1 +"'", null, null);
    
            imageCount = cur2.getCount();
    
    
            cur2.close();
    
            coverFlow.setAdapter(new ImageAdapter(this));
    
            ImageAdapter coverImageAdapter =  new ImageAdapter(this);
    
            coverFlow.setAdapter(coverImageAdapter);
    
            coverFlow.setSpacing(-10);
            coverFlow.setSelection(imageCount, true);
    
            coverFlow.setOnItemClickListener(this);
    
            coverFlow.setSelection(imagePosition);
    
    
    
            // centers the image on coverflow to the same image selected in the previous activity
              coverFlow.setBackgroundResource(R.drawable.blanklarge);
    

    basically the issue is that once you declare the things in xml, the opbjects are created automatically once you inflate them using setCOntentView. You can get those already created objects using findViewById and no need to create them again using “x = new x()”

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

Sidebar

Related Questions

I'm trying to parse a html doc using some code I found from this
I'm using the Zend framework and the openid selector from http://code.google.com/p/openid-selector/ - however I
I'm using the code from the following site: http://calebogden.com/css-tabs/ which has allowed me to
I'm using some code from here to determine when determining when the last finger
I am modifying some CSS code that I got from http://tympanus.net/codrops/2012/03/15/parallax-content-slider-with-css3-and-jquery/ . It is
Background We've been using some code copied verbatim from Joe Duffy's Concurrent Programming on
I need to extract some text from a HTML table I tried using tblGridHeader.Rows[0].InnerText.ToString()
I'm using Firebird 2.1, DBExpress Driver from DevArt and Delphi 2010. Some of my
I'm using some code to build up tables using JQuery, but in Firefox 3.5.3
I am using some legacy code to return an Excel worksheet as a Dataset.

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.