Android SDK - Dynamic rounded rectangle [android]
public static ShapeDrawable createUserDrawable(String color) { ShapeDrawable drawable = new ShapeDrawable(); drawable.setBounds(0, 0, 10, 20); float radius = 4; float[] radii = new ...
View ArticleAndroid SDK - Simple alert for Android
import android.content.Context; import android.widget.Toast; import android.view.Gravity; public static void alert(Context context, String message) { //New Toast Object with short duration ...
View ArticleAndroid SDK - Android Conent provider
public class MainActivity extends ListActivity { //Declare CONTENT_URI for contacts public static final Uri CONTENT_URI = Uri.parse("content://com.android.contacts/contacts/1557"); public void ...
View ArticleAndroid SDK - JavaScript / Native app inter communication in Android
WebViewwebView=(WebView)findViewById(R.id.web_view); WebSettingssettings=webView.getSettings(); settings.setJavaScriptEnabled(true); settings.setDomStorageEnabled(true); settings. ...
View ArticleAndroid SDK - Android: Template for an AsyncTask (task to run in a background...
public class MyThins { private Object[] itemsToProcess; private OnProgressListener onProgressListener; private OnFinishedListener onFinishedListener; private FilesNeedDownloadingCheckerTask ...
View ArticleAndroid SDK - Android Conent provider
public class MainActivity extends ListActivity { //Declare CONTENT_URI for contacts public static final Uri CONTENT_URI = Uri.parse("content://com.android.contacts/contacts/1557"); public void ...
View ArticleAndroid SDK - Start android browser form your app
Intent viewIntent = new Intent("android.intent.action.VIEW",Uri.parse("http://www.klingmobile.com")); startActivity(viewIntent ...
View ArticleAndroid SDK - Android get IP Address
public String getLocalIpAddress() { try { for (Enumeration en = NetworkInterface.getNetworkInterfaces(); en.hasMoreElements();) { NetworkInterface intf = en.nextElement ...
View ArticleAndroid SDK - Android insert new contact
private Uri insertContact(Context context, String name, String phone) { ContentValues values = new ContentValues(); values.put(People.NAME, name); Uri uri = ...
View ArticleAndroid SDK - Android Market URL Format
Intent intent = new Intent(Intent.ACTION_VIEW); intent.setData(Uri.parse("market://search?q=pname:PriceBunnyClient")); startActivity(intent ...
View ArticleAndroid SDK - Android lunch Dialer, Message box, Browser, Contact List
Button bCall,bMsg,bContact,bURL; public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); bCall=(Button) ...
View ArticleAndroid SDK - Android: Download a string from a url
// DOWNLOAD THE PROJECT JSON FILE HttpClient httpclient = new DefaultHttpClient(); try { HttpGet httpget = new HttpGet(url); Log.d(TAG, "executing request " + ...
View ArticleAndroid SDK - Creating a reflection effect in Android
private Bitmap getReflection(Bitmap bitmap) { Bitmap reflection = reflections.get(bitmap); if (reflection == null) { // We're cropping the height of the reflection to 80 ...
View ArticleAndroid SDK - [android] Load new View
Intent i = new Intent(); i.setClassName("com.esites.android.mviews", "com.esites.android.mviews.view1"); startActivity(i ...
View ArticleAndroid SDK - Android share text or image
For sharing an image, like in the example picture, it would be something like this: Intent share = new Intent(Intent.ACTION_SEND); share.setType("image/jpeg"); share.putExtra(Intent. ...
View ArticleAndroid SDK - Android dialog
AlertDialog.Builder alertbox = new AlertDialog.Builder(ActivityA.this); alertbox.setTitle("Demo"); alertbox.setMessage(message); alertbox.setPositiveButton("okay/Exit/Cancel", new ...
View ArticleAndroid SDK - android ninepatchdrawable draw scalable
NinePatchDrawable drawable = (NinePatchDrawable) context.getResources().getDrawable(R.drawable.btn_default_normal); paint.setColor(Color.BLUE); int width = (int)this.mRect.width(); int height = ( ...
View ArticleAndroid SDK - Android: List files of particular type in a directory
File f = new File("folder"); FilenameFilter f2 = new FilenameFilter() { public boolean accept(File dir, String filename) { return filename.endsWith(filename); } }; f.list(f2) (list of files ...
View ArticleAndroid SDK - Own sqlite database in android
package com.package.name; import java.io.FileOutputStream; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; import android.content.Context; import android ...
View ArticleAndroid SDK - Integrate Linkedin, Facebook, Twitter, MySpace in Android App...
public class ShareButtonActivity extends Activity { // SocialAuth Component SocialAuthAdapter adapter; @Override public void onCreate(Bundle savedInstanceState) { super. ...
View Article