fork download
  1. /* package whatever; // don't place package name! */
  2.  
  3. import java.util.*;
  4. import java.lang.*;
  5. import java.io.*;
  6.  
  7. import com.topway.swiftplayservice.IPlayAIDLService;
  8. import com.topway.swiftplayservice.PlayParams;
  9.  
  10. /* Name of the class has to be "Main" only if the class is public. */
  11. public class MainActivity extends AppCompatActivity {
  12.  
  13. private Button btn1 ;
  14. //private PlayParams playParams;
  15. private IPlayAIDLService tService;
  16. private ServiceConnection connection = new ServiceConnection()
  17. {
  18. public void onServiceConnected(ComponentName name, IBinder service)
  19. {
  20. //从远程service中获得AIDL实例化对象
  21. tService = IPlayAIDLService.Stub.asInterface(service);
  22. Toast.makeText(MainActivity.this, "connect", Toast.LENGTH_SHORT).show();
  23. Log.v("hello", "connect");
  24. }
  25. public void onServiceDisconnected(ComponentName name)
  26. {
  27. tService = null;
  28. Toast.makeText(MainActivity.this, "disconnrct", Toast.LENGTH_SHORT).show();
  29. Log.v("hello", "disconnect");
  30. }
  31. };
  32.  
  33. @Override
  34. protected void onCreate(Bundle savedInstanceState) {
  35. super.onCreate(savedInstanceState);
  36. setContentView(R.layout.activity_main);
  37.  
  38.  
  39.  
  40.  
  41.  
  42. btn1 = (Button)findViewById(R.id.button);
  43. btn1.setOnClickListener(new View.OnClickListener() {
  44.  
  45. @Override
  46. public void onClick(View v) {
  47. Intent intent = new Intent(IPlayAIDLService.class.getName());
  48. intent.setPackage("com.topway.swiftplayservice.IPlayAIDLService");
  49. bindService(intent, connection, Context.BIND_AUTO_CREATE);
  50. Log.v("hello", "startService");
  51. startService(intent);
  52.  
  53.  
  54. PlayParams playParams = new PlayParams();
  55. playParams.setFrequency(363);
  56. playParams.setSymbolRate(6875);
  57. playParams.setModulation(64);
  58. playParams.setServiceId(2);
  59. playParams.setCoordinateX(10);
  60. playParams.setCoordinateY(10);
  61. playParams.setPlayWidth(640);
  62. playParams.setPlayHeight(320);
  63. playParams.setSoundTrack(0);
  64. playParams.setStopMode(1);
  65. playParams.setProgramTag("xxx");
  66.  
  67. if(tService == null){
  68. Toast.makeText(MainActivity.this, "tservice = null!!!!!!", Toast.LENGTH_SHORT).show();
  69.  
  70. }
  71. else{
  72. Toast.makeText(MainActivity.this, "tv start now", Toast.LENGTH_SHORT).show();
  73. }
  74.  
  75. //try {
  76.  
  77. //Toast.makeText(MainActivity.this, playParams.getPlayHeight(), Toast.LENGTH_SHORT).show();
  78. // tService.startPlay(playParams);
  79. //} catch (RemoteException e) {
  80. // e.printStackTrace();
  81. //}
  82. }
  83.  
  84.  
  85. });
  86.  
  87.  
  88. }
  89.  
  90. @Override
  91. protected void onDestroy() {
  92. super.onDestroy();
  93. unbindService(connection);
  94. }
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
Main.java:94: error: reached end of file while parsing
    }
     ^
1 error
stdout
Standard output is empty