Search Results

Search found 180 results on 8 pages for 'sdcard'.

Page 5/8 | < Previous Page | 1 2 3 4 5 6 7 8  | Next Page >

  • How to stop Native video player in Blackberry?

    - by Rajapandian
    Hi, I created one blackberry application which will play a video on a button click.This is my code, invocation=new Invocation("file:///SDCard/Blackberry/videos/PlayingVideo/funny.mp4"); registry=Registry.getRegistry("net.rim.device.api.content.BlackBerryContentHandler"); try { registry.invoke(invocation); } catch(Exception e) { } Now i can play the Video file.After clicking the Back button the native player is going to the background.It always running in the background.But i want to close that player.I have no idea about how to do it.Anybody knows please help me.

    Read the article

  • troubles reading other apps config files

    - by Aivlis
    Hi guys, I have a problem. I have to access to the data folder of other applications from my application to read configuration's file and so on but it seems it's possible only to read data from the sdcard and my application's data folder. Can you suggest me how to solve this problem?

    Read the article

  • Problem in creating Temporary File in android?

    - by Rajapandian
    Hi, In my MediaPlayer application for streaming Video i am using the following code File temp = File.createTempFile("mediaplayertmp", "dat"); while running it throws exceptions like Parent directory of file in not writable:/sdcard/ mediaplayertmp43912.dat I dont how to handle this problem,and i want to know that when we execute that code means where the file will be created.any one knows the solution means please help with some code.

    Read the article

  • open text file in android emulator

    - by Karthick
    How to open a text file in android.I am using android 1.5 emulator and eclipse ide.I try to push files to the device emulator.In Eclipse ide android file explorer has the text file and image files in the sdcard.In the Emulator Image files are in the Gallery.How can i see the text file in the android emulator.

    Read the article

  • Android - What is mediarecorder's maximum maxfilesize?

    - by andy_spoo
    Android - What is the maximum file size that setMaxFileSize can be set to in respect to Androids mediarecorder? I know it's somewhere between 4147483650 and 5147483650. Why is there a limit in the first place? I'm recording on to a SDCARD, detecting the size of the cards space before we run. "ERROR/AuthorDriver(31): setParameter(max-filesize = 7270309850) failed with result -5" "ERROR/AuthorDriver(31): Ln 903 handleSetParameters("max-filesize=7270309850") error" "ERROR/AndroidRuntime(409): java.lang.RuntimeException: setMaxFileSize failed."

    Read the article

  • Problems switching to QEMU control panel with -nographics

    - by tor
    It seems that the terminal does not recognise CTRL+ALT+2 when typed, so I don't know how to quit the QEMU emulation, or switch to the QEMU control panel. I am running Mac OSX Lion, and I type $ qemu-system-arm -M verdex -pflash flash.img -nographic -sd sdcard.img to start QEMU emulation of an ARM system in the Terminal. I learned from this site that typing CTRL+ALT+2 should work, but the only thing that happens to me, is that a "2" is printed on the command line of the virtual operating system. Any ideas on what could be wrong? Is this a Mac specific issue? (The same problem occurs in both terminal.app and iTerm2)

    Read the article

  • Bootable SD card still has small memory, even after formating

    - by Inazuma
    I have an SD card which I used to run my RaspberryPi. I wanted to update the copy of raspbian on it, so I formated the card using the software from www.sdcard.com. I followed all the instructions correctly, however the size of my SD card didn't go back to it's default. It is a 4gb SD card, which after it's spell in the RaspberryPi had shrunken to 52mb, which I understand is normal. After formatting, the size rose to 3.69gb. This means that there is not enough space to install a new OS, so how can I make my SD card 4gb again? Any help would be much appreciated!

    Read the article

  • Ubuntu.sh on Android Phone

    - by pjtatlow
    So today I noticed something weird on my phone. I used a terminal emulator to see what I could do with it, and noticed that there is a file called ubuntu.sh. I tried to run it and got all sorts of permission denied errors, and then I decided to root my phone. But now I'm nervous to run it, does anyone know what it does or why it is there? edit I forgot to mention that I have an AT&T Morotola Atrix 4G running Android 2.3.6. Also when I use the app SSHDroid to go into my phone from my Ubuntu machine, I'm greeted with this: "The programs included with the Ubuntu system are free software; the exact distribution terms for each program are described in the individual files in /usr/share/doc/*/copyright. Ubuntu comes with ABSOLUTELY NO WARRANTY, to the extent permitted by applicable law. To access official Ubuntu documentation, please visit: http://help.ubuntu.com/" Also, here are the contents of ubuntu.sh #!/bin/sh export PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin export LD_LIBRARY_PATH=/usr/lib:/usr/local/lib # make sure no left-over pidfiles, etc. ####################################### rm -fr /var/run/* rm -fr /var/lock/* chmod 666 /system/usr/keychars/* rm -f /tmp/tab* mkdir -p /home/adas/Desktop chmod 755 /home/adas/Desktop chown -R adas.adas /home/adas/Desktop [ -x /usr/bin/firefox-install-profile ] && /usr/bin/firefox-install-profile [ -x /usr/local/bin/check-citrix-certs.sh ] && /usr/local/bin/check-citrix-certs.sh [ -x /usr/bin/migrate-webapps ] && /usr/bin/migrate-webapps # boot scripts ############## /etc/init.d/rc S # lock down /var for CTS ######################## chown root.adas /var/tmp chown root.adas /var/lock chmod 775 /var/tmp chmod 775 /var/lock chmod 666 /dev/socket/dbus chmod 666 /dev/null # runlevel 2 scripts #################### /etc/init.d/rc 2 cp /sdcard/*.lic /data/ chmod 666 /data/*.lic This is really strange, any ideas?

    Read the article

  • Android save Checkbox State in ListView with Cursor Adapter

    - by Ricardo
    I cant find a way to save the checkbox state when using a Cursor adapter. Everything else works fine but if i click on a checkbox it is repeated when it is recycled. Ive seen examples using array adapters but because of my lack of experience im finding it hard to translate it into using a cursor adapter. Could someone give me an example of how to go about it. Any help appreciated. private class PostImageAdapter extends CursorAdapter { private static final int s = 0; private int layout; Bitmap bm=null; private String PostNumber; TourDbAdapter mDbHelper; public PostImageAdapter (Context context, int layout, Cursor c, String[] from, int[] to, String Postid) { super(context, c); this.layout = layout; PostNumber = Postid; mDbHelper = new TourDbAdapter(context); mDbHelper.open(); } @Override public View newView(Context context, final Cursor c, ViewGroup parent) { ViewHolder holder; LayoutInflater inflater=getLayoutInflater(); View row=inflater.inflate(R.layout.image_post_row, null); holder = new ViewHolder(); holder.Description = (TextView) row.findViewById(R.id.item_desc); holder.cb = (CheckBox) row.findViewById(R.id.item_checkbox); holder.DateTaken = (TextView) row.findViewById(R.id.item_date_taken); holder.Photo = (ImageView) row.findViewById(R.id.item_thumb); row.setTag(holder); int DateCol = c.getColumnIndex(TourDbAdapter.KEY_DATE); String Date = c.getString(DateCol); int DescCol = c.getColumnIndex(TourDbAdapter.KEY_CAPTION); String Description = c.getString(DescCol); int FileNameCol = c.getColumnIndex(TourDbAdapter.KEY_FILENAME); final String FileName = c.getString(FileNameCol); int PostRowCol = c.getColumnIndex(TourDbAdapter.KEY_Post_ID); String RowID = c.getString(PostRowCol); String Path = "sdcard/Tourabout/Thumbs/" + FileName + ".jpg"; Bitmap bm = BitmapFactory.decodeFile(Path, null); holder.Photo.setImageBitmap(bm); holder.DateTaken.setText(Date); holder.Description.setText(Description); holder.cb.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { CheckBox cBox = (CheckBox) v; if (cBox.isChecked()) { mDbHelper.UpdatePostImage(FileName, PostNumber); } else if (!cBox.isChecked()) { mDbHelper.UpdatePostImage(FileName, ""); } } }); return row; }; @Override public void bindView(View row, Context context, final Cursor c) { ViewHolder holder; holder = (ViewHolder) row.getTag(); int DateCol = c.getColumnIndex(TourDbAdapter.KEY_DATE); String Date = c.getString(DateCol); int DescCol = c.getColumnIndex(TourDbAdapter.KEY_CAPTION); String Description = c.getString(DescCol); int FileNameCol = c.getColumnIndex(TourDbAdapter.KEY_FILENAME); final String FileName = c.getString(FileNameCol); int PostRowCol = c.getColumnIndex(TourDbAdapter.KEY_Post_ID); String RowID = c.getString(PostRowCol); String Path = "sdcard/Tourabout/Thumbs/" + FileName + ".jpg"; Bitmap bm = BitmapFactory.decodeFile(Path, null); File x = null; holder.Photo.setImageBitmap(bm); holder.DateTaken.setText(Date); holder.Description.setText(Description); holder.cb.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { CheckBox cBox = (CheckBox) v; if (cBox.isChecked()) { mDbHelper.UpdatePostImage(FileName, PostNumber); } else if (!cBox.isChecked()) { mDbHelper.UpdatePostImage(FileName, ""); } } }); } } static class ViewHolder{ TextView Description; ImageView Photo; CheckBox cb; TextView DateTaken; } }

    Read the article

  • Android Dev Help: Saving an image from Res/raw or Asset folder to the Sd card

    - by Lucy
    Android Development Query Hello, I wonder if anyone could help me, i am trying to save an image (jpg or png) from the res/raw or assets folder to the SD card location (/sdcard/DCIM/). I have been following a tutorial which can save an image from a URL to the SD card Root, but i have looked everywhere to be able to save from res/raw or asset folder instead, and to a differnet location onthe sd card /sdcard/DCIM/ Here is the code, can anyone show me how to do the above from this? Thanks Lucy public class home extends Activity { private File file; private String imgNumber; private Button btnDownload; /** Called when the activity is first created. */ @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); btnDownload=(Button)findViewById(R.id.btnDownload); btnDownload.setOnClickListener(new OnClickListener() { public void onClick(View v) { btnDownload.setText("Download is in Progress."); String savedFilePath=Download("http://www.domain.com/android1.png"); Toast.makeText(getApplicationContext(), "File is Saved in "+savedFilePath, 1000).show(); if(savedFilePath!=null) { btnDownload.setText("Download Completed."); } } }); } public String Download(String Url) { String filepath=null; try { //set the download URL, a url that points to a file on the internet //this is the file to be downloaded URL url = new URL(Url); //create the new connection HttpURLConnection urlConnection = (HttpURLConnection) url.openConnection(); //set up some things on the connection urlConnection.setRequestMethod("GET"); urlConnection.setDoOutput(true); //and connect! urlConnection.connect(); //set the path where we want to save the file //in this case, going to save it on the root directory of the //sd card. File SDCardRoot = Environment.getExternalStorageDirectory(); //create a new file, specifying the path, and the filename //which we want to save the file as. String filename= "download_"+System.currentTimeMillis()+".png"; // you can download to any type of file ex:.jpeg (image) ,.txt(text file),.mp3 (audio file) Log.i("Local filename:",""+filename); file = new File(SDCardRoot,filename); if(file.createNewFile()) { file.createNewFile(); } //this will be used to write the downloaded data into the file we created FileOutputStream fileOutput = new FileOutputStream(file); //this will be used in reading the data from the internet InputStream inputStream = urlConnection.getInputStream(); //this is the total size of the file int totalSize = urlConnection.getContentLength(); //variable to store total downloaded bytes int downloadedSize = 0; //create a buffer... byte[] buffer = new byte[1024]; int bufferLength = 0; //used to store a temporary size of the buffer //now, read through the input buffer and write the contents to the file while ( (bufferLength = inputStream.read(buffer)) > 0 ) { //add the data in the buffer to the file in the file output stream (the file on the sd card fileOutput.write(buffer, 0, bufferLength); //add up the size so we know how much is downloaded downloadedSize += bufferLength; //this is where you would do something to report the prgress, like this maybe Log.i("Progress:","downloadedSize:"+downloadedSize+"totalSize:"+ totalSize) ; btnDownload.setText("download Status:"+downloadedSize+" / "+totalSize); } //close the output stream when done fileOutput.close(); if(downloadedSize==totalSize) filepath=file.getPath(); //catch some possible errors... } catch (MalformedURLException e) { e.printStackTrace(); } catch (IOException e) { filepath=null; btnDownload.setText("Internet Connection Failed.\n"+e.getMessage()); e.printStackTrace(); } Log.i("filepath:"," "+filepath) ; return filepath; } }

    Read the article

  • Select Multiple Images Using GalleryView

    - by hwrdprkns
    Hi guys, I was just wondering if Android had built in code so that I could select multiple images in a gallery-view and then have those images exported as filenames in a string array(ex /sdcard/~f1.jpg, /sdcard/~f2.jpg,...). I have the gallery code here, but I'm not sure what modifications need to be made. Any help is appreciated. Thanks! // take_picture = (Button)findViewById(R.id.take_picture); // Here we set up a string array of the thumbnail ID column we want to // get back String[] proj = { MediaStore.Images.Thumbnails._ID }; if(proj.length == 0) { nopic.setVisibility(View.VISIBLE); } // Now we create the cursor pointing to the external thumbnail store cursor = managedQuery( MediaStore.Images.Thumbnails.EXTERNAL_CONTENT_URI, proj, // Which // columns // to // return null, // WHERE clause; which rows to return (all rows) null, // WHERE clause selection arguments (none) null); // Order-by clause (ascending by name) /* take_picture.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { Intent i = new Intent(GalleryActivity.this, CameraActivity.class); startActivity(i); } }); */ // We now get the column index of the thumbnail id column_index = cursor .getColumnIndexOrThrow(MediaStore.Images.Thumbnails._ID); // Reference the Gallery view g = (Gallery) findViewById(R.id.gallery); if(proj.length == 0) { nopic.setVisibility(View.VISIBLE); g.setVisibility(View.GONE); } // Set the adapter to our custom adapter (below) g.setAdapter(new ImageAdapter(this)); // Set a item click listener, and just Toast the clicked position g.setOnItemClickListener(new OnItemClickListener() { public void onItemClick(AdapterView parent, View v, int position, long id) { // Now we want to actually get the data location of the file String[] proj = { MediaStore.Images.Media.DATA }; // We request our cursor again cursor = managedQuery( MediaStore.Images.Media.EXTERNAL_CONTENT_URI, proj, // Which // columns // to // return null, // WHERE clause; which rows to return (all rows) null, // WHERE clause selection arguments (none) null); // Order-by clause (ascending by name) // We want to get the column index for the data uri column_index = cursor .getColumnIndexOrThrow(MediaStore.Images.Media.DATA); // Lets move to the selected item in the cursor cursor.moveToPosition((int) g.getSelectedItemId()); // And here we get the filename String filename = cursor.getString(column_index); Log.v("GalleryActivity", filename); Toast.makeText(GalleryActivity.this, filename, Toast.LENGTH_SHORT).show(); setPrefs(filename); Intent i = new Intent(GalleryActivity.this, OtherClass.class); startActivity(i); } }); } And the ImageAdapter code here: public class ImageAdapter extends BaseAdapter { int mGalleryItemBackground; public ImageAdapter(Context c) { mContext = c; // See res/values/attrs.xml for the that defines // Gallery1. TypedArray a = obtainStyledAttributes(R.styleable.Gallery); mGalleryItemBackground = a.getResourceId( R.styleable.Gallery_android_galleryItemBackground, 0); a.recycle(); } public int getCount() { return cursor.getCount(); } public Object getItem(int position) { return position; } public long getItemId(int position) { return position; } public View getView(int position, View convertView, ViewGroup parent) { ImageView i = new ImageView(mContext); if (convertView == null) { cursor.moveToPosition(position); int id = cursor.getInt(column_index); i.setImageURI(Uri.withAppendedPath( MediaStore.Images.Thumbnails.EXTERNAL_CONTENT_URI, "" + id)); i.setScaleType(ImageView.ScaleType.FIT_XY); i.setLayoutParams(new Gallery.LayoutParams(200, 200)); // The preferred Gallery item background i.setBackgroundResource(mGalleryItemBackground); } return i; } } Again any help is appreciateds! Just to let you guys know, the gallery works fine (for one image) as in it exports the filename correctly. Just need to know if there is an easy way to select multiples and export them. Thanks again!

    Read the article

  • Logcat error: "addView(View, LayoutParams) is not supported in AdapterView" in a ListView

    - by HacKreatorz
    I'm doing an aplication for Android and something I need is that it shows a list of all files and directories in the SD Card and it has to be able to move through the different directories. I found a good tutorial in anddev: http://bit.ly/h4GyFC I modified a few things so the aplication moves in the SD Card and not in Android root Directories but the rest is mostly the same. This is my xml file for the activity: <?xml version="1.0" encoding="utf-8"?> <ListView xmlns:android="http://schemas.android.com/apk/res/android" android:id="@id/android:list" android:layout_width="fill_parent" android:layout_height="fill_parent"> <TextView android:layout_width="fill_parent" android:layout_height="wrap_content" /> </ListView> And this is the code for the Activity: import hackreatorz.cifrador.R; import java.io.File; import java.util.ArrayList; import android.app.ListActivity; import android.content.res.Configuration; import android.os.Bundle; import android.view.View; import android.widget.ArrayAdapter; import android.widget.ListView; import android.widget.Toast; public class ArchivosSD extends ListActivity { private ArrayList<String> directoryEntries = new ArrayList<String>(); private File currentDirectory = new File("/sdcard/"); @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); browseToSD(); } @Override public void onConfigurationChanged(Configuration newConfig) { super.onConfigurationChanged(newConfig); } private void browseToSD() { browseTo(new File("/sdcard/")); } private void upOneLevel() { if(this.currentDirectory.getParent() != null) this.browseTo(this.currentDirectory.getParentFile()); } private void browseTo(final File directory) { if (directory.isDirectory()) { this.currentDirectory = directory; fill(directory.listFiles()); } else { Toast.makeText(ArchivosSD.this, this.directoryEntries.get(this.getSelectedItemPosition()), Toast.LENGTH_SHORT).show(); } } private void fill(File[] files) { this.directoryEntries.clear(); this.directoryEntries.add(getString(R.string.current_dir)); if(this.currentDirectory.getParent() != null) this.directoryEntries.add(getString(R.string.up_one_level)); int currentPathStringLength = (int) this.currentDirectory.getAbsoluteFile().length(); for (File file : files) { this.directoryEntries.add(file.getAbsolutePath().substring(currentPathStringLength)); } setListAdapter(new ArrayAdapter<String>(this, R.layout.archivos_sd, this.directoryEntries)); } @Override protected void onListItemClick(ListView l, View v, int position, long id) { int selectionRowID = (int) this.getSelectedItemPosition(); String selectedFileString = this.directoryEntries.get(selectionRowID); if (selectedFileString.equals(".")) { this.browseToSD(); } else if(selectedFileString.equals("..")) { this.upOneLevel(); } else { File clickedFile = null; clickedFile = new File(this.currentDirectory.getAbsolutePath() + this.directoryEntries.get(selectionRowID)); if(clickedFile != null) this.browseTo(clickedFile); } } } I don't get any errores in Eclipse, but I get a Force Close when running the aplication on my phone and when I look at Logcat I see the following: 01-01 23:30:29.858: ERROR/AndroidRuntime(14911): FATAL EXCEPTION: main *01-01 23:30:29.858: ERROR/AndroidRuntime(14911): java.lang.UnsupportedOperationException: addView(View, LayoutParams) is not supported in AdapterView* I don't have a clue what to do, I've looked up in Google and I didn't find anything and I did the same at stackoverflow. This is my first aplication in Java and for Android so I'm a real n00b and if the answer was there, I didn't understand it so I would really apreciate if you could explain what I should do to fix this error and why. Thanks for everything in advanced.

    Read the article

  • Get content uri from file path in android

    - by frieza
    Hi, I know the absolute path of an image (say for eg, /sdcard/cats.jpg). Is there any way to the content uri for this file ? Actually in my code I download an image and save it at a particular location. In order to set the image in an ImageView currently I open the file using the path, get the bytes and create a bitmap and then set the bitmap in the ImageView. This is a very slow process, instead if I could get the content uri then I could very easily use the method ImageView.setImageUri(uri) Thanks

    Read the article

  • Android - Read PNG image without alpha and decode as ARGB_8888 Android

    - by loki666
    I try to read an image from sdcard (in emulator) and then create a Bitmap image with the "BitmapFactory.decodeByteArray" method. I set the options: options.inPrefferedConfig = Bitmap.Config.ARGB_8888 options.inDither = false Then I extract the pixels into a ByteBuffer. ByteBuffer buffer = ByteBuffer.allocateDirect(width*height*4) bitmap.copyPixelsToBuffer(buffer) I use this ByteBuffer then in the JNI to convert it into RGB format and want to calculate on it. But always I get false data - I test without modifying the ByteBuffer. Only thing I do is to put it into the native method into JNI. Then cast it into a unsigned char* and convert it back into a ByteBuffer before returning it back to Java. Before displaying the image I get data back with bitmap.copyPixelsFromBuffer( buffer ) But then it has wrong data in it. My Question is if this is because the image is internally converted into RGB 565 or what is wrong here? May anybody has an idea, it would be great!

    Read the article

  • XML Reading org.xml.sax.SAXParseException: Expecting end of file.

    - by vivekbirdi
    Hi, I am getting problem while parsing XML File using JDE 4.6. FileConnection fconn = (FileConnection)Connector.open ("file:///SDCard/Dictionary.xml",Connector.READ_WRITE); InputStream din= fconn.openInputStream(); DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); DocumentBuilder builder = factory.newDocumentBuilder(); Document document = builder.parse(din); here I am getting Exception at Document document = builder.parse(din); org.xml.sax.SAXParseException: Expecting end of file. please give me some solution. Thanks

    Read the article

  • Android cooliris gallery developer documentation

    - by mefesto
    Does anyone know how to integrate with the new Gallery3D app (cooliris android gallery)? I want to launch that app so it shows the thumbnails for only a specific folder. For example, say my app downloads images from my server and stores them in a folder on the sd-card (/sdcard/myapp/image-cache/someid/*). I'd like to be able to do something like the following: // within an activity Uri uri = Uri.withAppendedPath(Media.EXTERNAL_CONTENT_URI, "myapp/image-cache/someid"); Intent intent = new Intent(Intent.ACTION_VIEW, uri); startActivity(intent); Thanks.

    Read the article

  • Android source code not working, reading frame buffer through glReadPixels

    - by Muhammad Ali Rajput
    Hi, I am new to Android development and have an assignment to read frame buffer data after a specified interval of time. I have come up with the following code: public class mainActivity extends Activity { Bitmap mSavedBM; private EGL10 egl; private EGLDisplay display; private EGLConfig config; private EGLSurface surface; private EGLContext eglContext; private GL11 gl; protected int width, height; //Called when the activity is first created. @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); // get the screen width and height DisplayMetrics dm = new DisplayMetrics(); getWindowManager().getDefaultDisplay().getMetrics(dm); int screenWidth = dm.widthPixels; int screenHeight = dm.heightPixels; String SCREENSHOT_DIR = "/screenshots"; initGLFr(); //GlView initialized. savePixels( 0, 10, screenWidth, screenHeight, gl); //this gets the screen to the mSavedBM. saveBitmap(mSavedBM, SCREENSHOT_DIR, "capturedImage"); //Now we need to save the bitmap (the screen capture) to some location. setContentView(R.layout.main); //This displays the content on the screen } private void initGLFr() { egl = (EGL10) EGLContext.getEGL(); display = egl.eglGetDisplay(EGL10.EGL_DEFAULT_DISPLAY); int[] ver = new int[2]; egl.eglInitialize(display, ver); int[] configSpec = {EGL10.EGL_NONE}; EGLConfig[] configOut = new EGLConfig[1]; int[] nConfig = new int[1]; egl.eglChooseConfig(display, configSpec, configOut, 1, nConfig); config = configOut[0]; eglContext = egl.eglCreateContext(display, config, EGL10.EGL_NO_CONTEXT, null); surface = egl.eglCreateWindowSurface(display, config, SurfaceHolder.SURFACE_TYPE_GPU, null); egl.eglMakeCurrent(display, surface, surface, eglContext); gl = (GL11) eglContext.getGL(); } public void savePixels(int x, int y, int w, int h, GL10 gl) { if (gl == null) return; synchronized (this) { if (mSavedBM != null) { mSavedBM.recycle(); mSavedBM = null; } } int b[] = new int[w * (y + h)]; int bt[] = new int[w * h]; IntBuffer ib = IntBuffer.wrap(b); ib.position(0); gl.glReadPixels(x, 0, w, y + h, GL10.GL_RGBA,GL10.GL_UNSIGNED_BYTE,ib); for (int i = 0, k = 0; i < h; i++, k++) { //OpenGLbitmap is incompatible with Android bitmap //and so, some corrections need to be done. for (int j = 0; j < w; j++) { int pix = b[i * w + j]; int pb = (pix >> 16) & 0xff; int pr = (pix << 16) & 0x00ff0000; int pix1 = (pix & 0xff00ff00) | pr | pb; bt[(h - k - 1) * w + j] = pix1; } } Bitmap sb = Bitmap.createBitmap(bt, w, h, Bitmap.Config.ARGB_8888); synchronized (this) { mSavedBM = sb; } } static String saveBitmap(Bitmap bitmap, String dir, String baseName) { try { File sdcard = Environment.getExternalStorageDirectory(); File pictureDir = new File(sdcard, dir); pictureDir.mkdirs(); File f = null; for (int i = 1; i < 200; ++i) { String name = baseName + i + ".png"; f = new File(pictureDir, name); if (!f.exists()) { break; } } if (!f.exists()) { String name = f.getAbsolutePath(); FileOutputStream fos = new FileOutputStream(name); bitmap.compress(Bitmap.CompressFormat.PNG, 100, fos); fos.flush(); fos.close(); return name; } } catch (Exception e) { } finally { //if (fos != null) { // fos.close(); // } } return null; } } Also, if some one can direct me to better way to read the framebuffer it would be great. I am using Android 2.2 and virtual device of API level 8. I have gone through many previous discussions and have found that we can not know read frame buffer directly throuh the "/dev/graphics/fb0". Thanks, Muhammad Ali

    Read the article

  • Set a OGG in raw folder as Ringtone/Notification?

    - by YaW
    Hi, I have some ogg audios in my raw folder and I'm trying to set one of them as a Ringtone (or Notification, Alarm... whatever). I've been looking at the source code of RingDroid and I can see how is this done using the ContentValues and MediaStore, but in all the examples I've seen, the audio files is in the SDCard. Is it possible to set the ringtone directly from the raw folder? If not, how can I make a copy of the raw file to a folder in the SD? Thanks in advance.

    Read the article

  • Explain to me how the Method Profiler works in the DDMS, I get heap space error

    - by Pentium10
    I start the Method Profiler for a process, then leave it run for about 5-10 secs, then I stop it. I see a progress that a file is pulled from the sdcard, than I get this Exception [2010-05-23 18:45:42] Traceview: Exception in thread "main" java.lang.OutOfMemoryError: Java heap space [2010-05-23 18:45:42] Traceview: at java.util.Arrays.copyOf(Unknown Source) [2010-05-23 18:45:42] Traceview: at java.util.Arrays.copyOf(Unknown Source) [2010-05-23 18:45:42] Traceview: at java.util.ArrayList.toArray(Unknown Source) [2010-05-23 18:45:42] Traceview: at java.util.Collections.sort(Unknown Source) [2010-05-23 18:45:42] Traceview: at com.android.traceview.TimeLineView.setData(TimeLineView.java:370) [2010-05-23 18:45:42] Traceview: at com.android.traceview.TimeLineView.<init>(TimeLineView.java:316) [2010-05-23 18:45:42] Traceview: at com.android.traceview.MainWindow.createContents(MainWindow.java:95) [2010-05-23 18:45:42] Traceview: at org.eclipse.jface.window.Window.create(Window.java:431) [2010-05-23 18:45:42] Traceview: at org.eclipse.jface.window.Window.open(Window.java:790) [2010-05-23 18:45:42] Traceview: at com.android.traceview.MainWindow.run(MainWindow.java:60) [2010-05-23 18:45:42] Traceview: at com.android.traceview.MainWindow.main(MainWindow.java:224) What I am doing wrong?

    Read the article

  • Android - Using Camera Intent but not updating correctly?

    - by Tyler
    Hello - I am using an intent to capture a picture: Intent i = new Intent(android.provider.MediaStore.ACTION_IMAGE_CAPTURE); i.putExtra(android.provider.MediaStore.EXTRA_OUTPUT, Uri.fromFile(new File(Environment.getExternalStorageDirectory(), "test.jpg"))); startActivityForResult(i, 2); And then once taken I do the following: sendBroadcast(new Intent(Intent.ACTION_MEDIA_MOUNTED, Uri.parse("file://" + Environment.getExternalStorageDirectory()))); launchGallery(); While the above seems to work the first time without issue, whenever I run through a second time (so test.jpg already exists) the image actually saves correctly to /sdcard/ but I am finding that the thumbnail does not update and when the gallery loads it shows the previous test.jpg image! I was under the impression that sendBroadcast should update the thumbnails, but it doesn't appear to be.. Is there some other way to go about this and ensure when I call my launchGallery(); method the most recent image I just took appears? Thanks!

    Read the article

  • Reading Images only from Camera

    - by Ankit
    I wanted to read images only from the Camera folder of the device. Since the folder might be different for different devices, how can I write a simple application for it). So far I have written the following code, which does read from Camera folder, but it also reads from other places on sdcard as well. Cursor childCursor = managedQuery(MediaStore.Images.Media.EXTERNAL_CONTENT_URI, MediaStore.Images.ImageColumns._ID, null); do { ImageView image = new ImageView(); image.setImageURI(Uri.withAppendedPath(MediaStore.Images.Thumbnails.EXTERNAL_CONTENT_URI, ""+ childCursor.getString( childCursor.getColumnIndex( MediaStore.Images.ImageColumns._ID ))); <some other code> } while (childCursor.moveToNext()); How can I create a generic app and filter on Camera Images before displaying. Any help is appreciated.

    Read the article

  • Aftering captureing a layout screenshot, ImageView is transparent

    - by Behnam
    After capturing a layout screenshot, Containing ImageViews pixels is semi-transparent ( it's abnormal ). Also widget that has transparent color is transparent ( it's normal ). Solid widget is not transparent ( it's normal ). Source of imageviews is JPG files ( so no transparent pixels in the bitmap ). Code: final Bitmap rawBitmap = Bitmap.createBitmap(width, height, Bitmap.Config.ARGB_8888); final Canvas canvas = new Canvas(rawBitmap); rendererView.layout(0, 0, width, height); rendererView.draw(canvas); rawBitmap.compress(CompressFormat.PNG, 100, new FileOutputStream("/sdcard/test" + System.currentTimeMillis() + ".png")); Result:

    Read the article

  • How to use startMethodTracing APIs on Android?

    - by Rajorshi
    I have recently started working on an app which has both Java and native components. I am trying to generate trace information for both components using Debug.startMethodTracing("myapp") and Debug.startNativeTracing() alternately. However, both are behaving unexpectedly. When I use Debug.startMethodTracing("myapp"), I can see a file /sdcard/myapp.trace being created but it is always empty no matter how long I run my app. When I use Debug.startNativeTracing() and start the emulator with the -trace <tracename> switch, I see a message saying "Trace started", but when I try to run my app, the emulator crashes. Am I missing something obvious here? How do I debug this problem?

    Read the article

  • how to retrieve data in image uri in sd card to read data in byte convertion

    - by narasimha
    hi sir i am implementing upload image click upload button then select into sdcard images i am getting uri File Img = new File(selectedImage.getPath()); System.out.println("2............."+Img); FileInputStream is = null; try { is = new FileInputStream(Img); is.read(buffer); BufferedInputStream bis = new BufferedInputStream(is); Bitmap bm = BitmapFactory.decodeStream(is); bis.close(); is.close(); i got in image uri how can retrieve data in particular image uri in image path above code Img i am new in android then some suggition give me some reply

    Read the article

  • JavaME FileConnection url

    - by Trimack
    Hi there, I want to save data to my Sony Ericsson K750i. I know the phone implements FileConnection version 1.0. The list of roots taken from FileSystemRegistry.listRoots(); returns single element named "c:/". I want to save a file.txt just about anywhere, but preferably to the memory stick attached. Unfortunately, it doesn't seem to work. It throws an IOException without any message. I tried opening the fileconnection on numerous roots like c:/, C:/, /, ./, root1/, SDCard/, CFCard/, MemoryStick/ and perhaps some more but without any luck. The exception is thrown right after this line for any of those roots: FileConnection filecon = (FileConnection) Connector.open("file:///MemoryStick/file.txt"); Please, what URL should i use?

    Read the article

< Previous Page | 1 2 3 4 5 6 7 8  | Next Page >