Monday, 22 December 2014

Image zoom in /out feature in iOS [using default UIScrollView]

Step 1 : In .h file add ui-image-view object as ==>> IBOutlet UIImageView  *imgView;
 imgView object use to set image to zoom in /out

Saturday, 20 December 2014

Default share option in iOS : UIActivityViewController

- (IBAction)btnSharePressed:(id)sender {
    
    //filePath must NSURL object and looking like this => file:///Users/simon/Library/Application%20Support/iPhone%20Simulator/7.0.3/Applications/A5321493-318A-4A3B-8B37-E56B8B4405FC/AirDropDemo.app/ios-game-kit-sample.pdf
    
    NSString *filePath = [NSString stringWithFormat:@"file://%@",[self getFilePath:@"ios-game-kit-sample.pdf"]];
    
    UIActivityViewController *activityViewController = [[UIActivityViewController alloc] initWithActivityItems:@[filePath] applicationActivities:nil];
                       
    [self presentViewController:activityViewController animated:YES completion:nil];
    
}

Above code share the document with all available share option, if we want to remove some option use below code.

Friday, 19 December 2014

show toast type alert (Android) in iPhone (iOS)

[self.navigationItem setPrompt:@"Add photos with faces to Googlyify them!"];

Whole code for method
- (void)showToast
{
    
    double delayInSeconds = 1.0;
    dispatch_time_t popTime = dispatch_time(DISPATCH_TIME_NOW, (int64_t)(delayInSeconds * NSEC_PER_SEC)); // 1
    dispatch_after(popTime, dispatch_get_main_queue(), ^(void){ // 2
       [self.navigationItem setPrompt:@"Add photos with faces to Googlyify them!"];        
    });
}

Attributed text in text view iOS

 NSArray *arrayName = @[@"Gaurav", @"Kunal", @"Madhvi",@"Ashu Sir",@"Gupta ji",@"Rajneesh",@"Vikram",@"Sakshi",@"Gaurav", @"Kunal", @"Madhvi",@"Ashu Sir",@"Gupta ji",@"Rajneesh",@"Vikram",@"Sakshi",@"Gaurav", @"Kunal", @"Madhvi",@"Ashu Sir",@"Gupta ji",@"Rajneesh",@"Vikram",@"Sakshi",@"Gaurav", @"Kunal", @"Madhvi",@"Ashu Sir",@"Gupta ji",@"Rajneesh",@"Vikram",@"Sakshi"];
    

    NSMutableString *stringName = [NSMutableString new];
    for (NSString *name in arrayName) {
        [stringName appendFormat:@"%@, ",name];
    }
 
    NSMutableAttributedString *strAtributed =[[NSMutableAttributedString alloc] initWithString:stringName];
    
    NSUInteger startName = 0, lengthName = 0;
    BOOL toogle = true;
    for (NSString *name in arrayName) {
        lengthName = name.length;
        NSRange range = NSMakeRange(startName, lengthName);
        startName += lengthName + 2;
        
        if (toogle) {
            [strAtributed addAttribute:NSForegroundColorAttributeName
                                 value:[UIColor lightGrayColor]
                                 range:range];
        } else {
            [strAtributed addAttribute:NSForegroundColorAttributeName
                                 value:[UIColor redColor]
                                 range:range];
        }
        toogle = !toogle;
    }
    
    
    [txtView setAttributedText:strAtributed];
    [txtView setFont:[UIFont systemFontOfSize:20]];

Friday, 12 December 2014

SQLite3 thread safe execution in iOS


 
You can use lock (such as those enumerated in the Synchronization section of the Threading Programming Guide) or you can use a dedicated serial queue. For example, create a queue:
@property (nonatomic, strong) dispatch_queue_t databaseQueue;
Instantiate it:
self.databaseQueue = dispatch_queue_create("com.company.app.database", 0);
And whenever you want to interact with the database, you can do
dispatch_sync(self.databaseQueue, ^(void){
    // do your database activity here
});
If you want to simplify your life, the FMDB library has a FMDatabaseQueue object that does much of this for you (as well as greatly simplifying your database interaction in general).

for more detail read http://stackoverflow.com/questions/20029782/how-to-handle-multiple-thread-access-the-sqlite3-with-out-dblocked-error

