1.Lcd测试代码:
LCD测试XML:
- <?xmlversion= "1.0" encoding= "utf-8" ?>
- <LinearLayoutxmlns:android="http://schemas.android.com/apk/res/android"
- android:layout_width="fill_parent"
- android:layout_height="fill_parent"
- android:background="#383838"
- android:orientation="vertical"
- android:gravity="center" >
-
- <LinearLayout
- android:orientation="horizontal"
- android:layout_width="fill_parent"
- android:layout_height="fill_parent"
- android:layout_weight="1" >
-
- <TextViewandroid:id="@+id/test_color_text1"
- android:layout_width="fill_parent"
- android:layout_height="fill_parent"
- android:layout_weight="1"
- android:background="#ffff0000" />
- <TextViewandroid:id="@+id/test_color_text2"
- android:layout_width="fill_parent"
- android:layout_height="fill_parent"
- android:layout_weight="1"
- android:background="#ffff0000" />
- <TextViewandroid:id="@+id/test_color_text3"
- android:layout_width="fill_parent"
- android:layout_height="fill_parent"
- android:layout_weight="1"
- android:background="#ffff0000" />
-
- </LinearLayout>
-
- <LinearLayout
- android:orientation="horizontal"
- android:layout_width="fill_parent"
- android:layout_height="wrap_content"
- android:layout_marginTop="5dp"
- android:gravity="center" >
-
- <Buttonandroid:id="@+id/but_return"
- android:layout_width="200dp"
- android:layout_height="wrap_content"
- android:layout_marginLeft="20dp"
- android:text="@string/but_return" />
-
- <Buttonandroid:id="@+id/but_changecolor"
- android:layout_width="200dp"
- android:layout_height="wrap_content"
- android:text="@string/but_changecolor" />
-
- <Buttonandroid:id="@+id/but_next"
- android:layout_width="200dp"
- android:layout_height="wrap_content"
- android:layout_marginRight="20dp"
- android:text="@string/but_next" />
- </LinearLayout>
- </LinearLayout>
2.SD卡测试代码:
SD卡测试XML:
- <?xmlversion= "1.0" encoding= "utf-8" ?>
- <LinearLayoutxmlns:android="http://schemas.android.com/apk/res/android"
- android:layout_width="fill_parent"
- android:layout_height="fill_parent"
- android:background="#383838"
- android:orientation="vertical"
- android:gravity="center" >
-
- <LinearLayout
- android:layout_width="fill_parent"
- android:layout_height="wrap_content"
- android:layout_weight="1"
- android:orientation="vertical"
- android:gravity="center" >
-
- <TextView
- android:id="@+id/test_sd"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:textSize="20sp"
- />
-
- </LinearLayout>
-
- <LinearLayout
- android:layout_width="fill_parent"
- android:layout_height="wrap_content"
- android:layout_weight="1"
- android:orientation="vertical"
- android:gravity="center" >
-
- <TextView
- android:id="@+id/test_sd_create"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:textSize="20sp"
- />
- </LinearLayout>
- <LinearLayout
- android:layout_width="fill_parent"
- android:layout_height="wrap_content"
- android:layout_weight="1"
- android:orientation="vertical"
- android:gravity="center" >
-
- <TextView
- android:id="@+id/test_sd_delete"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:textSize="20sp"
- />
-
- </LinearLayout>
- <LinearLayout
- android:orientation="horizontal"
- android:layout_width="fill_parent"
- android:layout_height="wrap_content"
- android:layout_marginTop="5dp"
- android:gravity="center" >
-
- <Buttonandroid:id="@+id/but_return"
- android:layout_width="200dp"
- android:layout_height="wrap_content"
- android:text="@string/but_return" />
-
- <Buttonandroid:id="@+id/but_next"
- android:layout_width="200dp"
- android:layout_height="wrap_content"
- android:text="@string/but_next" />
- </LinearLayout>
- </LinearLayout>
3.Camera测试代码:
- package com.android.factorytest;
-
-
- import android.app.Activity;
- import android.content.BroadcastReceiver;
- import android.content.Context;
- import android.content.Intent;
- import android.content.IntentFilter;
- import android.os.Bundle;
- import android.provider.MediaStore;
- import android.view.View;
- import android.widget.Button;
-
- public class TestCamera extends Activity
- {
-
- private ButtonmReturn= null ;
- private ButtonmChangeCamera= null ;
- private ButtonmNext= null ;
- private IntentmIntent= null ;
- private static int TAKE_PICTURE= 1 ;
-
- protected void onCreate(BundlesavedInstanceState)
- {
- super .onCreate(savedInstanceState);
- setContentView(R.layout.test_camera);
- initView();
- RegListener();
- }
-
- public void RegListener(){
- ExitListenerReceiverexitre=new ExitListenerReceiver();
- IntentFilterintentfilter=new IntentFilter();
- intentfilter.addAction(this .getPackageName()+ "."
- +"ExitListenerReceiver" );
- this .registerReceiver(exitre,intentfilter);
- }
-
- class ExitListenerReceiver extends BroadcastReceiver{
- @Override
- public void onReceive(Contextarg0,Intentarg1){
-
- ((Activity)arg0).finish();
- }
- }
-
- private void initView()
- {
- setTitle(R.string.test_camera_mess);
- mReturn=(Button)findViewById(R.id.but_return);
- mChangeCamera=(Button)findViewById(R.id.but_changecamera);
- mNext=(Button)findViewById(R.id.but_next);
-
- mReturn.setOnClickListener(new View.OnClickListener()
- {
- public void onClick(Viewv)
- {
- mIntent=new Intent(TestCamera. this ,MainActivity. class );
- startActivity(mIntent);
- }
- });
-
- mNext.setOnClickListener(new View.OnClickListener()
- {
- public void onClick(Viewv)
- {
- mIntent=new Intent(TestCamera. this ,TestWiFi. class );
-
- finish();
- startActivity(mIntent);
- }
- });
- mChangeCamera.setOnClickListener(new View.OnClickListener()
- {
- public void onClick(Viewv)
- {
- mIntent=new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
- startActivityForResult(mIntent,TAKE_PICTURE);
- }
- });
- }
- }
Camera测试XML:
- <?xmlversion= "1.0" encoding= "utf-8" ?>
- <LinearLayoutxmlns:android="http://schemas.android.com/apk/res/android"
- android:layout_width="fill_parent"
- android:layout_height="fill_parent"
- android:background="#383838"
- android:orientation="vertical"
- android:gravity="center" >
-
- <LinearLayout
- android:orientation="horizontal"
- android:layout_width="fill_parent"
- android:layout_height="wrap_content"
- android:layout_weight="1"
- android:gravity="center" >
-
- <TextView
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:textSize="20sp"
- android:text="@string/test_camera_mess" />
- </LinearLayout>
-
- <LinearLayout
- android:orientation="horizontal"
- android:layout_width="fill_parent"
- android:layout_height="wrap_content"
- android:layout_marginTop="5dp"
- android:gravity="center" >
-
- <Buttonandroid:id="@+id/but_return"
- android:layout_width="200dp"
- android:layout_height="wrap_content"
- android:layout_marginLeft="20dp"
- android:text="@string/but_return" />
-
- <Buttonandroid:id="@+id/but_changecamera"
- android:layout_width="200dp"
- android:layout_height="wrap_content"
- android:text="@string/but_camera_open" />
-
- <Buttonandroid:id="@+id/but_next"
- android:layout_width="200dp"
- android:layout_height="wrap_content"
- android:layout_marginRight="20dp"
- android:text="@string/but_next" />
- </LinearLayout>
- </LinearLayout>
4.Wifi测试代码:
- package com.android.factorytest;
-
- import android.app.Activity;
- import android.content.Intent;
-
-
- import android.net.wifi.WifiManager;
- import android.os.Bundle;
- import android.provider.Settings;
- import android.util.Log;
- import android.view.View;
- import android.widget.Button;
- import android.widget.Toast;
-
- public class TestWiFi extends Activity
- {
- private static final StringTAG= "TestWiFi" ;
-
- private ButtonmReturn= null ;
- private ButtonmChangeState= null ;
- private ButtonmNext= null ;
- private IntentmIntent= null ;
- private WifiManagermWifiManager= null ;
-
-
- private int mWifiState=- 1 ;
-
-
-
-
- @Override
- protected void onCreate(BundlesavedInstanceState)
- {
- super .onCreate(savedInstanceState);
- setContentView(R.layout.test_wifi);
- initView();
- }
-
- private void initView()
- {
- mReturn=(Button)findViewById(R.id.but_return);
- mNext=(Button)findViewById(R.id.but_next);
- mChangeState=(Button)findViewById(R.id.but_changestate);
-
- if (mChangeState== null )
- Log.e(TAG,"mChangeStateisnull" );
-
- mReturn.setOnClickListener(new View.OnClickListener()
- {
- public void onClick(Viewv)
- {
- mIntent=new Intent(TestWiFi. this ,MainActivity. class );
- startActivity(mIntent);
- }
- });
-
- mNext.setOnClickListener(new View.OnClickListener()
- {
- public void onClick(Viewv)
- {
- mIntent=new Intent(TestWiFi. this ,TestBluetooth. class );
-
- finish();
- startActivity(mIntent);
- }
- });
-
- mWifiManager=(WifiManager)getSystemService(WIFI_SERVICE);
- if (mWifiManager.getWifiState()==WifiManager.WIFI_STATE_ENABLED)
- {
- mWifiState=1 ;
-
-
-
-
-
- mChangeState.setText(R.string.test_wifi_mess_enter_wifisetting);
- }
- else if (mWifiManager.getWifiState()==WifiManager.WIFI_STATE_DISABLED)
- {
- mWifiState=0 ;
-
- mChangeState.setText(R.string.test_wifi_mess_enter_wifisetting);
- }
- else
- {
- Log.e(TAG,"WifiState=" +mWifiManager.getWifiState());
- }
- mChangeState.setOnClickListener(new View.OnClickListener()
- {
- public void onClick(Viewv)
- {
- changeWifiState(mWifiState);
- mWifiState++;
- }
- });
- }
-
- private void changeWifiState( int state)
- {
- Log.e(TAG,"mWifiState=" +state);
- Toast.makeText(this ,R.string.test_wifi_mess_enter_wifisetting,Toast.LENGTH_LONG).show();
-
- startActivity(new Intent(Settings.ACTION_WIFI_SETTINGS));
- switch (state% 2 )
- {
- case 0 :
- {
- new Thread()
- {
- public void run()
- {
- Log.e(TAG,"setWifiEnabled(true)" );
- mWifiManager.setWifiEnabled(true );
- }
- }.start();
-
-
-
-
- while ((mWifiManager.getWifiState()==WifiManager.WIFI_STATE_ENABLING)||
- (mWifiManager.getWifiState()==WifiManager.WIFI_STATE_ENABLED))
- {
- Toast.makeText(this ,R.string.test_wifi_mess_enable,Toast.LENGTH_LONG).show();
- break ;
- }
-
-
-
-
-
-
-
-
-
- mChangeState.setText(R.string.test_wifi_mess_enter_wifisetting);
- break ;
- }
- case 1 :
- {
- new Thread()
- {
- public void run()
- {
- Log.e(TAG,"setWifiEnabled(false)" );
- mWifiManager.setWifiEnabled(false );
- }
- }.start();
-
- mChangeState.setText(R.string.test_wifi_mess_enter_wifisetting);
-
-
-
-
- while ((mWifiManager.getWifiState()==WifiManager.WIFI_STATE_DISABLING)||
- (mWifiManager.getWifiState()==WifiManager.WIFI_STATE_DISABLED))
- {
- Toast.makeText(this ,R.string.test_wifi_mess_disable,Toast.LENGTH_LONG).show();
- break ;
- }
- break ;
- }
- default :
- Log.e(TAG,"Wifistateerror!" );
- Toast.makeText(this ,R.string.test_wifi_mess_error,Toast.LENGTH_LONG).show();
- break ;
- }
- }
- }
Wifi测试XML:
- <?xmlversion= "1.0" encoding= "utf-8" ?>
- <LinearLayoutxmlns:android="http://schemas.android.com/apk/res/android"
- android:layout_width="fill_parent"
- android:layout_height="fill_parent"
- android:background="#383838"
- android:orientation="vertical"
- android:gravity="center" >
-
- <LinearLayout
- android:layout_width="fill_parent"
- android:layout_height="wrap_content"
- android:layout_weight="1"
- android:orientation="vertical"
- android:gravity="center" >
-
- <TextView
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:textSize="20sp"
- android:text="@string/test_wifi_mess" />
-
- </LinearLayout>
-
- <LinearLayout
- android:orientation="horizontal"
- android:layout_width="fill_parent"
- android:layout_height="wrap_content"
- android:layout_marginTop="5dp"
- android:gravity="center" >
-
- <Buttonandroid:id="@+id/but_return"
- android:layout_width="200dp"
- android:layout_height="wrap_content"
- android:text="@string/but_return" />
-
- <Buttonandroid:id="@+id/but_changestate"
- android:layout_width="200dp"
- android:layout_height="wrap_content"
- android:text="@string/but_wifi_close" />
-
- <Buttonandroid:id="@+id/but_next"
- android:layout_width="200dp"
- android:layout_height="wrap_content"
- android:text="@string/but_next" />
- </LinearLayout>
- </LinearLayout>
5.Bluetooth测试代码:
- packagecom.android.factorytest;
-
- importandroid.app.Activity;
- importandroid.bluetooth.BluetoothAdapter;
- importandroid.content.BroadcastReceiver;
- importandroid.content.Context;
- importandroid.content.Intent;
- importandroid.content.IntentFilter;
- importandroid.graphics.Color;
- importandroid.os.Bundle;
- importandroid.provider.Settings;
- importandroid.util.Log;
- importandroid.view.View;
- importandroid.widget.Button;
- importandroid.widget.TextView;
- importandroid.widget.Toast;
-
- public class TestBluetoothextendsActivity
- {
- private static finalStringTAG= "TestBluetooth" ;
- private TextViewmBluetoothstate= null ;
- private ButtonmReturn= null ;
- private ButtonmChangeState= null ;
- private ButtonmNext= null ;
- private IntentmIntent= null ;
- private BluetoothAdaptermBluetooth= null ;
- private int mBluetoothState=-1;
-
- @Override
- protected void onCreate(BundlesavedInstanceState)
- {
- super.onCreate(savedInstanceState);
- setContentView(R.layout.test_bluetooth);
- initView();
- }
-
- private void initView()
- {
- mReturn=(Button)findViewById(R.id.but_return);
- mNext=(Button)findViewById(R.id.but_next);
- mChangeState=(Button)findViewById(R.id.but_changestate);
- mBluetoothstate=(TextView)findViewById(R.id.bluetooth_state);
-
- if (mChangeState== null )
- Log.e(TAG,"mChangeStateisnull" );
-
- mReturn.setOnClickListener(new View.OnClickListener()
- {
- public void onClick(Viewv)
- {
- mIntent=new Intent(TestBluetooth. this ,MainActivity. class );
- startActivity(mIntent);
- }
- });
-
- mNext.setOnClickListener(new View.OnClickListener()
- {
- public void onClick(Viewv)
- {
- mIntent=new Intent(TestBluetooth. this ,TestColor. class );
- finish();
- startActivity(mIntent);
- }
- });
-
- mBluetooth=BluetoothAdapter.getDefaultAdapter();
- if ( null ==mBluetooth)
- {
- mBluetoothstate.setText("NoBluetoothDevice" );
- mBluetoothstate.setTextColor(Color.RED);
- }
- if (mBluetooth.isEnabled())
- {
- mBluetoothState=1;
- mChangeState.setText(R.string .but_bluetooth_close);
- }
- else if (!mBluetooth.isEnabled())
- {
- mBluetoothState=0;
- mChangeState.setText(R.string .but_bluetooth_open);
- }
- else
- {
- Log.e(TAG,"BluetoothState=" );
- }
- mChangeState.setOnClickListener(new View.OnClickListener()
- {
- public void onClick(Viewv)
- {
- startActivity(new Intent(Settings.ACTION_BLUETOOTH_SETTINGS));
- changeBluetoothState(mBluetoothState);
- mBluetoothState++;
- }
- });
- }
-
- private void changeBluetoothState( int state)
- {
- Log.e(TAG,"mBluetoothState=" +state);
- switch (state%2)
- {
- case 0:
- {
- startBluetooth();
- Toast.makeText(this ,R. string .test_bluetooth_mess_state_changed,Toast.LENGTH_LONG).show();
- mChangeState.setText(R.string .but_bluetooth_close);
- break ;
- }
- case 1:
- {
- stopBluetooth();
- Toast.makeText(this ,R. string .test_bluetooth_mess_state_changed,Toast.LENGTH_LONG).show();
- mChangeState.setText(R.string .but_bluetooth_open);
- break ;
- }
- default :
- Log.e(TAG,"Wifistateerror!" );
- Toast.makeText(this ,R. string .test_bluetooth_mess_error,Toast.LENGTH_LONG).show();
- break ;
- }
- }
-
- private void startBluetooth()
- {
- mBluetoothstate=(TextView)findViewById(R.id.bluetooth_state);
- mBluetooth=BluetoothAdapter.getDefaultAdapter();
- if ( null ==mBluetooth)
- {
- mBluetoothstate.setText("NoBluetoothDevice" );
- mBluetoothstate.setTextColor(Color.RED);
- }
- BroadcastReceiverBluetoothState=new BroadcastReceiver()
- {
-
- @Override
- public void onReceive(Contextcontext,Intentintent)
- {
-
- StringstateExtra=BluetoothAdapter.EXTRA_STATE;
- int state=intent.getIntExtra(stateExtra,-1);
-
- Stringtt="" ;
- switch (state)
- {
- case (BluetoothAdapter.STATE_TURNING_ON):
- {
- tt="Bluetoothturningon" ;
- break ;
- }
- case (BluetoothAdapter.STATE_ON):
- {
- tt="Bluetoothon" ;
- unregisterReceiver(this );
- break ;
- }
- case (BluetoothAdapter.STATE_TURNING_OFF):
- {
- tt="Bluetoothturningoff" ;
- break ;
- }
- case (BluetoothAdapter.STATE_OFF):
- {
- tt="Bluetoothoff" ;
- break ;
- }
- default :
- tt="UnkownBluetoothstate!" ;
- break ;
- }
-
- mBluetoothstate.setText(tt);
- }
- };
- if (!mBluetooth.isEnabled())
- {
- StringactionStateChanged=BluetoothAdapter.ACTION_LOCAL_NAME_CHANGED;
-
- registerReceiver(BluetoothState,new IntentFilter(actionStateChanged));
-
- mBluetooth.enable();
- }
- }
- private void stopBluetooth()
- {
- mBluetoothstate=(TextView)findViewById(R.id.bluetooth_state);
- mBluetooth=BluetoothAdapter.getDefaultAdapter();
- if ( null ==mBluetooth)
- {
- mBluetoothstate.setText("NoBluetoothDevice" );
- mBluetoothstate.setTextColor(Color.RED);
- }
- BroadcastReceiverBluetoothState=new BroadcastReceiver()
- {
-
- @Override
- public void onReceive(Contextcontext,Intentintent)
- {
-
- StringstateExtra=BluetoothAdapter.EXTRA_STATE;
- int state=intent.getIntExtra(stateExtra,-1);
-
- Stringtt="UnkownBluetooth" ;
- switch (state)
- {
- case (BluetoothAdapter.STATE_TURNING_ON):
- {
- tt="Bluetoothturningon" ;
- break ;
- }
- case (BluetoothAdapter.STATE_ON):
- {
- tt="Bluetoothon" ;
- unregisterReceiver(this );
- break ;
- }
- case (BluetoothAdapter.STATE_TURNING_OFF):
- {
- tt="Bluetoothturningoff" ;
- break ;
- }
- case (BluetoothAdapter.STATE_OFF):
- {
- tt="Bluetoothoff" ;
- break ;
- }
- default :
- tt="UnkownBluetoothstate!" ;
- break ;
- }
-
- mBluetoothstate.setText(tt);
- }
- };
- if (mBluetooth.isEnabled())
- {
- StringactionStateChanged=BluetoothAdapter.ACTION_LOCAL_NAME_CHANGED;
- registerReceiver(BluetoothState,new IntentFilter(actionStateChanged));
- mBluetooth.disable();
- }
-
- }
- }
Bluetooth测试Xml:
- <?xmlversion= "1.0" encoding= "utf-8" ?>
- <LinearLayoutxmlns:android="http://schemas.android.com/apk/res/android"
- android:layout_width="fill_parent"
- android:layout_height="fill_parent"
- android:background="#383838"
- android:orientation="vertical"
- android:gravity="center" >
-
- <LinearLayout
- android:layout_width="fill_parent"
- android:layout_height="wrap_content"
- android:layout_weight="1"
- android:orientation="vertical"
- android:gravity="center" >
-
- <TextView
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:textSize="20sp"
- android:text="@string/test_bluetooth_mess" />
-
- <TextView
- android:id="@+id/bluetooth_state"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:textSize="20sp" />
-
- </LinearLayout>
-
- <LinearLayout
- android:orientation="horizontal"
- android:layout_width="fill_parent"
- android:layout_height="wrap_content"
- android:layout_marginTop="5dp"
- android:gravity="center" >
-
- <Buttonandroid:id="@+id/but_return"
- android:layout_width="200dp"
- android:layout_height="wrap_content"
- android:text="@string/but_return" />
-
- <Buttonandroid:id="@+id/but_changestate"
- android:layout_width="200dp"
- android:layout_height="wrap_content"
- android:text="@string/but_bluetooth_close" />
-
- <Buttonandroid:id="@+id/but_next"
- android:layout_width="200dp"
- android:layout_height="wrap_content"
- android:text="@string/but_next" />
- </LinearLayout>
- </LinearLayout>
6.MainActivity代码:
- packagecom.android.factorytest;
-
- importandroid.app.Activity;
- importandroid.content.Intent;
- importandroid.os.Bundle;
- importandroid.view.View;
- importandroid.widget.Button;
-
- public class MainActivityextendsActivity
- {
- private ButtonmTestColor= null ;
- private ButtonmTestSd= null ;
- private ButtonmTestCamera= null ;
- private ButtonmTestWiFi= null ;
- private ButtonmTestBluetooth= null ;
-
- private IntentmIntent= null ;
-
- @Override
- public void onCreate(BundlesavedInstanceState)
- {
- super.onCreate(savedInstanceState);
- setContentView(R.layout.main);
- initButton();
- }
-
-
- private void initButton()
- {
- mTestColor=(Button)findViewById(R.id.test_color);
- mTestSd=(Button)findViewById(R.id.test_sd);
- mTestCamera=(Button)findViewById(R.id.test_camera);
- mTestWiFi=(Button)findViewById(R.id.test_wifi);
- mTestBluetooth=(Button)findViewById(R.id.test_bluetooth);
-
- mTestColor.setOnClickListener(new View.OnClickListener()
- {
- @Override
- public void onClick(Viewv)
- {
- mIntent=new Intent(MainActivity. this ,TestColor. class );
-
- finish();
- startActivity(mIntent);
- }
- });
-
- mTestSd.setOnClickListener(new View.OnClickListener()
- {
- @Override
- public void onClick(Viewv)
- {
- mIntent=new Intent(MainActivity. this ,TestSd. class );
-
- finish();
- startActivity(mIntent);
- }
- });
- mTestCamera.setOnClickListener(new View.OnClickListener()
- {
- @Override
- public void onClick(Viewv)
- {
- mIntent=new Intent(MainActivity. this ,TestCamera. class );
-
- finish();
- startActivity(mIntent);
- }
- });
- mTestWiFi.setOnClickListener(new View.OnClickListener()
- {
- @Override
- public void onClick(Viewv)
- {
- mIntent=new Intent(MainActivity. this ,TestWiFi. class );
-
- finish();
- startActivity(mIntent);
- }
- });
- mTestBluetooth.setOnClickListener(new View.OnClickListener()
- {
- @Override
- public void onClick(Viewv)
- {
- mIntent=new Intent(MainActivity. this ,TestBluetooth. class );
-
- finish();
- startActivity(mIntent);
- }
- });
- }
- }
main XML:
- <?xmlversion= "1.0" encoding= "utf-8" ?>
- <LinearLayoutxmlns:android="http://schemas.android.com/apk/res/android"
- android:orientation="vertical"
- android:layout_width="fill_parent"
- android:layout_height="fill_parent"
- android:background="#383838"
- android:gravity="center"
- >
- <TextView
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:layout_marginTop="20dp"
- android:layout_marginBottom="30dp"
- android:textSize="25dp"
- android:text="@string/app_name"
- />
- <Button
- android:id="@+id/test_color"
- android:layout_width="400dp"
- android:layout_height="wrap_content"
- android:layout_marginBottom="20dp"
- android:text="@string/but_test_color"
- />
- <Button
- android:id="@+id/test_sd"
- android:layout_width="400dp"
- android:layout_height="wrap_content"
- android:layout_marginBottom="20dp"
- android:text="@string/but_test_sd"
- />
- <Button
- android:id="@+id/test_camera"
- android:layout_width="400dp"
- android:layout_height="wrap_content"
- android:layout_marginBottom="20dp"
- android:text="@string/but_test_camera"
- />
- <Button
- android:id="@+id/test_wifi"
- android:layout_width="400dp"
- android:layout_height="wrap_content"
- android:layout_marginBottom="20dp"
- android:text="@string/but_test_wifi"
- />
- <Button
- android:id="@+id/test_bluetooth"
- android:layout_width="400dp"
- android:layout_height="wrap_content"
- android:layout_marginBottom="20dp"
- android:text="@string/but_test_bluetooth"
- />
- </LinearLayout>
7.资源文件String.Xml:
- <?xmlversion= "1.0" encoding= "utf-8" ?>
- <resources>
- <string name= "hello" >HelloWorld,MainActivity!</ string >
- <string name= "app_name" >工厂测试</ string >
-
- <string name= "but_test_color" >LCD 测试</ string >
- <string name= "but_test_sd" >SD卡测试</ string >
- <string name= "but_test_camera" >Camera 测试</ string >
- <string name= "but_test_wifi" >WiFi测试</ string >
- <string name= "but_test_bluetooth" >Bluetooth 测试</ string >
-
-
- <string name= "but_return" >返回菜单</ string >
- <string name= "but_retest" > 重测本项</ string >
- <string name= "but_changecolor" >改变颜色</ string >
- <string name= "but_next" > 下一项测试</ string >
- <string name= "but_exit" >退出</ string >
- <string name= "but_camera_open" > 打开Camera</ string >
- <string name= "but_camera_exit" >关闭Camera</ string >
- <string name= "but_wifi_open" >打开WiFi</ string >
- <string name= "but_wifi_close" >关闭WiFi</ string >
- <string name= "but_bluetooth_open" >打开Bluetooth</ string >
- <string name= "but_bluetooth_close" >关闭Bluetooth</ string >
-
-
-
- <string name= "test_sd_mess1" >SD 卡已经插入!</ string >
- <string name= "test_sd_mess2" >SD卡已经拔出!</ string >
- <string name= "test_sd_mess3" >在SD卡中创建文件成功!</ string >
- <string name= "test_sd_mess4" >从SD卡中删除文件成功!</ string >
- <string name= "test_sd_mess5" >在SD卡中创建文件失败!</ string >
- <string name= "test_sd_mess6" >从SD卡中删除文件失败!</ string >
-
- <string name= "test_color_mess" > 请点击“改变颜色”,显示是否正常!</ string >
- <string name= "test_camera_mess" >请点击“打开Camera”,测试 Camera是否正常!</ string >
- <string name= "test_wifi_mess" >请点击“打开WiFi/关闭WiFi”,是否有正 确的WiFi信息!</ string >
- <string name= "test_wifi_mess_enable" >WiFi打开成功!</ string >
- <string name= "test_wifi_mess_disable" >WiFi关闭成功!</ string >
- <string name= "test_wifi_mess_state_changed" >WiFi状态改 变!</ string >
- <string name= "test_wifi_mess_enter_wifisetting" >进入 WiFi设置界面</ string >
- <string name= "test_wifi_mess_error" >未知的WiFi状态!</ string >
- <string name= "test_bluetooth_mess" >请点击“打开Bluetooth/关闭 Bluetooth”,是否有正确的Bluetooth信息!</ string >
- <string name= "test_bluetooth_mess_state_changed" >Bluetooth 状态改变!</ string >
- <string name= "test_bluetooth_mess_error" >未知的Bluetooth 状态!</ string >
-
- </resources>