Author Archive

Check if SD card is present

Sometimes we need to know whether an SD card is present or not. So here is a check to see if an SD card is present. It returns true if the SD card is present and writable, false otherwise.

 

Incoming search terms:

  • prepration sd card android os

AlertDialog rating

 

This code generates a random integer using Android’s Random class, and sets a randomly selected drawable as background for a View.

Place your images into /res/drawable/ and update private int pics[] with the drawables from which you want to pick one randomly.

A quick a simple Alert Dialog Popup with Title, Message, Icon and Button

Don’t forget to import add the imports

import android.app.AlertDialog; import android.content.DialogInterface;

Android Notification

 

How to Make an Activity Fullscreen

This code makes the current Activity Full-Screen. No Status-Bar or anything except the Activity-Window

find() uses a pattern syntax. A dot represents “any character.” This will match the first character of any string you search. In order to search for a literal dot, you need to doo this:

To set the height and width of a UITextfield

CGRect frameRect = _textfield.frame;

frameRect.size.height = height;

_textfield.frame = frameRect;

Remainder of float division

Use fmod, to compute the floating point modulus.

If you want to use double instead of float you’d use fmod instead.

If you want to use long double you’d use fmodl instead.

Executing a HTTP POST Request with HttpClient

public void postData() {

// Create a new HttpClient and Post Header

HttpClient httpclient = new DefaultHttpClient();

HttpPost httppost = new HttpPost(“http://www.yoursite.com/script.php”);

try {

// Add your data

List<NameValuePair> nameValuePairs = new ArrayList<NameValuePair>(2);

nameValuePairs.add(new BasicNameValuePair(“id”, “12345″));

nameValuePairs.add(new BasicNameValuePair(“stringdata”, “AndDev is Cool!”));

httppost.setEntity(new UrlEncodedFormEntity(nameValuePairs));

// Execute HTTP Post Request

HttpResponse response = httpclient.execute(httppost);

}

catch (ClientProtocolException e) {

// TODO Auto-generated catch block

}

catch (IOException e) {

// TODO Auto-generated catch block

}

}

Incoming search terms:

  • arduino http post example
  • arduino httpclient post
  • arduino post request
  • cocos2dx httpclient php
  • how to create news HttpPost HttpClient
  • how to make http client in ios
  • httpclient arduino
  • httpclient put request arduino
  • httpclient to post data with captcha
Page 1 of 712345...Last »