当用户点击按钮并获取位置信息并将其设置为我的按钮时,我想调用LocationActivity。
xml文件
<Button
android:id="@+id/locationTxt"
android:text="@string/setLocation"
android:textStyle="bold"
android:layout_weight="0.5"
android:layout_width="8dp"
android:layout_height="40dp"
android:layout_marginTop="4dp"
android:layout_marginLeft="18dp"
android:layout_marginRight="18dp"
android:editable="false"
android:gravity="center"
android:background="@drawable/btn_shape" />
Java文件
public class AddTask extends android.app.Fragment {
Button btnLocation;
public AddTask()
{
// Constructor
}
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
View v = inflater.inflate(R.layout.add_task, container, false);
btnLocation = (Button) v.findViewById(R.id.locationTxt);
btnLocation.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
}
});