//
mainactivity.java代码如下
package com.example.test;
import java.util.ArrayList;
import java.util.List;
import android.support.v4.view.ViewPager;
import android.support.v7.app.ActionBarActivity;
import android.view.View;
import android.view.Window;
import android.webkit.WebView;
import android.content.Intent;
import android.os.Bundle;
public class MainActivity extends ActionBarActivity {
private WebView webView;
private Intent intent = new Intent("com.angel.Android.MUSIC");
private ViewPager pager;
private List<View>viewList;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
startService(intent);
requestWindowFeature(Window.FEATURE_NO_TITLE);
setContentView(R.layout.activity_main);
viewList=new ArrayList<View>();
View view1 =View.inflate(this, R.layout.view1, null);
View view2 =View.inflate(this, R.layout.view2, null);
View view3 =View.inflate(this, R.layout.view3, null);
viewList.add(view1);
viewList.add(view2);
viewList.add(view3);
MyViewPagerAdapter adapter=new MyViewPagerAdapter(viewList);
pager=(ViewPager) findViewById(R.id.pager);
pager.setAdapter(adapter);
init();//此处为init代码
}
private void init() {
// TODO Auto-generated method stub
}
//此处和老师打的一样没有错误,就不打了
}