Quantcast
Channel: EmotiCODE - Snippets and Source Code Search Engine
Browsing all 110 articles
Browse latest View live

Android SDK - Android: Save and restore 'user preference' values using...

SharedPreferences prefs = getApplicationContext().getSharedPreferences("YourAppName", 0); // YourAppName is just a string to identify the prefs. 0 means other apps can't see your prefs. prefs. ...

View Article



Android SDK - Android: Prevent onCreate being called when the orientation of...

android:configChanges="orientation|keyboardHidden" e.g ...

View Article

Android SDK - Android ListActivity

public class ListAct extends ListActivity { public final String[] subs={"Java",".net","php","Adv c"}; under oncreate-- this.setListAdapter(new ArrayAdapter(this,android.R.layout.simple_list_item_1, ...

View Article

Android SDK - Basic Android Calculator

package newProject.test; //Code by ehrenb import android.app.Activity; import android.os.Bundle; import android.app.Activity; import android.os.Bundle; import android.view.View; import ...

View Article

Android SDK - Android: Use format strings in a strings.xml file

// in strings.xml.. Thanks for playing %s. You scored %d points! // and in the java code: String.format(getString(R.string.my_text), "Bob", 500 ...

View Article


Android SDK - Android: Set focus to a control

webView.requestFocus(View.FOCUS_DOWN ...

View Article

Android SDK - Handling Shake Events on Android 1.5

package com.gedankentank.android.sensor; import java.util.List; import android.hardware.Sensor; import android.hardware.SensorEvent; import android.hardware.SensorEventListener; import ...

View Article

Android SDK - android Plist parser xml Assets

/// Read plist from Assets private String readPlistFromAssets(Context context, String path) { StringBuffer sb = new StringBuffer(); BufferedReader br = null; try { br = new ...

View Article


Android SDK - Using getView and convertView in Android

public View getView(int position, View convertView, ViewGroup parent) { if (convertView == null) { convertView = mInflater.inflate(R.layout.item, parent, false); } ((TextView) convertView. ...

View Article


Android SDK - Integrate Adobe Photoshop Mobile inside your Android application

// code inside an Activity method Uri imageToEditUri = … // uri of image to edit String imageToEditMimeType = … // must be of type “image/*” Intent launchEditor = new Intent ...

View Article

Android SDK - Android: Iterate a JSONArray

JSONArray ar = new JSONArray(jsonString); for (int i = 0; i < ar.length(); i++) { JSONObject child = ar.getJSONObject(i); // do stuff with child ...

View Article

Android SDK - [android] setTimeout

protected Handler taskHandler = new Handler(); protected void setTimer( long time ) { Runnable t = new Runnable() { public void run() { runNextTask(); } }; taskHandler. ...

View Article

Android SDK - Android: Make Activity Full-Screen in code

requestWindowFeature(Window.FEATURE_NO_TITLE); getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN ...

View Article


Android SDK - Android MyOverlay extends Overlay

private class MyOverlay extends Overlay { private GeoPoint center; private float radius; private Paint cPaint; public MyOverlay(GeoPoint c) { center = c; radius = 20; cPaint = new ...

View Article

Android SDK - Android: Remove title/notifications bar programmatically

public class MainActivity extends Activity { /** Called when the activity is first created. */ @Override public void onCreate(Bundle savedInstanceState) { super.onCreate( ...

View Article


Android SDK - Determine if Intent Receiver Exists in Android

/** * Indicates whether the specified action can be used as an intent. This * method queries the package manager for installed packages that can * respond to an intent with the specified action ...

View Article

Android SDK - Send email from Android using Intent

Intent i = new Intent(Intent.ACTION_SEND); //i.setType("text/plain"); //use this line for testing in the emulator i.setType("message/rfc822") ; // use from live device i.putExtra(Intent. ...

View Article


Android SDK - android string to json object conversion

//MainActivity.java //==================== package com.v3; import org.json.JSONObject; import android.app.Activity; import android.os.Bundle; import android.util.Log; import android.view. ...

View Article

Android SDK - [android] Full Screen

@Override public void onCreate(Bundle savedInstanceState) { requestWindowFeature(Window.FEATURE_NO_TITLE); this.getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, ...

View Article

Android SDK - [android] window size

Display display = ((WindowManager) getSystemService(Context.WINDOW_SERVICE)).getDefaultDisplay(); float h = display.getHeight(); float w = display.getWidth ...

View Article
Browsing all 110 articles
Browse latest View live




Latest Images