Hi I’m very new to android development, and want to create an app with three pages and a main page with buttons on it navigating to the different pages. I have create the different xml pages and I believe I have to create some sort of onclick thing but im unsure.
What java code do I need, what else to I need to add to the normal button xml etc. can anyone please show me an example to implement into my work with pictures please
This is one of my buttons
<Button
android:id="@+id/information"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:textColor="#fff"
android:background="@drawable/custombutton"
android:text="Information >"
android:textSize="18dp"
android:layout_marginBottom="2dp"
/>
This is the only java file I have (do i add to this or make new one)
package com.techie.layout;
import android.app.Activity;
import android.os.Bundle;
import android.view.Window;
import android.view.WindowManager;
import reading.festival.guide.R;
public class LayoutPractice extends Activity {
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
//makes full screen and takes away title bar
requestWindowFeature(Window.FEATURE_NO_TITLE);
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,WindowManager.LayoutParams.FLAG_FULLSCREEN);
//
setContentView(R.layout.linear);
}
}
My other xml layouts are called sitemap, information, and lineup the original xml is called linear.
I hope I have provided enough information for someone to help me, im sure its very easy and im being stupid
cheers
So when you say “pages” you mean Activities. You’ll need to create an activity for each of your layout files.
Reading material:
http://developer.android.com/guide/topics/fundamentals/activities.html