Go Back   Android Forums > Android Discussion > Android Applications
Android Applications All the information you could ever want about Android Applications. Learn about apps and get help with them... all here! New apps can be found and announced in the Applications Announcements forum linked below.

Get excited for the Samsung Galaxy S5! Find everything you need and discuss it in our Galaxy S5 Forum!

test: Reply
 
LinkBack Thread Tools
Old July 13th, 2011, 02:54 AM   #1 (permalink)
New Member
Thread Author (OP)
 
Join Date: Jul 2011
Posts: 8
 
Device(s):
Carrier: Not Provided

Thanks: 0
Thanked 0 Times in 0 Posts
Angry facing problem with webview. can any body help?

hi,
Developing a application on webview.

have an fronthtml file which is emty and and have place holders for the contents. and have javascript function like bellow.

// this is function from fronthtml page
function adddata(dataHTML) {
var newdataDiv = document.createElement("div");
newdataDiv.innerHTML = dataHTML;

var element = document.getElementById('outer');
element.appendChild(newdataDiv);

}
//------------------------------------------------------------------------------
6.html has bellow div

<html><head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8"></head><body><div class="tile-group">
<div style="width: 324px; background-color:LightGrey; height:186px; margin-left:0px; margin-right: 0px; float: left; margin-bottom: 0px; margin-top: 0px" class="tile" id="389">
<a href="somelink" class="showlink">
<div class="title">Digital Britain: Creative and Tech Talent Landscape</div>
<div style="float: left; width: 315px; margin-left: 3px">
<div style="float: left; width: 110px">
<img src="6_files/5.png" alt="Digital india: " height="100" width="100">
</div>
<div style="float: left; width: 200px;" class="type">
<div style="float: left; height: 30px">
<p>Blogs 7/12/2011</p></div>
<div style="clear: both; float: left; height: 35px">
<p>Blog</p>
</div>
<div style="clear: both; float: left; height: 40px">
<div class="rating">
* * * * * <span>(12 ratings)</span></div>
</div>
</div>
</div>
<div class="description">
<p>some text</p>
</div>
</a>
</div>

</div></body></html>
//------------------------------------------------------------------------------
i am using the bellow code to call the javascript function. passing 6.html link as input

public class TestwebdemoActivity extends Activity {
WebView mWebView;
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);



mWebView = (WebView) findViewById(R.id.webView1);
mWebView.getSettings().setJavaScriptEnabled(true);
mWebView.setWebViewClient(new MyWebChromeClient());

mWebView.loadUrl("file:///android_asset/fronthtml.html");
}

final class MyWebChromeClient extends WebViewClient {

@Override
public void onPageFinished(WebView view, String url)
{

mWebView.loadUrl("javascript:adddata("+"file:///android_asset/6.html"+")");

}
}
}

//--------------
above code is not working... is there any problem with passing parameters or javascript function?

or can we pass link as input to the adddata javascript function?

its very urgent for me please help me in this regards.

thanks and regards
rafiq

rafiqsab is offline  
Reply With Quote
sponsored links
Reply
Tags
webview


Go Back   Android Forums > Android Discussion > Android Applications
Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT -5. The time now is 01:36 AM.
Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2014, vBulletin Solutions, Inc.