Wednesday, 10 December 2014

SQLite 3 query for insert into table if id not exist in some other table

INSERT INTO tbl_img_upload_queue11  (galleryID, galleryURL,imgUniqueName, imgTime, imgLat, imgLong, uploadStatus)
SELECT id, galleryURL, imgUniqueName, imgTime, imgLat, imgLong, "0" as uploadStatus FROM tbl_gallery_img as tb Where id not in (select galleryid from tbl_img_upload_queue11 where tb.id<>id) and id in(1,2,3,4)


Thursday, 4 December 2014

Send push notification through php code.

If you are using distribution/ production certificate then use ssl://gateway.push.apple.com:2195

else if you are using developer account then use ssl://gateway.sandbox.push.apple.com:2195

For more detail about push notification read http://www.raywenderlich.com/32960/apple-push-notification-services-in-ios-6-tutorial-part-1



 $message,
                             'sound' => 'default'
                             );

        // other info which is send to push notification
        $body['others'] =   $otherMsg;

        // finally convert whole message to json and this payload variable send to apple
        $payload = json_encode($body);
        echo $payload."
";

        try {
            $ctx = stream_context_create();
            stream_context_set_option($ctx, 'ssl', 'local_cert', dirname(__FILE__).'/'.$selectPEM);
            stream_context_set_option($ctx, 'ssl', 'passphrase', $passphrase);
            $fp = stream_socket_client('ssl://gateway.push.apple.com:2195', $err, $errstr, 60, STREAM_CLIENT_CONNECT|STREAM_CLIENT_PERSISTENT, $ctx);

            $msg = chr(0) . pack('n', 32) . pack('H*', $deviceToken) .pack('n', strlen($payload)) . $payload;
            $result = fwrite($fp, $msg, strlen($msg));
            fclose($fp);
        } catch(Exception $e) {
            continue;
        }

    }


?>


How to wait for iOS methods with completion-blocks to finish



iOS completion blocks rule. A little bit of code that runs after a (normally slow) task finishes, with full access to the classes member variables, and even read-only access to the enclosing method’s local variables.
However, sometimes you want these calls to be blocking.
*shock horror* you may be thinking. Why hasn’t he re-designed his app flow to take advantage of these new methods? (this was the general response that one guy got to his question “How to wait for methods with result/completion blocks to finish?“).
Well the answer to that question is that I already designed my UI to be fast and responsive, with cancellable actions – before it was cool I guess. So all my code is already run in worker threads. So now when I want to implement something like ALAssetManager image loading, I want to add it to code that is already nicely multi-threaded, and designed to support other methods of loading images (that use blocking reads, rather than the newer completion block design). I’d rather not totally mess up the flow of my logic, and since it’s already threaded, it’s perfectly fine to just block and wait for the asset manager to return.
So how do you do this?

Wednesday, 3 December 2014

How to connect to your Amazon Instance FTP using fileZilla and others

