Webview Content not using full width - android

I am using a webview to load HTML content in my app.
But text content is not using full width of webview, and it shrinks and wraps.
Below is code I have used:
webView.setInitialScale(1);
webView.getSettings().setJavaScriptEnabled(true);
webView.getSettings().setLoadWithOverviewMode(true);
webView.getSettings().setUseWideViewPort(true);
webView.getSettings().setSupportZoom(true);
webView.getSettings().setDisplayZoomControls(false);
webView.getSettings().setBuiltInZoomControls(true);
webView.setScrollBarStyle(WebView.SCROLLBARS_OUTSIDE_OVERLAY);
webView.setScrollbarFadingEnabled(false);
My HTML content doesn't contains meta tag for viewport.
Here is a Screenshot:
Looking forward for help from you guys.
Below is HTML content:
<p><span style="color:#c0392b"><strong>NYSBA Member: $175</strong></span><br /> </p><p><img alt="" src="https://upload.wikimedia.org/wikipedia/commons/thumb/7/77/Google_Images_2015_logo.svg/1200px-Google_Images_2015_logo.svg.png" style="height:250px; width:600px" /><br /> </p><p><span style="font-size:20px"><strong>Estate Planning and Will Drafting 2018</strong></span><br /> </p><p><strong>Program Description</strong></p><p>This full-day program will highlight current estate planning techniques and the means of implementing such techniques through a discussion of drafting of wills and trusts. Attendees will leave this program knowing how to write a basic will. Discussions will also include trusts for minors, charitable trusts, lifetime giving and planning for those with disabilities, tax implications and planning, digital assets, and ethical considerations.</p><p><strong>Who Should Attend</strong></p><p>Attorneys in the general practice of law, estate and trust planners, elder law attorneys, and those interested in a basic knowledge of taxation as it applies to wills and trusts.</p><p><br /><span style="font-size:14px"><strong>Sponsored by the Committee on Continuing Legal Education, the Trusts & Estates Law Section and</strong></span><br /><img alt="" src="{IMAGE URL}" /><br /> </p><p><strong>Live CLE Program & Webcast </strong></p><p>Tuesday, February 6, 2018 – Syracuse Sheraton University Hotel<br />Tuesday, February 6, 2018 - Long Island – Melville Marriott<br />Wednesday, February 7, 2018 – NYC (live webcast) – CFA Society New York<br />Thursday, February 8, 2018 – Holiday Inn Mt. Kisco<br />Thursday, February 8, 2018 - Classics V Banquet Center Buffalo<br />Friday, February 9, 2018 – New York State Bar Association<br />Friday, February 9, 2018 – RIT Inn & Conference Center</p><p><strong>7.0 MCLE Credits: 6.0 Areas of Professional Practice,1.0 Ethics</strong></p><p><strong><span style="color:#c0392b">NYSBA Member:</span> $175 | <span style="color:#c0392b">Non-Member:</span> $275</strong><br /><strong><span style="color:#c0392b">Section Member:</span> $135</strong></p><p><strong>Agenda Topics</strong></p><ul><li>Estate Planning Overview</li><li>Will Drafting Overview</li><li>Planning with Revocable Trusts</li><li>Lifetime Giving, Minors and Incapacitated Beneficiaries</li><li>Tax Implications and Drafting</li><li>Digital Assets</li><li>Ethical Considerations</li></ul><p><span style="color:#c0392b"><strong>Program Chair</strong></span><br /><strong>Patricia Shevy, Esq., </strong>The Shevy Law Firm, Albany</p><p><span style="color:#c0392b"><strong>Local Program Chairs </strong></span><br /><strong>Jennifer M. Boll, Esq.</strong>, Bond Schoeneck & King, PLLC, Albany <br /><strong>Gail M. Boggio, Esq.,</strong> McCarthy Fingar, LLP, White Plains</p><p><strong><span style="color:#c0392b">Buffalo Program Faculty</span></strong><br /><span style="font-size:14px"><span style="font-family:Arial,Helvetica,sans-serif"><strong>Linda Stravalaci Grear, Esq., </strong>Pfalzgraf Beinhauer Menzies, Buffalo<br /><strong>John F. Leone, Esq., </strong>Gross Shuman, P.C., Buffalo<br /><strong>Kenneth Aaron Grossberg, Esq., </strong>Phillips Lytle LLP, Buffalo<br /><strong>William D. Harrington, Esq</strong>., Brown & Kelly, LLP, Buffalo<br /><strong>Catherine B. Eberl, Esq., </strong>Hodgson Russ LLP, Buffalo<br /><strong>Hon. Barbara Howe, </strong>Retired NY State Judge for Erie County, Buffalo<br /><strong>Dennis P. Cleary, Esq., </strong>Duke Holzman Photiadis & Gresens LLP, Buffalo</span></span></p><p><br />Newly Admitted Attorneys: To receive skills credit, newly admitted attorneys must take accredited transitional CLE courses in traditional live classroom settings that have been approved by the CLE Board for use by newly admitted attorneys. For more information about the CLE Rules, please go to www.nycourts.gov/Attorneys/CLE.</p><p>Out of State Accreditation: This program has also been approved for MCLE credit by the State Bar of California, the Pennsylvania Continuing Legal Education Board and the Board of Continuing Legal Education of the State of New Jersey. If you require MCLE credit in other states, we can provide you a Uniform MCLE Form.</p><p>Partial Credit for Program Segments Not Allowed: Under the New York State Continuing Legal Education Board Regulations and Guidelines, attendees at CLE programs cannot get MCLE credit for a program segment (typically, a lecture or panel, of which there are usually several in a program) unless they are present for the entire segment. Those who arrive late, depart early, or are absent for any portion of the segment WILL NOT receive credit for that program segment.</p><p> </p><p><strong><img alt="{IMAGE_URL}" src="{IMAGE_URL}" /></strong></p><p>Follow NYSBA CLE on Twitter! #NYSBACLE</p><p>Stay informed. Be the first to hear about the latest course offerings.</p><p>To view the full list of Continuing Legal Education Programs, click here.</p><p>If you have any questions about this program, please contact staff attorney Sally Bratten. </p><p> </p><p> </p>

