how to change to a new activity from a button click inside a fragmenttab
Hi i'm working on a app that has swipe tabs inside the tabs there is
buttons so for example fragmenttab1 has Algabra button i want it when the
user clicks this button it takes them to AlgabraHome.class i have no idea
how to do this any help would be amazing!
fragmanttab1.xml:
<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" >
<Button
android:id="@+id/algabra"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:layout_centerHorizontal="true"
android:layout_marginTop="56dp"
android:text="Algabra" />
<Button
android:id="@+id/geomtery"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignRight="@+id/algabra"
android:layout_below="@+id/algabra"
android:layout_marginTop="75dp"
android:text="geomtery" />
</RelativeLayout>
FragmentTab1.java
package com.androidbegin.absviewpagertutorial;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import com.actionbarsherlock.app.SherlockFragment;
public class FragmentTab1 extends SherlockFragment {
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
// Get the view from fragmenttab1.xml
View view = inflater.inflate(R.layout.fragmenttab1, container,
false);
return view;
}
@Override
public void onSaveInstanceState(Bundle outState) {
super.onSaveInstanceState(outState);
setUserVisibleHint(true);
}
}
if you need anything else please let me know
i'm new to android development and am learning so no non helpful comments
please :)
Thanks
No comments:
Post a Comment