Answer the question
In order to leave comments, you need to log in
What should I add to the code so that after entering the site it displays only text lines?
package ru.startandroid.develop.p0321simplebrowser;
import android.app.Activity;
import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
public class MainActivity extends Activity {
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
(findViewById(R.id.btnWeb)).setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse("http://toster.ru")));
}
});
}
}
Answer the question
In order to leave comments, you need to log in
startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse("http://toster.ru")));
- this code sends the user to choose an application that can process this Uri - in this case, it is 100% likely that it will offer to open the link in the browser. Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question