You can download the FileZilla Client application from: http://filezilla-project.org/
You should follow these steps to upload files:
  1. Get your SSH Key in PPK format
  2. Start FileZilla
  3. Go to edit -> preferences
  4. Select SFTP 
  5. Click "Add keyfile
  6. Select the PPK file [If you don't have ppk file then import pem file, it will convert to ppk file]
  7. Save the settings (click OK in settings window) 
  8. In the connection toolbar, enter:
    1. Host: the Public DNS. You should set your server domain name
      (i.e.  xyz.bitnamiapp.com / ec2-xwz.compute-1.amazonaws.com)
      [eg. ec2-54-xx-xx-103.sp-southeast-1.compute.amazonaws.com]
    2. User: 'bitnami' / 'ec2-user'
    3. Password: leave it blank 
    4. Port: 22
  9. Click "Quickconnect
  10. If you get a message "The server's host key is unknown", click "ok" button 

Access or connect amazon ec2 using terminal

I’m setting up some free Amazon EC2 instances so I can run my Twitter data collectors without violating the terms of my Dreamhost hosting agreement or worrying about losing power on my office machine (happened just last week). Despite the many Google results for “getting started with ec2 on a mac”, the process is not that complicated.

Instructions

First, you need to generate an SSH key pair. The AWS Management Console makes this easy: Choose “Key Pairs” from the left menu bar under EC2. Follow the instructions, and download your *.pem somewhere you’ll remember.

Then, start your EC2 instance with that key pair and associate your elastic IP with that instance.

Once you have an EC2 instance up and running with your designated key pair, you should be able to SSH in just like you do to other servers:
$sudo chmod 0700 ec2-keypair.pem
$ssh -i ec2-keypair.pem ec2-user@ec2-elastic-ip

(Or, use ssh-add ec2-keypair.pem before ssh so you can drop the -i option)

Common problems

Problem: I get Permission denied (publickey).
Solutions:

Monday, 1 December 2014

Create UIImage to a Blur UIImage iOS 8 default blur view

- (UIImage *) blurImage:(UIImage *) image
{
 /*
  What we need:
   CIContext
   CIImage
   CIImage
   
  
  We create a CIContext, a CIImage and a CIFilter.
  
  Then we pass the CIImage to the CIFilter.
  
  We grap the filtered Image from the outputImage-property of the CIFilter and render that with the context to a CGImageRef

  Finally, we create a UIImage from the CGImageRef and return it
  
  */
 
 
 //We create the context first to get that out of the way
 
 //TODO: 1. Create a CIContext with options nil (a default context)
 CIContext * context = [CIContext contextWithOptions:nil];
 
 //Now we create a CIImage that can be filtered with a CIFilter
 
 //TODO: 2. Create a CIImage from the UIImage* image (use -initWithImage)
 CIImage * ciImage = [[CIImage alloc] initWithImage:image];
 
 
 //We create our Filter now and set it up
 
 //TODO: 3. Create a blur-filter. It's name is @"CIGaussianBlur"
 CIFilter * blurFilter = [CIFilter filterWithName:@"CIGaussianBlur"];
 
 
 //TODO: 4. Set the CIImage form Step 2 as the inputImage on the blur-filter
 //HINT: use - setValue:(your blur-filter) froKey:(the input-image-key)
 [blurFilter setValue:ciImage forKey:kCIInputImageKey];
 
 
 //Now we render the CIImage with our blur-filter
 
 //TODO: 5. Create a CGImageRef with the context from Step 1.
 
 //HINT: - createCGImage: fromRect:
 //HINT: use the outputImage-property of the blur-filter
 //HINT: the outputImage knows it's size, because it was created from another image (the UIImage)
 //you can get the required rect from the -extent method of your outputImage
 CGImageRef ref = [context createCGImage:blurFilter.outputImage fromRect:[blurFilter.outputImage extent]];
 
 
 
 //Finaly, we create a new UIImage from the CGImageRef
 
 //TODO: 6. create a UIImage from the CGImageRef.
 //HINT: There's a convenience-static-method in the UIImage for that: +imageWithCGImage:
 return [UIImage imageWithCGImage:ref];
}

Friday, 28 November 2014

NSTimer issue in iOS8 or you are finding alternative of NSTimer


// method in every one second execute recursive "methodWhichYouWantToRecursiveCall"
[self timer];

// methodWhichYouWantToRecursiveCall calls in every 1 sec
- (void)timer {
    __weak id weakSelf = self;
    __block void (^timer)(void) = ^{
        
        double delayInSeconds = 1.0; // time for recursive call
        dispatch_time_t popTime = dispatch_time(DISPATCH_TIME_NOW, delayInSeconds * NSEC_PER_SEC);
        dispatch_after(popTime, dispatch_get_main_queue(), ^(void){
            
            id strongSelf = weakSelf;
            
            if (!strongSelf) {
                return;
            }
            
            // Schedule the timer again
            [self timer];
            
            // Always use strongSelf when calling a method or accessing an iVar
            [self methodWhichYouWantToRecursiveCall];
        });
    };
    
    // Start the timer for the first time
    timer();
}

Wednesday, 26 November 2014

Objective-C iOS/ iPhone: Create thread safe singleton reference object

// Thread safe option, always keeps a single object
// dispatch_once is used as  critical section for multiple thread
+ (instancetype)sharedManager
{
    static PhotoManager *sharedPhotoManager = nil;
    static dispatch_once_t onceToken;
    dispatch_once(&onceToken, ^{
        sharedPhotoManager = [[PhotoManager alloc] init];
        sharedPhotoManager->_photosArray = [NSMutableArray array];
    });
    return sharedPhotoManager;
}

// Thread unsafe option, which is usually we used
+ (instancetype)sharedManager    
{
    static PhotoManager *sharedPhotoManager = nil;
    if (!sharedPhotoManager) {
        sharedPhotoManager = [[PhotoManager alloc] init];
        sharedPhotoManager->_photosArray = [NSMutableArray array];
    }
    return sharedPhotoManager;
}

Wednesday, 19 November 2014

iOS iPhone set status bar in white color {default is black}

Add this line in Info.plist
View controller-based status bar appearance  and set value : NO

Then add this line in AppDelegate.m
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
    [[UIApplication sharedApplication] setStatusBarHidden:NO];
    [[UIApplication sharedApplication] setStatusBarStyle:UIStatusBarStyleLightContent];

    return YES;
}

