編輯:高級開發
package com.xmz.listvIEw;
import android.app.Activity;
import android.database.Cursor;
import android.os.Bundle;
import android.os.Handler;
import android.os.Message;
import android.view.VIEw;
import android.widget.AdapterVIEw;
import android.widget.ListVIEw;
import android.widget.ProgressBar;
import android.widget.TextVIEw;
import android.widget.AdapterVIEw.OnItemSelectedListener;
public class MainActivity extends Activity {
private ListView listvIEw;
private ProgressBar loadBar;
private TextVIEw loadText;
private ShopAdapter adapter;
private int start=0;//開始數量
private int limit=3;//每頁數量
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentVIEw(R.layout.main);
listview=(ListView)findViewById(R.id.main_ListVIEw);
loadBar=(ProgressBar)findVIEwById(R.id.main_loadBar);
loadText=(TextView)findVIEwById(R.id.main_loadText);
adapter=new ShopAdapter(this);
listvIEw.setAdapter(adapter);
listvIEw.setOnItemSelectedListener(new OnItemSelectedListener(){
@Override
public void onItemSelected(AdapterView arg0, VIEw arg1,
int count, long arg3) {
if(adapter.getCount()==count+1){
loadText.setText("下載中...");
loadBar.setVisibility(VIEw.VISIBLE);
new Thread(mRunnable).start();
}
}
@Override
public void onNothingSelected(AdapterVIEw arg0) {
}
});
new Thread(mRunnable).start();
}
/**
* 商店列表線程
*/
private Runnable mRunnable=new Runnable(){
接上頁
public void run(){
try {
Thread.sleep(1500);
mHandler.sendMessage(mHandler.obtainMessage());
} catch (InterruptedException e) {
//System.out.println("Error-"+e.getMessage());
}
}
};
Handler mHandler=new Handler(){
public void handleMessage(Message msg){
super.handleMessage(msg);
loadHotShop(limit);
}
};
/**
* 加載店鋪
* @return
*/
public void loadHotShop(int limit){
DBLocalService db=new DBLocalService(this);
Cursor cursor=db.querySQL("select * from "+db.TABLE_SHOP+" limit "+start+","+limit,null);
if(cursor.getCount()>0) this.start+=limit;
while(cursor.moveToNext()){
Shop s=new Shop();
s.setId(cursor.getString(cursor.getColumnIndex("id")));
s.setTitle(cursor.getString(cursor.getColumnIndex("title")));
adapter.addShop(s);
}
loadText.setText("");
loadBar.setVisibility(VIEw.GONE);
}
}
cd未提供android market程序,無法從market下載。但還是可以安裝單獨的apk的。 由於android是基於Linux內核的,因此,自然可以使用lin
谷歌傾力打造的android系統平台智能手機操作系統,而相應的終端OPhone也已經推出了近十款之多。那麼隨著谷歌及android系統可能面臨的變動,OPhone自然也
android是基於Linux內核的軟件平台和操作系統,早期由Google開發,下面介紹有關android命令的問題,希望大家看完本文章後,能夠找到自己想要的信息。每個
ContactsProvider,GoogleSubsribedFeedsProvidercImProvider,MediaProvider SettingsProv