电子书阅读器
包含内容: 源码,全套工具
作者QQ1420527913
视频中的源码可以点击【下载实例】进行下载, 环境配置: Eclipse+ADT+SDK4.0.3
android开发环境配置 http://wisdomdd.cn/Wisdom/resource/articleDetail.htm?resourceId=1028
程序启动后运行效果

代码讲解
1.启动界面
firstActivity
public class firstActivity extends Activity {
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
this.requestWindowFeature(Window.FEATURE_NO_TITLE);
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
WindowManager.LayoutParams.FLAG_FULLSCREEN);
setContentView(R.layout.first);
AppConnect.getInstance(this);
Thread splashThread = new Thread() {
@Override
public void run() {
try {
int waited = 0;
while (waited < 5000) {
sleep(100);
waited += 100;
}
} catch (InterruptedException e) {
// do nothing
} finally {
finish();
Intent i = new Intent();
i.setClassName("com.lxm.txtapp",
"com.lxm.txtapp.MainActivity");
startActivity(i);
}
}
};
splashThread.start();
}
/*
* (non-Javadoc)
*
* @see android.app.Activity#onResume()
*/
@Override
protected void onResume() {
// TODO Auto-generated method stub
AppConnect.getInstance(this).initPopAd(this);
super.onResume();
};
}AndroidManifest.xml
<application android:icon="@drawable/ic_launcher" android:label="@string/app_name" > <activity android:name="com.lxm.txtapp.turntest" android:label="@string/app_name" > </activity> <activity android:name="com.lxm.txtapp.MainActivity" android:label="@string/app_name" > </activity> <activity android:name="com.lxm.txtapp.firstActivity" android:label="@string/app_name" android:screenOrientation="portrait" > <intent-filter> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" /> </intent-filter> </activity> <activity android:name="cn.waps.OffersWebView" android:configChanges="keyboardHidden|orientation" /> <!-- 以下属性为应?用ID,从万普后台获取 --> <meta-data android:name="WAPS_ID" android:value="e6358c1c0bf3d4be808385ebe84df759" /> <!-- 以下属性为分发渠道ID,编码表参?见本?文档末附表 --> <meta-data android:name="WAPS_PID" android:value="WAPS" /> </application>
2. 主界面
MainActivity
public class MainActivity extends Activity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
GridView gridView = (GridView) findViewById(R.id.popup_grid);
GridViewAdapter adapter = new GridViewAdapter(this, mPictures, mTitles,
R.layout.grid2);
gridView.setAdapter(adapter);
// 互动广告调用方式
LinearLayout layout = (LinearLayout) this
.findViewById(R.id.AdLinearLayout);
AppConnect.getInstance(this).showBannerAd(this, layout);
gridView.setOnItemClickListener(new ItemClickListener());
gridView.setOnItemSelectedListener(new OnItemSelectedListener() {
/*
* (non-Javadoc)
*
* @see
* android.widget.AdapterView.OnItemSelectedListener#onItemSelected
* (android.widget.AdapterView, android.view.View, int, long)
*/
@Override
public void onItemSelected(AdapterView<?> arg0, View arg1,
int arg2, long arg3) {
// TODO Auto-generated method stub
}
/*
* (non-Javadoc)
*
* @see
* android.widget.AdapterView.OnItemSelectedListener#onNothingSelected
* (android.widget.AdapterView)
*/
@Override
public void onNothingSelected(AdapterView<?> arg0) {
// TODO Auto-generated method stub
}
});
}
private int[] mPictures = { R.drawable.cover_txt, R.drawable.cover_txt,
R.drawable.cover_txt, R.drawable.cover_txt, R.drawable.cover_txt,
R.drawable.cover_txt, };
private String[] mTitles = { "Bookmarks", "Font Size", "Brightness",
"Read Style", "Recreation", "About" };
public static String[] bookslist = { "data.txt", "data1.txt", "data2.txt",
"data3.txt", "data4.txt", "data5.txt" };
public static int[] bookslistid = { R.raw.data, R.raw.data1, R.raw.data2,
R.raw.data3, R.raw.data4, R.raw.data5 };
private final class ItemClickListener implements OnItemClickListener {
@Override
public void onItemClick(AdapterView<?> parent, View view, int position,
long id) {
if (position < bookslist.length) {
Intent i = new Intent();
i.setClassName("com.lxm.txtapp", "com.lxm.txtapp.turntest");
i.putExtra("bookname", position);
startActivity(i);
}
}
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
// getMenuInflater().inflate(R.menu.main, menu);
return true;
}
}书籍列表
public static String[] bookslist = { "data.txt", "data1.txt", "data2.txt",
"data3.txt", "data4.txt", "data5.txt" };点击书籍列表后,展示的内容为data.txt, data1.txt ..... 对应的文本内容