URL encoding in iPhone programming (iOS Progarmming) using NSString Category ARC enabled

@implementation NSString (URLEncoding)

- (NSString *)encodeString//:(NSStringEncoding)encoding
{
    
    return (NSString *) CFBridgingRelease(CFURLCreateStringByAddingPercentEscapes(NULL, (CFStringRef)self,
                                                                                  NULL, (CFStringRef)@";/?:@&=$+{}<>,",
                                                                                  CFStringConvertNSStringEncodingToEncoding(NSUTF8StringEncoding)));
}

@end

Thursday, 6 November 2014

free iphone books and resources

http://www.scoop.it/t/ios-books-by-ivan-smirnov

Simple, interactive notifications in iOS 8

With iOS 8 came an exciting new API for creating interactive notifications. These allow you to provide additional functionality to your users outside of your application. I found a lack of clear examples online so I thought I would do a post to show you how easy it is to implement. Here is an example.

Monday, 3 November 2014

Assertion failure in -[UIPickerTableView _createPreparedCellForGlobalRow:withIndexPath:]

Assertion failure in -[UIPickerTableView _createPreparedCellForGlobalRow:withIndexPath:]
You are thinking that Ohh! what the hell is going on. App crashing at some other place, which could not happen. Oh I didn't use UITableView. What is wrong now. Then you can go with simple 
- (void)viewDidLoad
{
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    [self.view layoutIfNeeded];
} 

What happen If it not works, then try 
- (void)viewDidLoad
{
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    [self.view layoutIfNeeded];

    picker.frame = datePickerTargetFrame;
    [self.view addSubview:picker];


}


IF YOU WANT TO LEARN ABOUT MORE WHAT IS THE MAGIC IN layoutIfNeeded THEN READ PREVIOUS ARTICLE.

How is layoutIfNeeded used?

layoutIfNeeded forces the receiver to layout its subviews immediately if required.
Suppose you have overridden layoutSubviews, and UIKit feels that your view requires layout for whatever reason (e.g. you called setNeedsLayout when handling some user action). Then, your custom layoutSubviews method will be called immediately instead of when it would normally be called in the regular UIKit run loop event sequence (after event handling, but before drawRect:).
An example of why you might need to call layoutIfNeeded within a single run loop:
  1. You resize a custom view containing a table view with a custom layout. setNeedsLayout is set so that layoutSubviews will be called later.
  2. A controller object asks the table view to scroll to some particular cell when handling a user event.
  3. Your custom view performs some custom sizing of the table view in layoutSubviews that changes the table view size.
The problem is when the controller asked the table view to scroll (step 2), the table view had bounds that were stale. The updated bounds would only be set on the table view later (step 3). What the controller wanted the table view to scroll to may not actually be visible after layoutSubviews is done. A solution then would be for the controller to call layoutIfNeeded in situations where it knows this might occur.

Saturday, 1 November 2014

Take screenshot of server screen and send this to request browser.

Welcome to fun programming. Here we are creating a socket to a simple http web server. This program is taking screen shot of server system to client request browser. If I wanna see my friend screen and my friend is running this program then I just type his IP:8989 on browser and can see his current screen. Improvement of this program as continuous  streaming is home assignment for you. Thanks to Vikram.

Friday, 31 October 2014

Get all images (full size) from Image gellery in iOS

