Quantcast
Channel: Developer Feed - Snippet
Browsing all 178 articles
Browse latest View live

How to create a Splash Screen in Android?

packagecom.livrona.apps.justsikh.activity; importandroid.app.Activity;importandroid.content.Intent;importandroid.os.Bundle;...

View Article


How to create a Tabbed Screen in Android?

publicclass BaniTabbedScreen extends TabActivity implements OnTabChangeListener {  private TabHost tabHost;  @Override  publicvoid onCreate(Bundle savedInstanceState){...

View Article


How to create an Intent to launch audio in Android?

String audioUrl ="Your Audio URL mp3 file/stream here";Intent audioIntent =new Intent();Uri audioData = Uri.parse(audioUrl);audioIntent.setDataAndType(audioData, "audio/mp3");...

View Article

How to Youtube videoID from the URL in Android?

publicclass YouTubeUtils { publicstaticString getVideoIdFromUrl(String url){  Log.d("getVideoIdFromUrl : "+ url); String vid =null; try{   // <a href="http://www.youtube.com/watch?v=Vr_Bq_GWyuU"...

View Article

How to show an Alert Dialog in Android?

publicstaticvoid showDialog(finalContext context, finalString title, finalString message){    MainThread.run(context, newRunnable(){  @Override  publicvoid run(){  AlertDialog.Builder builder =new...

View Article


How to get content of Http URL as a String Android?

packagecom.livrona.andriod.commons.utils;...

View Article

How to check if file is writable in PHP?

function is_really_writable($file){    // If we're on a Unix server with safe_mode off we call is_writable        if(DIRECTORY_SEPARATOR=='/' AND @ini_get("safe_mode")==FALSE)        {...

View Article

How to write a utility method to print redirect in PHP?

function redirect($uri='',$method='location', $http_response_code=302){   if(!preg_match('#^https?://#i',$uri)){        $uri= BASE_URL .$uri;    }switch($method){...

View Article


How to get file extension in PHP?

        /* Extract the file extension         *         * @access      public         * @param       string         * @return      string         */            function get_extension($filename)...

View Article


How to create a UIButton programatically in iOS?

UIButton *button =[UIButton buttonWithType:UIButtonTypeRoundedRect]; button.frame= CGRectMake(100.0, 200.0, 180.0, 60.0); // on click, which method to call[button addTarget:self...

View Article

How to create and load URL in UIWebview in iOS?

// NSURL class is used to create an object which will hold the URL information.  // NSURLRequest is used to create a request to the URL.  // Method loadRequest of UIWebView is used to load the request...

View Article

How to clean phone number string in Objective C?

+(NSString*) cleanPhoneNumber:(NSString*) input{    NSString *output = @"";for(int i=0; i<[input length]; i++){    if(isdigit([input characterAtIndex:i])){      output=  [output...

View Article

How to create a PINAnnotationView in IOS?

  Annotation*anno =[[[Annotation alloc] init] autorelease];        anno.coordinate= xxx// get it map view;         anno.title= @"Current Location"; anno.subtitle=[NSString stringWithFormat:@"%f, %f",...

View Article


How to encode Mysql Result into JSON?

<?php        // connect to db        mysql_set_charset('utf8',$dbc);        $sqlStr="SELECT * FROM category;";        $result=mysql_query($sqlStr,$dbc) or die($sqlStr);        $rows=array();...

View Article

How to clean file name for security reasons in PHP?

/**         * Clean the file name for security         *         * @access      public         * @param       string         * @return      string         */                    function...

View Article


How to limit file name to a given length in PHP?

        /**         * Limit the File Name Length         *         * @access      public         * @param       string         * @return      string         */                    function...

View Article

How to sent Push Notification for APNS in Java?

importcom.notnoop.apns.APNS;importcom.notnoop.apns.ApnsService; ApnsService service =         APNS.newService()         .withCert("../config/push-prod-cert.p12", "xyz")...

View Article


How to send email for GoDaddy using Java?

packagecom.infuze.server.util; importjava.util.List;importjava.util.Properties;...

View Article

How to cleanup Quartz Jobs on shutdown in Java?

/*** Shutdown the scheduler */privatevoid shutdownScheduler(){ try{   log.info("Performing Job Resources CleanUp"); Scheduler scheduler = SchedulerManager.getInstance().getScheduler(); if(scheduler...

View Article

How to print NSMutableArray in Objective C?

SolutionNSMutableArray array = nil;array = [NSMutableArray arrayWithObjects:@"Hat", @"Bat", @"Mat" nil];// method 1NSLog(@"array: %@", array);// method2for (id obj in array)   NSLog(@"obj: %@", obj);

View Article
Browsing all 178 articles
Browse latest View live