【Android中的互联网连接】金鞍玉勒寻芳客,未信我庐别有春。这篇文章主要讲述Android中的互联网连接相关的知识,希望能为你提供帮助。
- private void callToWebSrvice( ) {
- ConnectivityManager connManager = ( ConnectivityManager) getSystemService( Context.CONNECTIVITY_SERVICE) ;
- if ( connManager.getNetworkInfo( ConnectivityManager.TYPE_MOBILE) .getState( ) == NetworkInfo.State.CONNECTED ||connManager .getNetworkInfo( ConnectivityManager.TYPE_WIFI) .getState( ) == NetworkInfo.State.CONNECTED) {
- _progresssDialog = ProgressDialog.show( this," Please Wait..." ," Retrieving Data" ) ;
- getData( ) ;
- } else
- Toast.makeText( BestScore.this, " Network Error!!!" , Toast.LENGTH_LONG) .show( ) ;
- }
- public void getData( ) {
- Thread _thread = new Thread( ) {
- public void run( ) {
- Message _msg = new Message( ) ;
- _msg.what = _updataSmsLog;
- callDataBase( ) ;
- BestScore.this._uicallback.sendMessage( _msg) ;
- }
- } ;
- _thread.start( ) ;
- }
- Handler _uicallback = new Handler( ) {
- public void handleMessage( Message msg) {
- switch( msg.what) {
- case _updataSmsLog :
- if( _dataList.size( ) > 0 ) {
- _initial.setText( ( ( Data) ( _dataList.get( 0) ) ) ._initial) ;
- _wpm.setText( ( ( Data) ( _dataList.get( 0) ) ) ._wpm) ;
- _phone.setText( ( ( Data) ( _dataList.get( 0) ) ) ._smartPhone) ;
- _country.setText( ( ( Data) ( _dataList.get( 0) ) ) ._country) ;
- _progresssDialog.dismiss( ) ;
- setListAdapter( new IconicAdator( BestScore.this,R.layout.viewrow,_dataList) ) ;
- }
- else{
- _progresssDialog.dismiss( ) ;
- Toast.makeText( BestScore.this," No Record Found" ,Toast.LENGTH_LONG) .show( ) ;
- }
- }
- } ;
- } ;
推荐阅读
- android emulator-替换系统应用程序
- 纳吉奥斯(netapp ontap 8 control de tama?±o por vol?omen)
- Android中的Toast
- Android表布局宽度问题
- 基本Android计算器
- 用户€IIS APPPOOLDefaultAppPool€登录失败?
- Android-底部有标签
- 在Android中使用getView和convertView
- [android]全屏