ViewController.h
#import <UIKit/UIKit.h>
#import <AssetsLibrary/AssetsLibrary.h>

@interface ViewController : UIViewController<UICollectionViewDataSource, UICollectionViewDelegate>
{
    ALAssetsLibrary *library;
    NSArray *imageArray;
    NSMutableArray *mutableArray;

    IBOutlet UICollectionView *collectionView;
}

-(void)allPhotosCollected:(NSArray*)imgArray;
@end
ViewController.m

Thursday, 30 October 2014


75 Essential Tools for iOS Developers

If you were to go to a master woodworker’s shop, you’d invariably find a plethora of tools that he or she uses to accomplish various tasks.
In software it is the same. You can measure a software developer by how they use their tools. Experienced software developers master their tools. It is important to learn your current tools deeply, and be aware of alternatives to fill in gaps where your current ones fall short.
With that in mind, I present to you a gigantic list of tools. Some of these I use daily, others I see potential in. If you have more tools you’d like to see here, just make sure to add a comment.
I tried to categorize these the best I can. Some of the entries are websites, some are back-end services, but most are apps that you install. Not all of the apps are free, so I’ll make a note with a $ to denote that an app costs money.
And without further ado, we’ll start from the beginning of any project, and that

Saturday, 25 October 2014

Java web server demo.

Java HTTP web server demo. Actually a HTTP web server is nothing but a TCP socket connection where first return content must be "HTTP/1.0" with content type and then contents (Html type) or specified. And At last connection must close so the connection stream must break to client. If it is a traditional TCPServer then no need to terminate the connection, we need connection stream. And there is no need of return first content as "HTTP/1.0 ...". For TCPServer code click here.
Keep it simple with this code.

Thursday, 16 October 2014

custom spash screen ios for long time.

- (void)splashAnimation{
    NSInteger timeForSplash = 3;
    UIImageView *imageViewSplash = [[UIImageView alloc] initWithFrame:mainWindow.frame];
    [imageViewSplash setImage:[UIImage imageNamed:@"Default-568h"]];
    [mainWindow addSubview:imageViewSplash];
    dispatch_after(dispatch_time(DISPATCH_TIME_NOW, timeForSplash * NSEC_PER_SEC), dispatch_get_main_queue(), ^{
        [imageViewSplash removeFromSuperview];
    });
}

If you want every time then add this method in

Wednesday, 3 September 2014

Calling webservice and response is nil, error code = 256; handle in ios

if you are getting error 256 in iOS/iPhone.
Error Domain=NSCocoaErrorDomain Code=256 "The operation couldn’t be completed. (Cocoa error 256.)" UserInfo=0x218446a0

This error coming due to your page is not in "Standards compliance mode", it may be in "Quirks mode".

To know the mode, open the webpage in firefox, click right mouse and open "View page Info".




If you want to open the url in non "Standards compliance mode" try this code =>






NSString *str = [NSString stringWithFormat:@"https://graph.facebook.com/me?access_token=CAADbwxRRgq8BANULcGGn3d4NPZB4LlP3tCL9YjYH3Nd0fD2XvgjG0qTECEmOsFhNhcu4NCdgYzQK3lYaATiedLRP4ZAIRgf8FBtDBYd22z5BrMabHlex12nZAbm8UfJTrPVRw5rjN8abi9"];


NSURL* url = [NSURL URLWithString:[str stringByReplacingPercentEscapesUsingEncoding:NSUTF8StringEncoding]];

NSError* error = nil;
NSData* data = [NSURLConnection sendSynchronousRequest:[NSURLRequest requestWithURL:url cachePolicy:NSURLRequestReloadIgnoringCacheData timeoutInterval:30] returningResponse:nil error:&error];
NSString *jsonStr = [NSString stringWithUTF8String:[data bytes]];
NSMutableDictionary *dictFromServer = [NSJSONSerialization JSONObjectWithData:urlData options:kNilOptions error:&error]
if (error) {
    NSLog(@"%@", [error localizedDescription]);
} else {
    NSLog(@"Data has loaded successfully.%@, in dict %@",jsonStr, dictFromServer);
}


Monday, 1 September 2014

for beta test url set in websites

itms-services://?action=download-manifest&url=http://testsite4me.com/Designs/swapmommy-demo/Swapmommy.plist

