Code example for Element

Methods: getAttribute, hasAttribute

0
        	ImageView imgview = new ImageView(this);
        	imgview.setOnTouchListener(new OnTouchListener() {
				@Override 
				public boolean onTouch(View v, MotionEvent event) {
					if (event.getAction() == MotionEvent.ACTION_UP) {
						if (item.hasAttribute("clickminx")) {
							Log.d("CoordinaryHeroes", "Clicked in imagemap at: " + ((float) event.getX())/v.getWidth());
							Log.d("CoordinaryHeroes", "Minx: " + item.getAttribute("clickminx") + "Maxx:" + item.getAttribute("clickmaxx"));
							if (((float) event.getX())/v.getWidth() > Float.parseFloat(item.getAttribute("clickminx"))
									&& ((float) event.getX())/v.getWidth() < Float.parseFloat(item.getAttribute("clickmaxx"))) {
								next(); 
								return true; 
							} else { 
								if (!showingDialog) {
									showingDialog=true;
									theToast = Toast.makeText(v.getContext(), "Character not available in demo", Toast.LENGTH_SHORT);
									theToast.setGravity(Gravity.CENTER_VERTICAL,0,0);
									theToast.show();
									new Thread(new Runnable() {
										@Override 
										public void run() {