Friday, 30 August 2013

How-to-use i18n(Internationalization) folder in Appcelerator

//  How-to-use i18n(Internationalization) folder

// Rather than hard-coding strings into your project, you can use localized strings. Localized strings are replaced at runtime with values appropriate to the user's language. Titanium relies on resources files and string placeholders to accomplish this task.

Example :)

 // Titanium provides two functions for obtaining a localized string from your resource files. Both take the key of the string requested as their first parameter. The L() macro is a short form for Ti.Locale.getString():


Helpful LINK :  https://wiki.appcelerator.org/display/guides/Internationalization

LIKE

var str1 = L('welcome_message');
var str2 = Ti.Locale.getString('welcome_message');
// str1 === str2

Sample code is available on GIT :) 
https://github.com/dharmik/How-to-use-i18n-folder--

Thursday, 15 August 2013

How to use paint module and save that image in local . .

// In this blog we learn that how to use paint module in appcelerator

// This module is very easy to use.

// This paint module is available on appcelerator market place.

//Sample code is available here. :)

You can get module using this link

https://dl.dropboxusercontent.com/u/72783403/paint.zip


var Paint = require('ti.paint');

var win = Ti.UI.createWindow({
    backgroundColor : '#fff'
});
var paintView = Paint.createPaintView({
    top : 0,
    right : 0,
    bottom : 80,
    left : 0,
    strokeColor : 'black',
    strokeAlpha : 255,
    strokeWidth : 5,
    eraseMode : false
});
win.add(paintView);

var clear = Ti.UI.createButton({
    bottom : 40,
    right : 50,
    width : 75,
    height : 30,
    title : 'Clear'
});
clear.addEventListener('click', function() {
    paintView.clear();
});
win.add(clear);
var save = Ti.UI.createButton({
    bottom : 40,
    left : 50,
    width : 75,
    height : 30,
    title : 'Save'
});
save.addEventListener('click', function() {
    var filename = "sample.png";
    var file = Titanium.Filesystem.getFile(Titanium.Filesystem.applicationDataDirectory, filename);

    if (file.exists()) {
        file.deleteFile();
    }

    file.write(paintView.toImage());
    var path = file.nativePath;
    Ti.API.info('path of image' + path);
    alert('Image Save');
});
win.add(save);

win.open();




Sunday, 11 August 2013

Different project structure

// Today we simply discuss some project structure.

// How to display menu in appcelerator in different style.


// Sample code is available on GIT :)

https://github.com/dharmik/MenuStructure


Pic :)

 
 



Drag Pin on MAP in Android device In Appcelerator

// Today we learn something different in appcelerator .

// In appcelerator we all kown that we drag pin on Map in iOS we can easily do that .

// In iOS there are some property is available like Dragabble .

// With the use of this property we can easily drag that pin on map in iOS

// But HOW to DRAG that PIN on MAP in ANDROID Device in Appcelerator ?

// Draggable property is only available in iOS not for ANDROID.  :( :( :(

Here one video is available on Youtube that really good and with the help of this URL i solve my problem and that i share wuth you.

http://www.youtube.com/watch?v=M4fUlqKWg7g
And that sample code is also available on GIT.. :)

https://github.com/dharmik/Drag-Pin-In-Android

Friday, 2 August 2013

Text Field In ALERT BOX in Android in APPCELERATOR

Below is Simple code for TextField in ALERT BOX. 



app.js

//Helpful code :)

var win = Titanium.UI.createWindow({
    backgroundColor:'#fff'
});

var textfield = Ti.UI.createTextField({
    value : 'Hello :)'
});

var dialog = Ti.UI.createAlertDialog({
    title: 'Enter text',
    androidView: textfield,
    buttonNames: ['OK', 'cancel']
});
dialog.addEventListener('click', function(e){
    Ti.API.info(textfield.value);
});
dialog.show();

win.open();

Snap :)


Monday, 22 July 2013

How to remove strip_tags in Appcelerator ?

// Here sample code to remove strip_tags from strings.

 Helpful Link : http://phpjs.org/functions/strip_tags/

 Code :

 var input = "<div>Sani</div>" // Static string
       
      strip_tags(input); // function

      function strip_tags(input) {
         var tags = /<\/?([a-z][a-z0-9]*)\b[^>]*>/gi, commentsAndPhpTags = /<!--[\s\S]*?-->|<\?(?:php)?[\s\S]*?\?>/gi;
            return input.replace(commentsAndPhpTags, '').replace(tags, '');
        }


OutPut : Sani

Wednesday, 10 July 2013

Appcelerator Titanium Business Application Development Cookbook Review .



Appcelerator Titanium Business Application Development Cookbook


What you will learn from this book :

I really thanks to  Benjamin Bahrenburg who is author of this book. This book helps me a lot and also very helpful to me. With the help of this book clear my douts and learn good things witch help me in code. 

With the help of this book i learn many thing like
 1) Location
 2) Passcode
 3) Notification
 4) LockScreen
 5) Analytics
 6) URL Schemes etc......

Approach :

Written in a cookbook style, this book offers solutions using a recipe-based approach. Each recipe contains step-by-step instructions followed by an analysis of what was done in each task and other useful information. The cookbook approach means you can dive into whatever recipes you want in no particular order.

Who this book is written for :

This book is for any developer who possesses some JavaScript or web development knowledge and wishes to take a leap into building native applications for both the iPhone and Android. No knowledge of Objective C and Java is required. Using this book he/she easily understand about Appcelerator and very helpful to create Application in Android, Tablet, iPhone, iPad, etc .

Book Is Available:

Appcelerator Titanium Business Application Development Cookbook 

Examples : 

With the help of this book you can easily develop some good example in appcelerator in both OS android as well as iOS. :)

1)   Use of Google Analytics in your application.
2)   Opening PDF documents in Android and iOS.
3)   AES encryption using JavaScript
4)   Using the LinkedIn Contacts API  
5)    Passcode

This all are the basic examples are available in this book. And its really helpful to me. 


I show you some snapshot of my application that i create with the help of this book.

First snap of PassCode. :)
And 
Second snap of PDF viewer. :)