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.

    1 answer 1

    Add rights to the Internet in the manifest

     <manifest xlmns:android...> ... <uses-permission android:name="android.permission.INTERNET"></uses-permission> </manifest> 
    • Permission to access the Internet is 8 * (is some other method practiced by the MB? - HA3IK
    • practiced - bring music to a separate stream - Gorets
    • Just check the address that you load, maybe there is no such site - Gorets
    • Ie, music in a separate stream? She and so as a separate service. And the site works 100% In Maine, there is still 1n webView - working, can they somehow conflict? - HA3IK
    • Separate service is not a separate thread, it is UI-thread - Gorets