Related

Android WebView Image Too Big

HTML Below does not display properly in Webview. Huge photo and tiny text? How can this be resolved? I have set meta data for viewport and this helps for text but if there is large images the text gets shrunk? below is html in mobile device the text only takes up 1/3 rd of screen.
<html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1.0, user- scalable=yes">
</head>
<body>
<h1>Fox News is getting really good at spotting Ted Cruz’s lies.</h1>
<div class="newbody body parsys"><span>
</span><div class="parbase image slate_image section"><span>
</span><div class=""><span>
</span><figure class="image inline "> <img src_tag_name="src" title="Ted Cruz " alt="Ted Cruz " src="http://www.slate.com/content/dam/slate/articles/news_and_politics/politics/2016/01/160129_pol_ted-cruz_1024.jpg.CROP.promo-xlarge2.jpg"> <figcaption class="caption"><span>Ted Cruz speaks during the Republican presidential debate sponsored by Fox News in Des Moines, Iowa, on Jan. 28, 2016.</span></figcaption> <p class="credit">Jim Watson/Getty Images</p>
</figure><span>
</span></div><span>
</span>
<script>
requirejs(["jquery"], function($) {
if ($(window).width() < 640) {
$(".slate_image figure").width("100%");
}
});
</script>
<span>
</span></div><span>
[![enter image description here][1]][1]</span><div class="text text-1 parbase section"><span>
</span><p>In Thursday night’s Republican presidential debate, moderator Megyn Kelly grilled Sen. Ted Cruz about his role in the Senate’s 2013 fight over immigration reform. As <strong><em>Slate</em></strong> recently explained, that fight is an excellent episode to study if you want to understand Cruz’s peculiar views about truth and deception. By pressing Cruz about discrepancies between what he said then and what he says now, Kelly forced him to show the public, on live television, how he thinks about honesty. It wasn’t pretty.</p><span>
</span></div><span>
</span><section class="about-the-author fancy inline with-head">
<div class="author-bio"><p>Will Saletan writes about politics, science, technology, and other stuff for <b><i>Slate</i></b>. He’s the author of <i><a target="_blank" href="https://rads.stackoverflow.com/amzn/click/com/0520243366" rel="nofollow noreferrer">Bearing Right</a></i>.<i><br></i></p><span>
</span></div>
</section><span> </span><!-- /.about-the-author --><span>
</span><div class="text-2 text parbase section"><span>
</span><p>Kelly showed the debate audience four video clips. In the clips, taken from Cruz’s speeches during the 2013 fight, he earnestly appealed for a compromise that would allow undocumented immigrants to earn legal status—as prescribed by a bill the Senate was considering—but not citizenship. The key to the compromise was an amendment, offered by Cruz, that would have closed the path to citizenship. Cruz now denies that he ever supported legalization. Here’s how he tried to explain the video clips, and what the exchange revealed about him.</p><span>
</span></div><span>
</span><span>
</span><div class="text-3 text parbase section"><span>
</span><p><strong>1. He lies.</strong> Kelly’s first clip, taken from Cruz’s speech in the Senate Judiciary Committee on May 9, 2013, showed him saying, “I don’t want this bill to be voted down.” The second clip, taken from his speech to the committee on May 21, 2013, showed him saying, “If [my] amendment were to pass, the chances of this bill passing into law would increase dramatically.” The third clip, taken from Cruz’s remarks at Princeton University on May 31, 2013, showed him saying: “I believe if the amendments I introduced were adopted, that the bill would pass. And my effort in introducing them was to find a solution that reflected common ground and that fixed the problem.”</p><span>
</span></div><span>
</span><div class="text parbase text-4 section"><span>
</span><p>Cruz, like everyone else at Thursday’s debate, watched these clips as Kelly played them. Each clip showed him pleading for the bill. But in an interview after the debate, he denied that he had done so:</p><span>
</span></div><span>
</span><div class="text parbase text-5 section"><span>
</span><blockquote><strong>Kelly:</strong> [You were] trying to sell it, saying, “I want the bill to pass.”<strong><br>Cruz:</strong> But—no, no. What I said is, “I want <em>immigration reform</em> to pass.”<strong><br>Kelly:</strong> You also said the bill.<strong><br>Cruz:</strong> I didn’t say I want the bill to pass. I promise you.</blockquote><span>
</span></div><span>
</span><div class="text text-6 parbase section"><span>
</span><p>This is the third time in two months that Cruz has tried to hoodwink a Fox News interviewer on this subject. Bret Baier’s rebuke to Cruz on Dec. 16—“You said the bill”—is almost identical to Kelly’s, and Cruz also attempted to put one past Greta Van Susteren on Dec. 18. Last week, Cruz tried to fool ABC’s George Stephanopoulos. Stephanopoulos noted that in an April 2013 CBS interview, Cruz had said “there could be a compromise” on legal status for undocumented immigrants. Cruz told Stephanopoulos that his compromise offer wasn’t about legal status. That’s not true. The question in the 2013 interview was: “What would you do with the 11 million people who are here illegally?” And Cruz’s answer was, “I think there could probably be a compromise on that, if a path to citizenship was taken off the table.”</p><span>
</span></div><span>
</span><div class="text parbase text-7 section"><span>
</span><p><strong>2. He judges his own honesty by technicalities, not by the plain meaning of his words. </strong>During the debate, Kelly told Cruz, “You proposed an amendment. It would have allowed for legalization but not citizenship.” Cruz shook his head in denial. He pointed out that his amendment “didn’t say a word about legalization.” Technically, that’s true: The amendment didn’t use the words <em>allow</em> or <em>legal status</em>. But Cruz did. On May 21, 2013, he told the Judiciary Committee that the bill’s proponents explicitly sought “to provide a legal status for those who are here illegally, to be out of the shadows. This amendment would allow that to happen.” On June 4, 2013, he issued a letter that said his amendment “would have allowed immigrants here illegally to obtain legal status—to come out of the shadows and work legally.” Like Bill Clinton, who famously staked his truthfulness on “the meaning of <em>is</em>,” Cruz now stakes his honesty on a creative reinterpretation of the word <em>allow</em>.</p><span>
</span></div><span>
</span><div class="text parbase text-8 section"><span>
</span><p><strong>3. He’s an actor.</strong> After showing the videos of Cruz’s appeals for compromise, Kelly asked him, “Was that all an act? It was pretty convincing.” In the post-debate interview, she told him: “It just seems weird for the average person to see, like, the acting, when you’re trying to sell it, saying, ‘I want the bill to pass.’ ” Kelly said she didn’t think Cruz was lying in 2016 about his motives in 2013. But in that case, what he said in 2013 was, as, she put it, acting. And acting, in this context, is just a nicer word for lying. As Sen. Rand Paul noted during Thursday’s exchange:</p><span>
</span></div><span>
</span><div class="text parbase text-9 section"><span>
</span><blockquote>I was there, and I saw the [immigration] debate. I saw Ted Cruz say, “We’ll take citizenship off the table, and then the bill will pass, and I’m for the bill.” … What is particularly insulting, though, is that he is the king of saying, “You’re for amnesty.” Everybody’s for amnesty except for Ted Cruz. But it’s a falseness, and that’s an authenticity problem. </blockquote><span>
</span></div><span>
</span><div class="text parbase text-10 section"><span>
</span><p><strong>4. He misleads everyone, not just his enemies. </strong>In the post-debate interview, Kelly noted that in 2013, Cruz had mimicked pro-legalization catchphrases. She told him: “You were talking about people coming ‘out of the shadows.’ It seems like acting.” Cruz told Kelly that he had done this to toy with liberals: “What I often do, particularly when debating Democrats—and I was debating [Sen.] Chuck Schumer there—is use the language of the Democrats, to show their hypocrisy.” Cruz wants conservatives to believe they can trust him because he reserves his deceptions for the left.</p> <span>
</span></div><span>
</span><div class="text-11 text parbase section"><span>
</span><p>But in 2013, Cruz didn’t just put on the act for Democrats. As Sen. Marco Rubio pointed out Thursday, Cruz also dangled the compromise offer in his interview with CBS. One of the clips Kelly played showed Cruz making a similar pitch to his former professor, Robert George, a leading conservative thinker and activist. Cruz also put on his earnest-compromiser act for conservative journalist Byron York. In fact, Cruz’s office requested the interview with York, ostensibly to clear the record. And later, in a June 2013 interview with Rush Limbaugh, Cruz bragged about a poll of Texas Hispanics in which he had floated, and found support for, the idea of granting “work permits that do not allow citizenship”—a proposal that Cruz now claims was just a ruse. When you deceive everyone, including voters and fellow conservatives, how can anyone trust you?</p><span>
</span></div><span>
</span><span>
</span><div class="text-12 text parbase section"><span>
</span><p><strong>5. He refuses to admit having changed his mind.</strong> In Thursday’s debate, Jeb Bush rebuked Rubio for abandoning his support of the 2013 immigration bill. Rubio pleaded, lamely, that he had done so because “the American people”—i.e., Republican voters—turned against the bill. But at least Rubio acknowledged his reversal. What distinguishes Cruz is his refusal to concede that he ever flirted with legalization. As Paul noted Thursday: “I was for legalization. I think, frankly, if you have border security, you can have legalization. So was Ted, but now he says it wasn’t so. That’s not true.” Another candidate on the stage, New Jersey Gov. Chris Christie, made the same point: “It’s perfectly legal in this country to change your mind. But when you’re a governor, you have to admit it. You can’t hide behind parliamentary tricks.”</p><span>
</span></div><span>
</span><div class="text-13 text parbase section"><span>
</span><p>In his closing statement, Cruz put the issue squarely: “The central question in this race is trust.” Indeed it is. Cruz is running for president as the candidate you can believe in, the man who says what he means and does what he says. It’s a good slogan. It’s just not true of Cruz.</p><span>
</span></div><span>
</span><span>
</span></div></body></html>
One solution which is somewhat ok is too set width for images in css style as shown below. The only issue with this solution is that the image's get squeezed into the display. I would rather that user be able to scroll for the larger image. does anyone know how to do this?
String displayHtml = "<html>\n" +
"<head>\n" +
"<style>\n" +
"img {\n" +
" width: 100%;\n" +
"}\n" +
"</style>"+
"<meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0, user-scalable=yes\">\n"+
"</head>\n" +
"<body>\n" +
You had width:100% for the image itself in your solution, but max-width:100% would be better, since you want to avoid blowing up smaller pictures to the full screen width.
Anyway, the solution to get the image to scroll horizontally if it's too wide (rather than cutting it off or shrinking it) is to set its container, the figure, to max-width:100% and to make sure it overflows if necessary.
figure.image.inline {
max-width:100%;
overflow-x:auto;
}
<h1>Fox News is getting really good at spotting Ted Cruz’s lies.</h1>
<div class="newbody body parsys">
<div class="parbase image slate_image section">
<div class="">
<figure class="image inline ">
<img src_tag_name="src" title="Ted Cruz " alt="Ted Cruz " src="http://www.slate.com/content/dam/slate/articles/news_and_politics/politics/2016/01/160129_pol_ted-cruz_1024.jpg.CROP.promo-xlarge2.jpg">
<figcaption class="caption"><span>Ted Cruz speaks during the Republican presidential debate sponsored by Fox News in Des Moines, Iowa, on Jan. 28, 2016.</span>
</figcaption>
<p class="credit">Jim Watson/Getty Images</p>
</figure>
</div>
</div>
<div class="text text-1 parbase section">
<p>In Thursday night’s Republican presidential debate, moderator Megyn Kelly grilled Sen. Ted Cruz about his role in the Senate’s 2013 fight over immigration reform. As <strong><em>Slate</em></strong> recently explained, that fight is an excellent episode to study if you want to understand Cruz’s peculiar views about truth and deception. By pressing Cruz about discrepancies between what he said then and what he says now, Kelly forced him to show the public, on live television, how he thinks about honesty. It wasn’t pretty.</p>
</div>
<section class="about-the-author fancy inline with-head">
<div class="author-bio">
<p>Will Saletan writes about politics, science, technology, and other stuff for <b><i>Slate</i></b>. He’s the author of <i><a target="_blank" href="http://rads.stackoverflow.com/amzn/click/0520243366">Bearing Right</a></i>.<i><br></i>
</p>
</div>
</section>
<!-- /.about-the-author -->
<div class="text-2 text parbase section">
<p>Kelly showed the debate audience four video clips. In the clips, taken from Cruz’s speeches during the 2013 fight, he earnestly appealed for a compromise that would allow undocumented immigrants to earn legal status—as prescribed by a bill the Senate was considering—but not citizenship. The key to the compromise was an amendment, offered by Cruz, that would have closed the path to citizenship. Cruz now denies that he ever supported legalization. Here’s how he tried to explain the video clips, and what the exchange revealed about him.</p>
</div>
<div class="text-3 text parbase section">
<p><strong>1. He lies.</strong> Kelly’s first clip, taken from Cruz’s speech in the Senate Judiciary Committee on May 9, 2013, showed him saying, “I don’t want this bill to be voted down.” The second clip, taken from his speech to the committee on May 21, 2013, showed him saying, “If [my] amendment were to pass, the chances of this bill passing into law would increase dramatically.” The third clip, taken from Cruz’s remarks at Princeton University on May 31, 2013, showed him saying: “I believe if the amendments I introduced were adopted, that the bill would pass. And my effort in introducing them was to find a solution that reflected common ground and that fixed the problem.”</p>
</div>
<div class="text-13 text parbase section">
<p>In his closing statement, Cruz put the issue squarely: “The central question in this race is trust.” Indeed it is. Cruz is running for president as the candidate you can believe in, the man who says what he means and does what he says. It’s a good slogan. It’s just not true of Cruz.</p>
</div>
</div>
(Note that I shortened the html a bit; it's the CSS we're interested in.)

