intro to menu [message #724496] |
Mon, 12 September 2011 13:26 |
Erik 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
|
|
|
|
Powered by
FUDForum. Page generated in 0.08140 seconds