Access ordered images and video in same Cursor

After lots of research and playing around with source code, I’m finally a bit more familiar with the Android filesystem. To get a single Cursor which can access information about both Images and Video I used the following: // Get relevant columns for use later. String[] projection = { MediaStore.Files.FileColumns._ID, MediaStore.Files.FileColumns.DATA, MediaStore.Files.FileColumns.DATE_ADDED, MediaStore.Files.FileColumns.MEDIA_TYPE, MediaStore.Files.FileColumns.MIME_TYPE, MediaStore.Files.FileColumns.TITLE … Read more

Django: how do you serve media / stylesheets and link to them within templates

I just had to figure this out myself. settings.py: MEDIA_ROOT = ‘C:/Server/Projects/project_name/static/’ MEDIA_URL = ‘/static/’ ADMIN_MEDIA_PREFIX = ‘/media/’ urls.py: from django.conf import settings … if settings.DEBUG: urlpatterns += patterns(”, (r’^static/(?P<path>.*)$’, ‘django.views.static.serve’, {‘document_root’: settings.MEDIA_ROOT}), ) template file: <link rel=”stylesheet” type=”text/css” href=”https://stackoverflow.com/static/css/style.css” /> With the file located here: “C:/Server/Projects/project_name/static/css/style.css”

Do iPhone / Android browsers support CSS @media handheld?

You can use @media queries: <link rel=”stylesheet” href=”https://stackoverflow.com/questions/3893342/path/to/iphone.css” media=”only screen and (max-device-width:480px)”/> This particular version will target the iPhone (and any other device with a screen of max-device-width of 480px. Apple, for the iPhone, though this is from memory so I can’t be entirely sure of its accuracy, chose to disregard the use of handheld … Read more

Div show/hide media query

I’m not sure, what you mean as the ‘mobile width’. But in each case, the CSS @media can be used for hiding elements in the screen width basis. See some example: <div id=”my-content”></div> …and: @media screen and (min-width: 0px) and (max-width: 400px) { #my-content { display: block; } /* show it on small screens */ … Read more

How do you get/set media volume (not ringtone volume) in Android?

private AudioManager audio; Inside onCreate: audio = (AudioManager) getSystemService(Context.AUDIO_SERVICE); Override onKeyDown: @Override public boolean onKeyDown(int keyCode, KeyEvent event) { switch (keyCode) { case KeyEvent.KEYCODE_VOLUME_UP: audio.adjustStreamVolume(AudioManager.STREAM_MUSIC, AudioManager.ADJUST_RAISE, AudioManager.FLAG_SHOW_UI); return true; case KeyEvent.KEYCODE_VOLUME_DOWN: audio.adjustStreamVolume(AudioManager.STREAM_MUSIC, AudioManager.ADJUST_LOWER, AudioManager.FLAG_SHOW_UI); return true; default: return false; } }

Play sound using soundpool example

Create a folder named as raw under your_app/res/. Then paste your ringtone in this folder, for example your_app/res/raw/ringtone.mp3. Now use the following code: SoundPool soundPool = new SoundPool(5, AudioManager.STREAM_MUSIC, 0); int soundId = soundPool.load(context, R.raw.ringtone, 1); // soundId for reuse later on soundPool.play(soundId, 1, 1, 0, 0, 1); Be sure to release the SoundPool resources … Read more

How to record video from background of application : Android

1- I have created a activity to start service like this: package com.android.camerarecorder; import android.app.Activity; import android.content.Intent; import android.hardware.Camera; import android.os.Bundle; import android.view.SurfaceHolder; import android.view.SurfaceView; import android.view.View; import android.widget.Button; public class CameraRecorder extends Activity implements SurfaceHolder.Callback { private static final String TAG = “Recorder”; public static SurfaceView mSurfaceView; public static SurfaceHolder mSurfaceHolder; public static Camera … Read more