How to decode special characters from JSON. (e.g. " ' " to " ' " )

In my CMS I have json responses for different data I insert,and I get them in JSON format.
ie.
[{"id":"7","image":"vangal.jpe","name":"Louis Van Gaal","nationality":"Dutch","managed_from":"14 July 2014",
"article":"Louis van Gaal arrived at Manchester United with an outstanding record of success first in his native Netherlands and subsequently at some of the biggest clubs in the world.\r\n\r\nAs a manager he has won league titles in three different countries, guided a youthful Ajax side to UEFA Champions League glory, as well as lifting the UEFA Cup. His second stint in charge of the Dutch national team ended with the Netherlands making the semi-finals of the 2014 World Cup, a run which included a magnificent 5-1 win over holders Spain.\r\n\r\nBorn Aloysius Paulus Maria van Gaal in Amsterdam on 8 August 1951, he joined Ajax aged 20 and while he never played for the great Dutch club's first team, the influence of the time he spent immersed in its culture of Total Football has never left him.\r\n\r\nHe cut his teeth at professional level after moving over the border to Royal Antwerp in Belgium, but following four years there he returned to Holland to complete his playing career, briefly at Telstar, then for eight years at Sparta Rotterdam before retiring after a short stint at AZ.\r\n\r\nVan Gaal remained at AZ to begin a coaching and management career where the characteristics of fluent passing, talented youngsters being given a chance and canny tactics through a high attention to detail have remained to great effect at the highest level of the global game.\r\n\r\nAfter leaving AZ, van Gaal's coaching education continued under the legendary Leo Beenhakker at Ajax, who he succeeded as first team boss in 1991. The club's fortunes had dipped since the golden era of the 1970s, but under van Gaal Ajax secured three consecutive Eredivisie titles and the UEFA Cup. But more importantly they delivered European Cup success, in its new guise as the Champions League, returning the trophy to the club for the first time in over 20 years.\r\n\r\nA side containing future United star Edwin van der Sar, the De Boer brothers, Frank Rijkaard, Edgar Davids, Clarence Seedorf, Marc Overmars and Patrick Kluivert overcame AC Milan in Vienna, and after this success it was inevitable that van Gaal would be linked with some of the biggest clubs in Europe. He eventually succeeded Bobby Robson at Barcelona in 1997, and after inheriting a set-up that included Jose Mourinho on the coaching staff, his new side won La Liga in his first season in charge, retaining the title the following year.\r\n\r\nWhile at Barca, van Gaal had the first of four meetings with United in the Champions League, handing an 18-year-old Xavi his European debut during the 3-3 draw at Old Trafford. The first goalscorer that night? Ryan Giggs.\r\n\r\nVan Gaal then had spells in charge of the Dutch national side and the Catalan giants again, and following a brief time at Ajax as technical director he returned to AZ and guided them to the Dutch title in 2009.\r\n\r\nThis dramatic success led to Bayern Munich recruiting him, and van Gaal became the first Dutch manager to win the Bundesliga, claiming a league title in his debut season in charge at a club for the second time β something Reds fans would love to see him do again at United.\r\n\r\nA second Champions League final for van Gaal, in 2010, ended in defeat to an Inter Milan side managed by former assistant Mourinho, and after leaving Bayern he took up the reins of the Dutch national side once again and successfully steered them through to the 2014 World Cup finals. The Netherlands won the third place play-off with a 3-0 win over hosts Brazil, but just a few days later van Gaal was officially unveiled in Manchester to begin the next chapter of an already stellar career.\r\n\r\nHis announcement as the next United manager, the club's first continental coach to take charge of the first team, arrived on 19 May 2014. Ryan Giggs was announced as his assistant manager, while assistant coaches Albert Stuivenberg, Frans Hoek (specialising with goalkeepers) and Marcel Bout (focusing on opposition scouting), training physiologist Jos van Dijk and performance analyst Max Reckers also joined a new-look backroom team at Old Trafford.\r\n\r\nVan Gaal, who eventually started work at United on 14 July 2014, said: "It was always a wish for me to work in the Premier League. To work as a manager for Manchester United, the biggest club in the world, makes me very proud. I have managed in games at Old Trafford before and know what an incredible arena it is and how passionate and knowledgeable the fans are. This club has big ambitions; I too have big ambitions. Together I'm sure we will make history.""}]
In this case I have a simple JSON Array with some text in it. However,I can't read some characters from that text like the ' one and "". I hope you can see that from the following screenshot.
How can I take out characters 's? It looks really ugly and hard to read.
Τhanks.
Use like the following
myTextView.setText(Html.fromHtml("ur text here"));
Provided JSON is incorrect, try to parse it using http://jsonlint.com/ first.
If I understand you correctly, you have some issues with ' and ". Try to use \' and \" instead.
Thank you for the replies! Problem is fixed thanks to the user called lal.
myTextView.setText(Html.fromHtml("ur text here"));

How can I get just the Video to play on Android?

I want to play just the video from youtube. but this code i use show more detail just like I open it from the website. how can I get ride of the detail like suggested video, comments, info.... I just want to have the Video on the app. Any help would be appreciate :) thanks
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
WebView webView1 =(WebView)findViewById(R.id.webView1);
webView1.getSettings().setAllowFileAccess(true);
webView1.getSettings().setLoadWithOverviewMode(false);
webView1.getSettings().setUseWideViewPort(false);
webView1.getSettings().setJavaScriptCanOpenWindowsAutomatically(false);
webView1.getSettings().setSupportMultipleWindows(false);
webView1.setWebChromeClient(new WebChromeClient());
webView1.setWebViewClient(new WebViewClient());
webView1.setWebViewClient(new Callback());
webView1.getSettings().setJavaScriptEnabled(true);
webView1.getSettings().setPluginState(PluginState.ON);
String video_path = "http://www.youtube.com/watch?v=jtrltr-uIvw";
Uri uri = Uri.parse(video_path);
uri = Uri.parse("vnd.youtube:" + uri.getQueryParameter("v"));
Intent intent = new Intent(Intent.ACTION_VIEW, uri);
startActivity(intent);
}
Use VideoView instead of WebView.
VideoView video = (VideoView)findViewById(R.id.video);
video.setVideoURI(Uri.parse("insert rtsp here"));
video.start();
I had this problem some time ago. The trick is to determine the actual URL of the video and then use MediaPlayer to play the video.
Let's say, you're after this video: http://www.youtube.com/watch?v=ou87i6Oq5M0 - note the video tag: ou87i6Oq5M0. To get the URL of the actual video stream, you can retrieve this resource: http://gdata.youtube.com/feeds/api/videos/ou87i6Oq5M0?v=2 - this will return the metadata of the youtube video, including the actual URL of the stream:
<?xml version='1.0' encoding='UTF-8'?><entry xmlns='http://www.w3.org/2005/Atom' xmlns:media='http://search.yahoo.com/mrss/' xmlns:gd='http://schemas.google.com/g/2005' xmlns:yt='http://gdata.youtube.com/schemas/2007' gd:etag='W/"CkUCSH47eCp7I2A9Wh5WF00."'><id>tag:youtube.com,2008:video:ou87i6Oq5M0</id><published>2013-09-01T11:21:22.000Z</published><updated>2013-11-29T04:44:29.000Z</updated><category scheme='http://schemas.google.com/g/2005#kind' term='http://gdata.youtube.com/schemas/2007#video'/><category scheme='http://gdata.youtube.com/schemas/2007/categories.cat' term='News' label='News & Politics'/><title>WORLDS FASTEST propellar driven AIRCRAFT Russian Tu 95MC Nuclear Bomber</title><content type='application/x-shockwave-flash' src='http://www.youtube.com/v/ou87i6Oq5M0?version=3&f=videos&app=youtube_gdata'/><link rel='http://gdata.youtube.com/schemas/2007#video.in-response-to' type='application/atom+xml' href='http://gdata.youtube.com/feeds/api/videos/hdFswfC_Egk?v=2'/><link rel='
alternate' type='text/html' href='http://www.youtube.com/watch?v=ou87i6Oq5M0&feature=youtube_gdata'/><link rel='http://gdata.youtube.com/schemas/2007#video.related' type='application/atom+xml' href='http://gdata.youtube.com/feeds/api/videos/ou87i6Oq5M0/related?v=2'/><link rel='http://gdata.youtube.com/schemas/2007#mobile' type='text/html' href='http://m.youtube.com/details?v=ou87i6Oq5M0'/><link rel='http://gdata.youtube.com/schemas/2007#uploader' type='application/atom+xml' href='http://gdata.youtube.com/feeds/api/users/D8bmW4A7eYzHrW7sXwsqwQ?v=2'/><link rel='self' type='application/atom+xml' href='http://gdata.youtube.com/feeds/api/videos/ou87i6Oq5M0?v=2'/><author><name>ArmedForcesUpdate</name><uri>http://gdata.youtube.com/feeds/api/users/ArmedForcesUpdate</uri><yt:userId>D8bmW4A7eYzHrW7sXwsqwQ</yt:userId></author><yt:accessControl action='comment' permission='allowed'/><yt:accessControl action='commentVote' permission='allowed'/><yt:accessControl action='videoRespond' permission='moderated'/><yt:
accessControl action='rate' permission='allowed'/><yt:accessControl action='embed' permission='allowed'/><yt:accessControl action='list' permission='allowed'/><yt:accessControl action='autoPlay' permission='allowed'/><yt:accessControl action='syndicate' permission='allowed'/><gd:comments><gd:feedLink rel='http://gdata.youtube.com/schemas/2007#comments' href='http://gdata.youtube.com/feeds/api/videos/ou87i6Oq5M0/comments?v=2' countHint='45'/></gd:comments><media:group><media:category label='News & Politics' scheme='http://gdata.youtube.com/schemas/2007/categories.cat'>News</media:category><media:content url='http://www.youtube.com/v/ou87i6Oq5M0?version=3&f=videos&app=youtube_gdata' type='application/x-shockwave-flash' medium='video' isDefault='true' expression='full' duration='165' yt:format='5'/><media:content url='rtsp://r8---sn-5hn7su7l.c.youtube.com/CiILENy73wIaGQnN5KqjizvvohMYDSANFEgGUgZ2aWRlb3MM/0/0/0/video.3gp' type='video/3gpp' medium='video' expression='full' duration='165' yt:format='1'/
><media:content url='rtsp://r8---sn-5hn7su7l.c.youtube.com/CiILENy73wIaGQnN5KqjizvvohMYESARFEgGUgZ2aWRlb3MM/0/0/0/video.3gp' type='video/3gpp' medium='video' expression='full' duration='165' yt:format='6'/><media:credit role='uploader' scheme='urn:youtube' yt:display='ArmedForcesUpdate' yt:type='partner'>armedforcesupdate</media:credit><media:description type='plain'>Russian Aircraft The Tupolev Tu-95 (Russian: Туполев Ту--95; NATO reporting name: Bear) is a large, four-engine turboprop-powered strategic bomber and missile platform. First flown in 1952, the Tu-95 entered service with the Soviet Union in 1956 and is expected to serve the Russian Air Force until at least 2040.[1] A naval development of the bomber is designated Tu-142.
The aircraft has four Kuznetsov NK-12 engines, developed by the Kuznetsov Design Bureau with participation of Ferdinand Brandner and other captured German engineers, each driving contra-rotating propellers. An airliner variant Tu-114 holds the record as the world's fastest propeller-driven aircraft. Some experimental aircraft were designed for theoretically higher speeds, but none attained or registered them. It also remains the only turboprop-powered strategic bomber in operational use. Its distinctively swept-back wings are at 35°, a very sharp angle by the standards of propeller-driven aircraft, and justified by its operating speeds and altitudes. Its blades, which rotate faster than the speed of sound, according to one media source, make it arguably the noisiest military aircraft on earth,[2] with only the experimental 1950s era Republic XF-84H "Thunderscreech" turboprop powered American fighter design as a likely rival.[citation needed] It was reportedly so loud that the underwater Hydrophones of
submerged submarines and SOSUS could detect it.
Russia Listeni/ˈrʌʃə/ or /ˈrʊʃə/ (Russian: Россия, tr. Rossiya, IPA: [rɐˈsʲijə] ( listen)), also officially known as the Russian Federation[10] (Russian: Российская Федерация, tr. Rossiyskaya Federatsiya, IPA: [rɐˈsʲijskəjə fʲɪdʲɪˈrat͡sɨjə] ( listen)), is a country in northern Eurasia.[11] It is a federal semi-presidential republic, comprising 83 federal subjects. From northwest to southeast, Russia shares land borders with Norway, Finland, Estonia, Latvia, Lithuania and Poland (both with Kaliningrad Oblast), Belarus, Ukraine, Georgia, Azerbaijan, Kazakhstan, China, Mongolia, and North Korea. It shares maritime borders with Japan by the Sea of Okhotsk and the US state of Alaska across the Bering Strait. At 17,075,400 square kilometres (6,592,800 sq mi), Russia is the largest country in the world, covering more than one-eighth of the Earth's inhabited land area. Russia is also the world's ninth most populous nation with 143 million people as of 2012.[12] Extending across the entirety of northern Asia and much
of Europe, Russia spans nine time zones and incorporates a wide range of environments and landforms.
An aircraft is a machine that is able to fly by gaining support from the air, or, in general, the atmosphere of a planet. It counters the force of gravity by using either static lift or by using the dynamic lift of an airfoil,[1] or in a few cases the downward thrust from jet engines.
The human activity that surrounds aircraft is called aviation. Crewed aircraft are flown by an onboard pilot, but unmanned aerial vehicles may be remotely controlled or self-controlled by onboard computers. Aircraft may be classified by different criteria, such as lift type, propulsion, usage and others.
The Russian Air Force (Russian: Военно-воздушные cилы России, tr. Voyenno-Vozdushnye Sily Rossii) is the aerial warfare service branch of the Armed Forces of the Russian Federation. It is currently under the command of Lieutenant General Viktor Bondarev. The Russian Navy has its own air arm, the Russian Naval Aviation, which is the former Soviet Aviatsiya Voyenno Morskogo Flota ("Naval Aviation"), or AV-MF).
The Air Force was formed from parts of the former Soviet Air Forces after the dissolution of the Soviet Union in 1991--92. Boris Yeltsin's creation of the Ministry of Defence of the Russian Federation on 7 May 1992, can be taken as a convenient formation date for the new Air Force. Since that time, the Air Force has suffered severe setbacks due to lack of resources, and has constantly shrunk in size. Since Vladimir Putin became President of the Russian Federation however, much more money has been allocated to the Armed Forces as a whole.
The United States Air Force (USAF) is the aerial warfare service branch of the United States Armed Forces and one of the seven American uniformed services. Initially part of the United States Army, the USAF was formed as a separate branch of the military on 18 September 1947 under the National Security Act of 1947.[5] It is the most recent branch of the U.S. military to be formed, and is the largest and one of the world's most technologically advanced air forces. The USAF articulates its core functions as Nuclear Deterrence Operations, Special Operations, Air Superiority, Global Integrated ISR, Space Superiority, Command and Control, Cyberspace Superiority, Personnel Recovery, Global Precision Attack, Building Partnerships, Rapid Global Mobility and Agile.[6]
Vladimir Vladimirovich Putin</media:description><media:keywords/><media:license type='text/html' href='http://www.youtube.com/t/terms'>youtube</media:license><media:player url='http://www.youtube.com/watch?v=ou87i6Oq5M0&feature=youtube_gdata_player'/><media:thumbnail url='http://i1.ytimg.com/vi/ou87i6Oq5M0/default.jpg' height='90' width='120' time='00:01:22.500' yt:name='default'/><media:thumbnail url='http://i1.ytimg.com/vi/ou87i6Oq5M0/mqdefault.jpg' height='180' width='320' yt:name='mqdefault'/><media:thumbnail url='http://i1.ytimg.com/vi/ou87i6Oq5M0/hqdefault.jpg' height='360' width='480' yt:name='hqdefault'/><media:thumbnail url='http://i1.ytimg.com/vi/ou87i6Oq5M0/1.jpg' height='90' width='120' time='00:00:41.250' yt:name='start'/><media:thumbnail url='http://i1.ytimg.com/vi/ou87i6Oq5M0/2.jpg' height='90' width='120' time='00:01:22.500' yt:name='middle'/><media:thumbnail url='http://i1.ytimg.com/vi/ou87i6Oq5M0/3.jpg' height='90' width='120' time='00:02:03.750' yt:name='end'/><media:title type='plain'
>WORLDS FASTEST propellar driven AIRCRAFT Russian Tu 95MC Nuclear Bomber</media:title><yt:duration seconds='165'/><yt:uploaded>2013-09-01T11:21:22.000Z</yt:uploaded><yt:uploaderId>UCD8bmW4A7eYzHrW7sXwsqwQ</yt:uploaderId><yt:videoid>ou87i6Oq5M0</yt:videoid></media:group><gd:rating average='4.855856' max='5' min='1' numRaters='111' rel='http://schemas.google.com/g/2005#overall'/><yt:statistics favoriteCount='0' viewCount='67834'/><yt:rating numDislikes='4' numLikes='107'/></entry>
Don't worry too much about the complexity. All you need is this element from it:
<media:content
url='rtsp://r8---sn-5hn7su7l.c.youtube.com/CiILENy73wIaGQnN5KqjizvvohMYDSANFEgGUgZ2aWRlb3MM/0/0/0/video.3gp'
type='video/3gpp'
medium='video'
expression='full'
duration='165'
yt:format='1'/>
Note that there may be more than one media:content element - you need the one with type=video/3gpp` content type. Take the URL from it - this is the URL of the video stream.
Now use VideoView to show your video:
VideoView video = (VideoView)findViewById(R.id.video_player);
video.setVideoURI(Uri.parse(videoUrl));
video.start();
In this code the videoUrl is the URL as shown above, specifically,
rtsp://r8---sn-5hn7su7l.c.youtube.com/CiILENy73wIaGQnN5KqjizvvohMYDSANFEgGUgZ2aWRlb3MM/0/0/0/video.3gp

How to Parse Html tags From Website in Android

i am trying to get the text in the tags below from the
URL:http://www.mcpss.com/?PN='News2'&SubP='DNewsStory'&gn=&NewsID=47318&ShowNav=&StoryGroup=Current
<td class="header">
OPEN HOUSE SCHEDULED AT CLARK-SHAW
</td>
<p><span style="font-size: 12pt;">January 16, 2013 - Due to the relocation of Murphy High School to the Clark-Shaw campus and the necessary construction that is still ongoing, Clark-Shaw school did not participate in the magnet school “See and Sign” January 11 and 12<sup>th</sup>. We would like to resume giving school tours and meeting interested parents. Therefore, we are planning an “Open House” on Friday, January 25 from 9:00 a.m.- 12:00 p.m. to coincide with our school’s Science Fair Open House that is scheduled for that day.</span></p>
<p><span style="font-size: 12pt;"> </span></p>
<p><span style="font-size: 12pt;">Please share this information with your friends and neighbors. Magnet School applications are available now online.</span></p>
<p> </p>
i want to represent the text in android application like below:
*OPEN HOUSE SCHEDULED AT CLARK-SHAW
January 16, 2013 - Due to the relocation of Murphy High School to the Clark-Shaw campus and the necessary construction that is still ongoing, Clark-Shaw school did not participate in the magnet school “See and Sign” January 11 and 12th. We would like to resume giving school tours and meeting interested parents. Therefore, we are planning an “Open House” on Friday, January 25 from 9:00 a.m.- 12:00 p.m. to coincide with our school’s Science Fair Open House that is scheduled for that day.
Please share this information with your friends and neighbors. Magnet School applications are available now online.*
how can i acheive it in android.
using jsoup http://jsoup.org/ you can get this
download the jsoup.jar file then add it to your libs folder then go to android dependancies right click >> build path >> configure build path >> ADD JARS>> libs >> then choose the jsoup.jar file you downloaded
try {
String website="http://www.mcpss.com/?PN='News2'&SubP='DNewsStory'&gn=&NewsID=47318&ShowNav=&StoryGroup=Current";
Document doc = Jsoup.connect(website).get();
Elements el=doc.getElementsByClass("header");
String text=el.text();
} catch (Exception e) {
Log.wtf("name of activity","error message to show in log", e);
}
As this is Html document, try to use Html.fromHtml(string) for TextView or try to use webview depends on tags.
For TextView you can use this like
TextView txt=new TextView(getApplicationContext());
String str="<td class=\"header\">"+
"OPEN HOUSE SCHEDULED AT CLARK-SHAW"+
"</td>"+
"<p><span style=\"font-size: 12pt;\">January 16, 2013 - Due to the relocation of Murphy High School to the Clark-Shaw campus and the necessary construction that is still ongoing, Clark-Shaw school did not participate in the magnet school “See and Sign” January 11 and 12<sup>th</sup>. We would like to resume giving school tours and meeting interested parents. Therefore, we are planning an “Open House” on Friday, January 25 from 9:00 a.m.- 12:00 p.m. to coincide with our school’s Science Fair Open House that is scheduled for that day.</span></p>"+
"<p><span style=\"font-size: 12pt;\"> </span></p>"+
"<p><span style=\"font-size: 12pt;\">Please share this information with your friends and neighbors. Magnet School applications are available now online.</span></p>"+
"<p> </p>";
txt.setText(Html.fromHtml(str));
For WebView try to use webview.loadData();

How to get Values from HTML String in Android

I have a problem that I want to get different values from different tags from HTML String as, <p><div class=\"image_wrapper\" style=\"width:320px;\"><img name=\"tccimg_100322484_s\" **title=\"2011 Chevrolet Corvette 2-door Coupe Z06 w/2LZ Angular Front Exterior View\"** src=\"http://images.thecarconnection.com/sml/2011-chevrolet-corvette-2-door-coupe-z06-w-2lz-angular-front-exterior-view_100322484_s.jpg\" alt=\"2011 Chevrolet Corvette 2-door Coupe Z06 w/2LZ Angular Front Exterior View\" width=\"320\" height=\"240\" /><p>2011 Chevrolet Corvette 2-door Coupe Z06 w/2LZ Angular Front Exterior View</p><a name=\"tccwrp_100322484\" class=\"enlarge\" href=\"/image/100322484_2011-chevrolet-corvette-2-door-coupe-z06-w-2lz-angular-front-exterior-view\" target=\"_blank\">Enlarge Photo</a></div></p>\n<p>The Chevrolet Corvette is an American icon: a rear-wheel drive, two-seat sports car that started its legendary run in 1953 and has seen 57 years of continuous production in Flint, Michigan, St. Louis, Missouri and most recently in Bowling Green, Kentucky. Over the years it has constantly evolved to lead performance and value, with occasional lows and numerous highs along the way. Though it has little domestic competition, cars as disparate as the Dodge Viper, Porsche Boxster and 911, and the Nissan GT-R and 370Z can be considered rivals in terms of performance and/or price. The Chevrolet Corvette is priced from $48,000 to $56,000 for the standard Coupe and Convertible, from $58,000 to $68,000 for the Grand Sport, from $75,000 to $82,000 for the Z06, and from $106,800 for the ZR1.</p>\n<p>Over the past 57 years of production, there have been six generations of Corvette. The first 1953 models featured solid rear axles and inline six-cylinder engines, though in 1955, the V-8 became standard. When the second generation \"Sting Ray\" debuted in 1963, independent rear suspension was added and output was increased to 360 horsepower. A big-block 6.5-liter model was added in 1965, before the famous 427 cubic inch (7.0-liter) engine joined in 1966. The third-gen car began its run in 1968, running for 13 years until 1982--the longest run of the various Corvette generations. The new, fender-flared body style was the primary new addition to the line, along with a three-year run for the ZR-1 performance edition, though emissions and fuel regulations conspired to restrict power output and potential of Corvettes throughout the 1970s. The fourth-generation Corvette hit the street in 1983 as a 1984 year model, bringing with it a complete redesign of the car aside from the engine, with a sleek, modern design and digital instruments, and the second ZR-1 performance version. The fifth-gen car, introduced in 1997, saw another major upgrade, with improved build quality, more performance, and better handling the result. The Z06 model was introduced in 2001, and engines continued to be upgraded, producing 405 horsepower in the Z06.</p>\n<p>The sixth and current Corvette generation debuted in 2005, and brought with it all new bodywork and improved suspension. Power climbed to 400 horsepower for the base Corvette initially, now up to 430 horsepower from its 6.2-liter V-8 LS3 engine, and 505 horsepower for the current 7.0-liter Z06. The ZR1 was added back to the lineup in late 2007 as a 2008 year model, producing 638 horsepower from a supercharged 6.2-liter V-8 engine. Currently available in Coupe, Convertible, a Grand Sport version with upgraded brakes and special bodywork, the high-performance Z06, and the supercar-rivaling ZR1.</p>\n<p>The Coupe and Convertible are the standard Corvettes, with 430 horsepower output and all the conveniences of a modern car, including available Bluetooth on some models, a choice of six-speed manual or automatic transmission, and available leather interior. The Grand Sport is also available as both a coupe and convertible, though the coupe gets a few performance upgrades over the soft top, including a dry-sump oil system when equipped with the six-speed manual transmission, plus the upgraded brakes and flared fenders that both variants get. The Corvette Z06 ups the performance ante with extensive use of carbon fiber body panels and components, an aluminum frame, and a 505-horsepower engine. The ZR1 is king of the hill, its massive power output combined with Brembo ceramic carbon brakes, visible carbon fiber weave components, and a 205-mph top speed. Despite their huge power and impressive performance figures, the brawny engines in the Corvette enable it to achieve up to 26 mpg on the highway.</p>\n<p>No major changes were made for the 2012 model year, though the range did get interior updates, new technology packages, and a range of new exterior colors. High-performance Z06 and ZR1 models also got new performance packages.</p>\n<p>For 2013, a new 427 Convertible Collector Edition has been added, pairing the Z06's LS7 V-8 engine with a Corvette Convertible chassis and unique 60th Anniversary touches. A 60th Anniversary Package will also be available on all 2013 model Corvettes, adding a special touch to celebrate six decades of the Corvette. The rest of the line carries forward largely unchanged from last year.</p>\n<p>The next major generational upgrade is expected to come in late 2013, with the seventh-generation car drawing on GM's global resources for its new design--the first time the Corvette team has looked outside the U.S. for the iconic 'Vette.</p>\n"
I want to get Image title value from this html string in the starting, but I am unable to get that. I am using Jsoup for parsing of this HTML String as,
Code:
Document doc = Jsoup.parse(html);
Elements element = doc.getAllElements();
for(Element e: element)
{
Elements str = e.getElementsByTag("img");
for(Element el: str)
{
String title = el.getElementsByAttribute("title").text();
System.out.println("The Title:"+title);
}
}
Please suggest me any solution regarding the same.
Thanks in advance.
Replace the following line:
String title = el.getElementsByAttribute("title").text();
with
String title = el.attr("title");
Explanation: the function call getElementsByAttribute("title") will return a List of Elements (see Jsoup Doumentation - Element), when really you just want to look at the attribute for a specific element. See also Jsoup Documentation - Node.

Categories

Resources