Good day to all.
Created 2 services, 1st with mediaPlayer and 2nd with webView. Both are spelled out in the manifest:
... <service android:enabled="true" android:name="TestPlayRadio"></service> <service android:enabled="true" android:name="TestWebView"></service> ...
I want that when you press the button, these 2 services are played, the radio is played and the site is called.
public class MainTestActivity extends Activity { @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); this.getWindow().requestFeature(Window.FEATURE_PROGRESS); setContentView(R.layout.activity_main_test); final Button on = (Button) findViewById(R.id.button1); final Button off = (Button) findViewById(R.id.button2); on.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { startService(new Intent(MainTestActivity.this, TestPlayRadio.class)); Log.v(this.getClass().getName(), "Service started."); startService(new Intent(MainTestActivity.this, TestWebView.class)); Log.v(this.getClass().getName(), "Service started."); } }); ...
MediaPlayer - plays. But WebView, even if without a radio, well, it doesn’t appear in the specified window ... Maybe I wrote something wrong?
public class TestWebView extends Service { @Override public IBinder onBind(Intent arg0) { // TODO Auto-generated method stub return null; } public void view(Activity v) { WebView wv; wv = (WebView) v.findViewById(R.id.webView2); wv.loadUrl("http://www..."); WebSettings ws = wv.getSettings(); ws.setSavePassword(true); ws.setJavaScriptEnabled(true); } }
Thank you in advance.