more detail use link
http://johannesluderschmidt.de/provision-ios-ipa-app-for-in-house-enterprise-distribution/2993/

Tuesday, 19 August 2014

build the iphone simulator build to check on some else simulator

Generate a Simulator Build

In order to generate a simulator build you will:
  • Find the folder containing your xcode project.
  • Open a terminal and run a couple of commands to generate the build.
  • Compress the simulator build into a zip file.

Find your Xcode project directory

Start or run iPhone Simulator using terminal

Assuming you have Xcode installed in `/Applications`, then you can do this from the command line to start the iPhone Simulator:

    $ open /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/Applications/iPhone\ Simulator.app

You could create a symbolic-link from your Desktop to make this easier:

    $ ln -s /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/Applications/iPhone\ Simulator.app ~/Desktop

As pointed out by @JackHahoney, you could also add an `alias` to your `~/.bash_profile`:

    alias iphone-sim='open /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/De‌​veloper/Applications/iPhone\ Simulator.app'

Which would mean you could start the iPhone Simulator from the command line with one easy-to-remember word:

    $ iphone-sim

Wednesday, 13 August 2014

Get delegate and window reference in iOS

AppDelegate *appDelegate = (AppDelegate*) [[UIApplication sharedApplication] delegate];



UIWindow *mainWindow = [[UIApplication sharedApplication] windows].lastObject;
// or
 UIWindow *mainWindow = [(AppDelegate*) [[UIApplication sharedApplication] delegate] window];


// If UINavigationController is on the rootViewController

UINavigationController *navController = (UINavigationController*) [[appDelegate window] rootViewController];



//=====================     AppDelegate.m          ====================
#define IS_IPHONE_5 ( fabs( ( double )[ [ UIScreen mainScreen ] bounds ].size.height - ( double )568 ) < DBL_EPSILON )

@implementation AppDelegate

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
    // Override point for customization after application launch.
    UIStoryboard *mainStoryboard = nil;
    if (IS_IPHONE_5) {
        mainStoryboard = [UIStoryboard storyboardWithName:@"Storyboard_iPhone5" bundle:nil];
    }
    else {
        mainStoryboard = [UIStoryboard storyboardWithName:@"Storyboard_iPhone4" bundle:nil];
    }
    
    self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
    self.window.rootViewController = [mainStoryboard instantiateInitialViewController];
    [self.window makeKeyAndVisible];
    return YES;
}

Repeat code in certain time peroid. periodically call a method

- (void)viewDidLoad
{
    [super viewDidLoad];
    
    [NSTimer scheduledTimerWithTimeInterval:1.0 // time in seconds
                                     target:self
                                   selector:@selector(timerFired)
                                   userInfo:nil
                                    repeats:YES];
}

- (void)timerFired{
    NSLog(@"Hello");
}

Monday, 28 July 2014

How to take screenshot programmatically in iOS SDK

/// first import

#import <QuartzCore/QuartzCore.h>

//// then  user this code to save images

if ([[UIScreen mainScreen] respondsToSelector:@selector(scale)])

    UIGraphicsBeginImageContextWithOptions(self.window.bounds.size, NO, [UIScreen mainScreen].scale);

else

    UIGraphicsBeginImageContext(self.window.bounds.size);

[self.window.layer renderInContext:UIGraphicsGetCurrentContext()];

UIImage *image = UIGraphicsGetImageFromCurrentImageContext();

UIGraphicsEndImageContext();

NSData * data = UIImagePNGRepresentation(image);

[data writeToFile:@"foo.png" atomically:YES];




thanks to Saurabh Sharma

http://www.makebetterthings.com/iphone/how-to-take-screenshot-programmatically-in-ios-sdk/

Monday, 28 April 2014

magical numbers

magical numbers
888 87 771 826 15 356
600 03 344 340 67 732
833 67 448 320 47 765
170 57 816 568 06 751
966 08 736 812 16 436

Tuesday, 18 February 2014

Method trace: from where method is called.

This is useful for long project, where we use third party APIs.
// Java Code
StackTraceElement[] stackTraceElements = Thread.currentThread().getStackTrace();
for (StackTraceElement item: stackTraceElements){
    System.out.println(item);
}