No properties tab in layout resource editor

Recently uninstalled and reinstalled eclipse with android sdk. Now I don’t see the properties tab in the layout resource editor.


Update: This is all I see in “window > open perspective > other”
alt text


Window -> Show View -> Other -> General -> Properties


Animation BEFORE activity change

I’m trying to do something simple, but I can’t understand why it’s not working.
What I’m trying to do is: when I touch an ImageView, it will show an animation on it. And then, only when that animation ends it will start the new activity.
Instead, what happens is that the new activity starts right away and the animation is not shown.

Here is the animation xml:

<rotate android:interpolator="@android:anim/decelerate_interpolator"
    android:duration="10000" />

And this is the code I use to call it:

public void onCreate( Bundle savedInstanceState )
    final ImageView ib = (ImageView)this.findViewById( );
    ib.setOnClickListener( new OnClickListener( ) {

        public void onClick( View v )
            Animation hang_fall = AnimationUtils.loadAnimation( Curriculum.this, R.anim.hang_fall );
            v.startAnimation( hang_fall );
            Intent i = new Intent( ThisActivity.this, NextActivity.class );
            ThisActivity.this.startActivity( i );
        }// end onClick
    } );
}// end onCreate

As you see I tried putting a loooong time for the animation, but it doesn’t work. The NextActivity starts right away, it doesn’t wait for the animation in ThisActivity to finish.
Any idea on why this happens?


That’s because you’re starting the intent and the animation at the same time. You need to start the intent after the animation is over, like this:

public void onClick( View v )
    Animation hang_fall = AnimationUtils.loadAnimation( Curriculum.this, R.anim.hang_fall );
    hang_fall.setAnimationListener(new Animation.AnimationListener()
            public void onAnimationEnd(Animation animation)
                Intent i = new Intent( ThisActivity.this, NextActivity.class );
                ThisActivity.this.startActivity( i );

            public void onAnimationRepeat(Animation animation)
                // Do nothing!

            public void  onAnimationStart(Animation animation)
                // Do nothing!
    v.startAnimation( hang_fall );
}// end onClick

How do I pass a primitive data type by reference?

How can I pass a primitive type by reference in java? For instance, how do I make an int passed to a method modifiable?


There isn’t a way to pass a primitive directly by reference in Java.

A workaround is to instead pass a reference to an instance of a wrapper class, which then contains the primitive as a member field. Such a wrapper class could be extremely simple to write for yourself:

public class IntRef { public int value; }

But how about some pre-built wrapper classes, so we don’t have to write our own? OK:

The Apache commons-lang Mutable* classes:
Advantages: Good performance for single threaded use. Completeness.
Disadvantages: Introduces a third-party library dependency. No built-in concurrency controls.
Representative classes: MutableBoolean, MutableByte, MutableDouble, MutableFloat, MutableInt, MutableLong, MutableObject, MutableShort.

The java.util.concurrent.atomic Atomic* classes:
Advantages: Part of the standard Java (1.5+) API. Built-in concurrency controls.
Disadvantages: Small performance hit when used in a single-threaded setting. Missing direct support for some datatypes, e.g. there is no AtomicShort.
Representative classes: AtomicBoolean, AtomicInteger, AtomicLong, and AtomicReference.
Note: As user ColinD shows in his answer, AtomicReference can be used to approximate some of the missing classes, e.g. AtomicShort.

Length 1 primitive array
OscarRyz’s answer demonstrates using a length 1 array to “wrap” a primitive value.
Advantages: Quick to write. Performant. No 3rd party library necessary.
Disadvantages: A little dirty. No built-in concurrency controls. Results in code that does not (clearly) self-document: is the array in the method signature there so I can pass multiple values? Or is it here as scaffolding for pass-by-reference emulation?

Also see
The answers to StackOverflow question “Mutable boolean field in Java“.

My Opinion
In Java, you should strive to use the above approaches sparingly or not at all. In C it is common to use a function’s return value to relay a status code (SUCCESS/FAILURE), while a function’s actual output is relayed via one or more out-parameters. In Java, it is best to use Exceptions instead of return codes. This frees up method return values to be used for carrying the actual method output — a design pattern which most Java programmers find to be more natural than out-parameters.


Should I put all Android view attributes into the style?

I’ve seen that some Android devs promote this form of declarative layout:

<TextView style="@style/my_textview_style" />

i.e. that pretty much all the attributes (including the ID) go into the style definition. It certainly makes for shorter layout files, but is it a step too far?

What would you recommend goes in the style definition, and what should stay in the layout, and why?

I’ve started doing Android dev this year, but have prior experience of development. Issues like this are so important, the “way” we use the tools, the habits, to be more efficient. I appreciate you sharing your views on what works for you, for clarity, for efficiency, for maintainability, for app reliability.


I’ve pondered this very question and it becomes much more pertinent when dealing with multiple device sizes and densities.

Putting too much information into the styles can limit their use, especially when dealing with landscape and portrait layouts. For example a landscape layout may in fact be wholly different in composition but require very similar styles.

In these cases it helps to use the . notation to ammend style differences, for example.


See below for information on the above approach to creating styles.

MyPage defines the common properties for your layout and you then override these values in the portrait and landscape extensions.

I..e you might have more right and left padding in landscape than portrait.

The problem i’ve found is that the themes and styles xml files get huge, especially if like me you have many activities, and if you address lots of creative changes then you can end up with lots of messed up definitions.

At this point you have to take stock, tidy up and re-factor.

My only advice is that you plan really well upfront. Define a naming system that accommodates your project, write it down and stick to it.

Possible style naming convention



A similar approach to themes should be adopted.

I’m still working this out, so can’t give fuller examples.


Java: Oracle XMLType + JDBC

How can I get oracle XMLElement to JDBC?

java.sql.Statement st = connection.createStatement(); // works
oracle.jdbc.OracleResultSet rs = st.execute("SELECT XMLElement("name") FROM dual");
rs.getString(1); // returns null, why?
oracle.sql.OPAQUE = (OPAQUE) rs.getObject(1); // this works, but wtf is OPAQUE ?

Basically, I want to read String like <name> </name> or whatever XML formatted output. But I always fail to cast output to anything reasonable. Only weird oracle.sql.OPAQUE works, but I totally dont know what to do with that. Even toString() is not overriden!

Any ideas? How to read Oracle’s (I am using Oracle 10.0.2) XMLElement (XMLType) ?


You can’t. Oracle’s JDBC driver does not support the JDBC XML type properly.

The only thing you can do, is to convert the XML as part of the query:

SELECT to_clob(XMLElement("name")) from dual

Then you can retrieve the XML using getString()

alternatively you can also use XMLElement("name").getClobVal(), but again this is part of your query and it can be accessed as a String from within your Java class

Source: stackoverflow
Text is available under the Creative Commons Attribution-ShareAlike License; additional terms may apply. By using this site, you agree to the Privacy Policy, and Copyright Policy. Content is available under CC BY-SA 3.0 unless otherwise noted. The answers/resolutions are collected from stackoverflow, are licensed under cc by-sa 2.5 , cc by-sa 3.0 and cc by-sa 4.0 © No Copyrights, All Questions are retrived from public domain..