Lou Cabron

Greenhorn
+ Follow
since Aug 29, 2012
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Lou Cabron

I'm using a RelativeLayout for a very simple app which consists of a textView at the top and a FrameLayout at the bottom. But the FrameLayout keeps overlapping the TextView on small-screen devices (like a cellphone). Here's some of the things I've tried that *haven't* worked to resolve the problem. (I tried Weight="1", but it's a relativeLayout, so Eclipse gives an error message. And I tried android:layout_below="@id/theText" but the contents of the FrameLayout then decide to vertically align themselves at the *top* of the FrameLayout...)


<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".MainActivity"
android:id="@+id/myLayout"
android:clickable="true"
android:onClick="myMethod"
android:paddingBottom="@dimen/activity_vertical_margin"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
>

<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/hello_world"
android:id="@+id/theText"
android:textSize="34sp"
android:layout_centerHorizontal="true"
android:layout_centerVertical="true"
android:gravity="center"
android:shadowColor="@color/white"
android:shadowDx="1"
android:shadowDy="1"
android:shadowRadius="2"

/>


<FrameLayout
android:layout_alignParentBottom="true"
android:layout_width="match_parent"
android:layout_height="wrap_content"
></FrameLayout>
10 years ago
I posted this on another site, but I'm still struggling to understand the answer. I realized I don't know exactly what the JVM does with my code. Java World ran an interesting article which implies that all the JVM does is convert the compiled byte code from a class file into machine-level code, and then hands it off to the processor to execute. So does that mean the JVM's role is really to be more like a memory manager -- holding variables and objects, maintaining their values, scheduling threads, etc. (In Head-First Java, there's an interview with the JVM where it brags that it runs the program - so maybe I guess how exactly we're defining "run"...)

And my confusion about this brings up some related questions...

-- Did the JVM ever run code? I have some very old Java books which talk about JVM implementations that send the byte code to an interpreter (rather than to a just-in-time compiler which converts it into machine code). So I guess specifically here I'm asking, was that interpreter running the interpreted code? Or was it still just passing it off to the microprocessor...

- So how is what the JVM doing any different then from what a regular piece of software does -- say, Microsoft Word? Doesn't Word ultimately just hand off its own calls to the processor to execute? (Maybe I should be asking whether everything is ultimately handled by the microprocessor -- albeit usually through the main operating system?)

-- Here's a specific example that shows where I'm confused. I've been trying to visualize the answer to a specific question: Where exactly does a JFrame come from? I know the old java.awt.Frame objects were "heavyweight," which I guess means they were spawned from pre-existing Frame code in whatever underlying device was running the JVM. But if JFrame's are "lightweight," then where exactly are they coming from? Is there actually code in the JVM implementation that knows how to draw windows onto a screen, which gets executed without going back to the underlying machine or machine processor?
11 years ago
Hi Jeff! I wanted to ask how you first became interested in Java. (It's always fun to hear stories about aspiring young programmers and their first forays with a new language -- and it's a nice way to get some perspective on how far we've come now that we're up to Java 7.)

11 years ago