i want to learn how to create an android app, and i'm confused at :
1.first time launching my app will display viewpagers img_btn ice, img_btn jelly. and when img_buttons clicked will display which image chosen in profil.xml, is there any solution do it in 1 xml or i must create 2 xml for each button?
2.if user have choosed img_button, main_activity will change to profil.xml, so for the second time launch will show profil.xml. how can i do that?
main_activity.xml
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/pager"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:gravity="center"
android:background="#000000"
>
<TextView
android:text="Choose char"
android:textSize="25dp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="#1e00ff"/>
<android.support.v4.view.ViewPager
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/main_ViewPager"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#000000"/>
page1.xml
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:background="#000000"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Halaman 2"
android:textAppearance="?android:attr/textAppearanceLarge"
android:id="@+id/textView"
android:layout_gravity="center_horizontal"
android:textSize="54dp"
android:textColor="#0aedff"/>
<ImageButton
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/imageButton"
android:background="#00000000"
android:src="@drawable/btn_info"
android:layout_alignParentTop="true"
android:layout_centerHorizontal="true"
android:layout_gravity="center_vertical|center"/>
page1.java
import android.support.v4.app.*;
import android.view.*;
import android.os.*;
public class page1 extends Fragment {
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
{
View v=inflater.inflate(R.layout.halaman_1, container,false);
return v;
}
}
page2.xml and page2.java same as page1 English isn’t my first language, so please excuse any mistakes.