我正在开发一个应用程序,该应用程序在选项卡内有滑动选项卡,有按钮,例如 fragmenttab1 有 Algabra 按钮,当用户单击此按钮时,我想要它,它会将它们带到 AlgabraHome.class
AlgabraHome.class
package com.androidbegin.absviewpagertutorial;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.content.Intent;
import com.actionbarsherlock.app.SherlockFragment;
public class FragmentTab1 extends SherlockFragment {
private Button btn;
private Button btn2;
private Button btn3;
private Button btn4;
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
// Get the view from fragmenttab1.xml
View view = inflater.inflate(R.layout.fragmenttab1, container, false);
btn = (Button) view.findViewById(R.id.algabra);
btn.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
Intent intent = new Intent(FragmentTab1.this, AlgbraHome.class);
startActivity(intent);
}
return view;
}
@Override
public void onSaveInstanceState(Bundle outState) {
super.onSaveInstanceState(outState);
setUserVisibleHint(true);
}
}
我不断收到流动错误:
Description Resource Path Location Type
Syntax error, insert "}" to complete ClassBody FragmentTab1.java
/School Tools/src/com/androidbegin/absviewpagertutorial line 35 Java Problem
The constructor Intent(FragmentTab1, Class<AlgbraHome>) is undefined FragmentTab1.java
/School Tools/src/com/androidbegin/absviewpagertutorial line 32 Java Problem
Syntax error, insert ")" to complete MethodInvocation FragmentTab1.java /School Tools/src/com/androidbegin/absviewpagertutorial line 35 Java Problem
我试过用眼睛看它,但没有运气
如果可以的话请帮忙
提前感谢
问候 Rapsong11