Z
Z
Zirbi2015-01-22 21:44:26
Java
Zirbi, 2015-01-22 21:44:26

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")));
      }
    });
  }
}

Goes to the site Toaster and displays only strings, questions, tags, etc. etc. Possible to do?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
I
IceJOKER, 2015-01-23
@Zirbi

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.
If you do not want to open the site completely, but only a certain part of it, then you will first have to download the page, then delete everything unnecessary and then show it in WebView.
Jsoup is a great library for manipulations with html code (it can download, parse, etc.)

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question