Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Newcomers » Newcomers » intro to menu(need help coding)
intro to menu [message #724496] Mon, 12 September 2011 13:26 Go to next message
Erik  is currently offline Erik Friend
Messages: 1
Registered: September 2011
Junior Member
Hi guys!

I am new to eclipse, programming and to this forum, I need help! I am trying to have one picture with a button that says "continue", and when you press the button it will go to another picture. I have both pictures in the res>drawable-hdpi folder. The picture files names are "theintro" and "mainmenu".


This is what I have written so far;

In my src>MainActivity.java I have this:



import android.app.Activity;
import android.graphics.drawable.Drawable;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.ImageView;

public class MainActivity extends Activity {
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);

setButtonClickListener();
}
toggleUi(){
}


private void setButtonClickListener() {

Button toggleButton = (Button)findViewById(R.id.toggleButton);
toggleButton.setOnClickListener(new View.OnClickListener() {
public void onClick(View v){
}
});

}

private void toggleUi(){
ImageView imageView = (ImageView) findViewById(R.id.toggleButton);
Drawable newmainmenu;

}

@Override
protected void onResume(){
super.onResume();
toggleUi();
};
}

In my layout>main.xml i have:


<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="schemas.android.com/apk/res/android"
android:layout_height="match_parent" android:layout_width="wrap_content" android:orientation="vertical" android:background="#ffffff">
<ImageView
android:id="@+id/theintro"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:src="@drawable/theintro" />
<Button
android:id="@+id/toggleButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:text="continue"
/>
</LinearLayout>



I got errors on the line:
toggleUi(){
and
private void toggleUi(){

I can get the first picture up and the button with no problem. The problem I am having is trying to have the second picture come up after clicking the button.


Any help 100000% appreciated!

[Updated on: Mon, 12 September 2011 13:29]

Report message to a moderator

Re: intro to menu [message #724522 is a reply to message #724496] Mon, 12 September 2011 14:09 Go to previous message
Russell Bateman is currently offline Russell BatemanFriend
Messages: 3798
Registered: July 2009
Location: Provo, Utah, USA
Senior Member

On 2011.09.12 7:26, Erik wrote:
> Hi guys!
>
> I am new to eclipse, programming and to this forum, I need help! I am
> trying to have one picture with a button that says "continue", and when
> you press the button it will go to another picture. I have both pictures
> in the res>drawable-hdpi folder.
> [snip]
Eclipse isn't Android. Ask things like this in Android forums:

http://www.javahotchocolate.com/tutorials/android.html#support
Previous Topic:Build commands available
Next Topic:Icons not appearing
Goto Forum:
  


Current Time: Thu Apr 25 12:36:25 GMT 2024

Powered by FUDForum. Page generated in 0.08140 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top