Hi its my first post here I am writing it because I went throught every example google knows about on htmlcleaner... and I cant get my project running ;( Im tryng to make an Android app fetching and displaying data from flash rich webpage. The idea is to get only the most important data so that users wouldnt wast time, money processing power, nerves on atempting to brawse those pages on their smartphones... Its a country specific webpage... therefore country pecific app. On the page i want to parse there is this part
<li class="genre-3 genre-7 genre-9 mi-37 ">
<img src="picture.jpg" alt="altTitle">
<div class="superClass">
<a> aaa </a>
bbb
ccc
ddd
eee
</div>
<h2>title_of_super_product</h2>
<ul class="icons tooltip-enabled">
<li class="before"></li>
<li><img src="15_2.png" alt="15_2"></li>
</ul>
<div> </div>
<span class="material">some_material</span>
<span class="price">0.1USD</span>
<p class="text"> Some description </p>
<a class="button-more" href="http://link_to_more_info"></a>
</li>
The above is a ListItem, there are others similiar on the webpage. I have java class ready to fill it with data from the li lements. One clsss object for one li element. I need to extract the description, price, material, image links, stuff from superClass , meaning aaa,bbb,ccc,ddd, etc... The big question is how to do that? I thought that if i start from making a array that would consist of li elements i would be able to search each of them further for subelements i need... but it doest work ;(
TagNode[] liElements = rootNode.getElementsByName("li", true);
for (int i=0; liElements != null && i < liElements.length; i++) {
if(liElements.getAttributeByName("class").contains("genre"))
Log.d("li",liElements.getAttributeByName("class")); }
Gives only the first li element, then it spams nullPointerExceptions in the console Please please help, Im hopeless ;(;(;(
String classType =liElements.getAttributeByName("class");
if(classType!=null && classType.equals("genre........");
liElements[i]
Related
I am new with ionic framework.Currently i am working on ionicsidemenu app. I want to show records according to date, having date as heading and respective date having multiple records.
For this i have two web services one is for heading date another is for date-wise records. In my HTML file i have two ng-repeat one is for display heading date. Now i am not able to understand how to get records of particular date as date has to be sent to web service for getting records.
I have tried this:
<div ng-repeat="d in dates track by $index">
<h2>d.edate</h2>
<div ng-init="datewiserecords(d.edate);" >
<div ng-repeat="n in res1 track by $index" class="text-white" >
</div></div></div>
but its not working.Please help me.
I am not sure what you are looking for, but the way I understand the question makes me to give you a solution as below:
My Solution:
<!DOCTYPE html>
<html>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.4.8/angular.min.js"></script>
<body>
<div ng-app="myApp" ng-controller="myCtrl">
<ul>
<li ng-repeat="get_date in dates">
<h2>{{get_date.date}}</h2>
<h4>{{get_date.data}}</h4>
</li>
</ul>
</div>
<script>
var app = angular.module('myApp', []);
app.controller('myCtrl', function($scope) {
$scope.dates = [{date:"1",data:"One"},{date:"2",data:"Two"},{date:"3",data:"Three"}];
});
</script>
</body>
</html>
Hope This is helpful
In my Ionic App, I want to use emojione for smiley in chat. Unfortunately, I didn't find useful documentation to show how to use emojione.
Now I want to create a popup that contain all list of smiley and it's related group. like this:
In downloaded files, There are png sprite of smiley and it's css file, But there isn't any HTML file that show the smiley list.
How can I create this list?
After research two days, I didn't find any answer on internet, So, I wrote the list (that contain all of the emoji with it's category) myself and solve the problem.
In downloaded folder at emojione.com, there is some file that I used to create list:
1. emojione.sprites.css That contain background-position and classname
2. emojione.sprites.png This is a sprite image of all emoji
3. emoji.json Than contain all emoji name,category, unicode and ...
I used ionic tab and angular ng-repeat and groupBy filter in angular-filter
angular-filter: Bunch of useful filters for AngularJS
Important: Use unicode In emoji.json for each emoji classname to show emoji in background of an element(spite).
HTML
<div class="emoji-wrapper">
<div class="tabs">
<a ng-repeat="(key, value) in emojies | groupBy:'category'" class="tab-item" ng-click="changeTab($index)">
{{key}}
</a>
</div>
<div ng-repeat="(key, value) in emojies | groupBy:'category'" id="{{key}}" ng-show="tabActive[$index]">
<ul>
<li ng-repeat="emoji in value">
<span class="emojione emojione-{{emoji.unicode}}"></span>
</li>
</ul>
</div>
</div>
JS
$scope.emojies = [];
$scope.tabActive = [];
$scope.tabActive[0] = true;
$http.get("emoji.json").then(function (response) {
angular.forEach(response.data , function ($elem , $index) {
$scope.emojies.push($elem);
});
});
$scope.changeTab = function (index) {
$scope.tabActive = [];
$scope.tabActive[index] = true;
};
For the first time i am trying my hand On Android Phonegap application.For the same i am designing a sample application where i have to pass some parameters from one HTML page to another .Here is the HTML for my first page ..
<div class="choice_list">
<ul data-role="listview" data-inset="true" data-filter="true">
<li> <img src="images/will.jpg"/> <h3> Will Smith </h3></li>
</ul>
</div>
Now as per my requirement i have to pass the <h3> parameter to my next HTML page i.e empdetails.html and display it there as soon as the link button gets clicked..
Here is my empdetails.html HTML..
<div id="header2">
<h2>Name: "I need to show name here"</h2>
</div>
Please help me to get this ..I am very new in this ..
Thanks ..
You can use local storage in phonegap (set on first page)
window.localStorage.setItem("key", $("h3").text());
For get the local storage use(set on second page)
var data=window.localStorage.getItem("key");
Using Local Storage is the solution, you can read more here.
I am trying to make "Highlighter" for epub reader in one my Android project using webview.
I am using Rangy for getting Selected text.
The serialize functions gives me this value after selecting text from the below sample HTML:
2/5/3/5/1/2:0,13/5/3/5/1/2:24
I am storing this in DB. When user returns to this page, i am retrieving the same selection and trying to deserialize but the deserialize function throws the following error:
Error in Rangy Serializer module: deserializePosition failed: node <DIV>[7] has no child with index 13, 0
I am getting why this is happenig??
Even i am trying to do the same thing using XPath but still the same issue.
<html>
<head>
<script></script>
</head>
<body>
<div id="mainpage" class="highlighter-context">
<div> Some text here also....... </div>
<div> Some text here also.........</div>
<div>
<h1 class="heading"></h1>
<div class="left_side">
<ol></ol>
<h1></h1>
<div class="text_bio">
In human beings, height, colour of eyes, complexion, chin, etc. are
some recognisable features. A feature that can be recognised is known as
character or trait. Human beings reproduce through sexual reproduction. In this
process, two individuals one male and another female are involved. Male produces
male gamete or sperm and female produces female gamete or ovum. These gametes fuse
to form zygote which develops into a new young one which resembles to their parent.
During the process of sexual reproduction
</div>
</div>
<div class="righ_side">
Some text here also.........
</div>
<div class="clr">
Some text here also.......
</div>
</div>
</div>
</body>
</html>
Any guesses??
you are probably using the following:
highlighter.highlightSelection();
rangy.serializeSelection();
if you are running highlightSelection before serializing it will not work.
this is because highlighting is actually wrapping text in tags which means that DOM is manipulated.
deserializing on original DOM will obviously won't work.
try change the order of commands so you will serialize first and only then use highlight.
Correct Order:
rangy.serializeSelection();
highlighter.highlightSelection();
I'm trying to construct a little mobile optimized web. This web list a set of results for business and I need that android interpret the telephone link.
I have watch other webs and android show an especial intem for telephone links (with a telephone green image in a grey button) but when I try it, it seems like a usual link.
I have tried with microformars (vcard) and it not works.
My code:
<ul id="search-results">
<li class="vcard" id="i53380"><!-- pro//ginecologo_madrid/clinica-dam/ -->
<p class="fn">
<a class="url" href="/ginecologo_madrid/clinica-dam/">Name of bussiness</a>
</p>
<p class="adr"><span class="street-address">Street - zipcode</span> <span class="locality">Locality</span></p>
<p class="tel">
<a href="tel://+34 XXXXXXXXX" class="value" >+34 XXXXXXXXX</a>
</p>
</li>
<!-- more results -->
Any idea?
There should be no // after the :
its
tel:+34 XXXXXXXXX
and NOT tel://+34 XXXXXXXXX