Layar tutorial part 2
The first tutorial, we went through the steps to create a simple layer.
In this tutorial, we are going to explain how to include actions in this layer
Add a new table called "ACTION_Table" to the database.
- CREATE TABLE IF NOT EXISTS `ACTION_Table` (
- `poiID` varchar(255) NOT NULL,
- `label` varchar(30) NOT NULL,
- `uri` varchar(255) NOT NULL,
- `autoTriggerRange` int(10) default NULL,
- `autoTriggerOnly` tinyint(1) default NULL,
- `ID` int(10) NOT NULL,
- `contentType` varchar(255) default 'application/vnd.layar.interna
l', - `method` enum('GET','POST') default 'GET',
- `activityType` int(2) default NULL,
- `params` varchar(255) default NULL,
- `closeBiw` tinyint(1) default '0',
- `showActivity` tinyint(1) default '1',
- `activityMessage` varchar(255) default NULL,
- PRIMARY KEY (`ID`)
- ) ENGINE=MyISAM DEFAULT CHARSET=utf8;
Create a new function to retrieve actions
The new features include a video and MP3 playback, call and email.
- function getActions( $poi, $db ) {
- $sql_actions = $db->prepare( " SELECT label,
- uri, autoTriggerRange, autoTriggerOnly,
- contentType, method, activityType, params,
- closeBiw, showActivity, activityMessage
- FROM ACTION_Table WHERE poiID = :id " );
- $sql_actions->bindParam( ':id', $poi['id'], PDO::PARAM_INT );
- $sql_actions->execute();
- $count = 0;
- $actions = $sql_actions->fetchAll( PDO::FETCH_ASSOC );
- if ( empty( $actions ) ) {
- $poi["actions"] = array();
- } else {
- foreach ( $actions as $action ) {
- $poi["actions"][$count] = $action;
- $paramsArray = array();
- if ( substr_count( $action['params'],',' ) ) {
- $paramsArray = explode( ",", $action['params'] );
- }
- else if( strlen( $action['params'] ) ) {
- $paramsArray[0] = $action['params'];
- }
- $poi["actions"][$count]['params'] = $paramsArray;
- $poi["actions"][$count]['activityType'] = changeToInt $poi["actions"][$count] ['activityType'] );
- $poi["actions"][$count]['closeBiw'] = changeToBool( $poi["actions"][$count]['closeBiw'] );
- $poi["actions"][$count]['showActivity'] = changeToBool( $poi["actions"][$count]['showActivity'] );
- $poi["actions"][$count]['autoTriggerRange'] = changeToInt( $poi["actions"][$count]['autoTriggerRange'] );
- $poi["actions"][$count]['autoTriggerOnly'] = changeToBool( $poi["actions"][$count]['autoTriggerOnly'] );
- $count++;
- }
- }
- return $poi["actions"];
- }
We use a function called changeToBool to convert a Tinyint value to a Boolean value
and changeToInt to convert string value to integer.
- function changeToBool( $value_Tinyint ) {
- if ( $value_Tinyint == 1 )
- $value_Bool = TRUE;
- else
- $value_Bool = FALSE;
- return $value_Bool;
- }
- function changeToInt( $string ) {
- if ( strlen( trim( $string ) ) != 0 ) {
- return (int)$string;
- }
- else
- return NULL;
- }
Modify the Gethotspots function
$poi["actions"
If you're doing it right, you should see something like this:

This is the end of the second tutorial. In the next part, we are going to discuss how to implement 2d and 3d objects in a layer.
New tutorials from Helloandroid
Recent Apps
Android on Twitter
-
@lorealmichelle (Loreal Witherspoon ♔)I've just received an achievement: Tax Collector http://t.co/vektXV7M #Android #Androidgames #Gameinsight
4 min 10 sec ago -
@mawangbird (정진현)Start playing Paradise Island on Android http://t.co/QhMy4qEk #Android #Androidgames #Gameinsight http://t.co/FxWuH7D6
4 min 12 sec ago -
@babybluesnshn11 (Dawn wolf)I've just received an achievement: Parks Developer http://t.co/poJCRd2M #Android #Androidgames
4 min 20 sec ago -
@lyazi256 (lyazi)
The "Farm" collection in Big Business has been completed! 71 http://t.co/qPVxRX47 #android #gameinsight #androidgames
4 min 23 sec ago -
@adrianthompkins (Adrian Thompkins)#Android Stuff: S-Voice gets gagged: Samsung blocks leaked APKs http://t.co/TiWjmmux
4 min 23 sec ago
Poll
Useful resources
Android Development Projects
- Private project for Petterpp1 [WRD] by geomaster909
- Modifications on an Android Game by tymex
- app dev for techcity by dany2g
- Android App by dvlinh
- Iphone app by nabzyd
- Betfair Mobile App by Daaniel
- Need App Developer/Designer for iPhone, iPad by lplco
- Android Maps - Saving GeoLocations to MySql database. by adelshehri
- Prototype Android Apps display Information from database by getitonline
- Metal Weigh Calculator by mpmakwana



Comments
Great ArticlE >> ThX AloT
Great ArticlE >> ThX AloT ..
I ReallY EnjoyeD ReadinG it
It is very useful .. and u have great style
I hope u can visit my site below
And .. I,m Waiting for more
شات مصرى ,
شات مصرى ,
شات مصرى ,
شات مصرية ,
شات مصريه ,
دردشة مصرية ,
دردشة بنت مصرية ,
شات بنت مصرية ,
شات بنت مصر ,
دردشة بنت مصر ,
شات ,
دردشه مصريه ,
شات بنات مصر ,
دردشة بنات مصر ,
شات مصرى بنات ,
شات مصر ,
دردشة ,
شات اسكندرية ,
شات القاهرة ,
شات المنصورة ,
شات طنطا ,
شات السويس ,
شات الشرقية ,
شات المنوفية ,
شات الفيوم ,
شات بنى سويف ,
شات سوهاج ,
شات الصعيد ,
شات الزقازيق ,
شات جامعة القاهرة ,
شات جامعة اسكندرية ,
شات بنت السعودية ,
شات بنت البحرين ,
شات بنت الكويت ,
شات بنت فلسطين ,
شات بنت المغرب ,
شات بنت الامارات ,
شات بنت اليمن ,
شات بنت العراق ,
شات مصراوى ,
شات بنات ,
روتانا سينما ,
روتانا سينما مشاهدة مباشرة ,
روتانا سينما بث مباشر ,
روتانا سينما اونلاين ,
I hope u can find something useful About it .. Enjoy
Thanks .. lol i had to read it twice
Great help again
} else {
16.
foreach ( $actions as $action ) {
17.
$poi["actions"][$count] = $action;
18.
$paramsArray = array();
19.
if ( substr_count( $action['params'],',' ) ) {
20.
$paramsArray = explode( ",", $action['params'] );
21.
}
22.
else if( strlen( $action['params'] ) ) {
23.
$paramsArray[0] = $action['params'];
24.
}
25. s'] = $paramsArray;
$poi["actions"][$count]['param
26. ityType'] = changeToInt $poi["actions"][$count] ['activityType'] );
$poi["actions"][$count]['activ
27. Biw'] = changeToBool( $poi["actions"][$count]['close Biw'] );
$poi["actions"][$count]['close
28. ctivity'] = changeToBool( $poi["actions"][$count]['showA ctivity'] );
$poi["actions"][$count]['showA
29. riggerRange'] = changeToInt( $poi["actions"][$count]['autoT riggerRange'] );
$poi["actions"][$count]['autoT
30. riggerOnly'] = changeToBool( $poi["actions"][$count]['autoT riggerOnly'] );
$poi["actions"][$count]['autoT
31.
$count++;
a b c d e f g h i j
============================== ===========================
ipad bag blog
Sutudeg Community
Education News
============================== ===========================
a visit b visit c visit d visit e visit f visit g visit h visit i visit j visit k visit l visit m visit n visit o visit p visit q visit r visit s visit t visit u visit v visit w visit x visit y visit z visit aa visit ab visit ac visit ad visit ae visit af visit ag visit ah visit ai visit aj visit ak visit al visit am visit an visit ao visit ap visit aq visit ar visit as visit at visit au visit av visit aw visit ax visit ay visit az visit ba visit bb visit bc visit bd visit be visit bf visit bg visit bh visit bi visit bk visit bl visit bm visit bn visit bo visit bp visit bq visit br visit bs visit bt visit bu visit bv visit bw visit bx visit by visit bz visit ca visit cb visit cc visit cd visit ce visit cf visit cg visit ch ci cj ck cl ccl cm cn co cp cq cr cs ct cu cv
============================== ===========================
شات صوتي | دردشة صوتية | كلام
شات صوتي
| دردشة صوتية
|
كلام
| شات كلام
|
دردشة كلام
| دردشة صوتية
|
شات صوتي
| شات
|
Chat Voice
| ahj w,jd
شات صوتي
| دردشة صوتية
|
شات صوتي
| دردشة صوتية
|
دردشه
| دردشة
|
صوتي
| صوتية
|
شات صوتي
| دردشة صوتية
|
شات صوتي
| دردشة صوتية
|
الكلام
| دردشه صوتيه
|
]v]am w,jdm
| ]v]ai w,jdi
شات صوتي
شات صوتي
شات صوتي