how to serialize an object of android.graphics.Path

The way I did it is to identify the methods that I needed from the original Path class and then simply override those methods as follows: public class CustomPath extends Path implements Serializable { private static final long serialVersionUID = -5974912367682897467L; private ArrayList<PathAction> actions = new ArrayList<CustomPath.PathAction>(); private void readObject(ObjectInputStream in) throws IOException, ClassNotFoundException{ in.defaultReadObject(); … Read more

Can a videoview play a video stored on internal storage?

MediaPlayer requires that the file being played has world-readable permissions. You can view the permissions of the file with the following command in adb shell: ls -al /data/data/com.mypackage/myfile You will probably see “-rw——“, which means that only the owner (your app, not MediaPlayer) has read/write permissions. Note: Your phone must be rooted in order to … Read more

Accessing functions bound to event handlers with jQuery

jQuery 1.7 has stopped exposing the events in the regular data() function. You can still get them like this: var elem = $(‘#someid’)[0]; var data = jQuery.hasData( elem ) && jQuery._data( elem ); console.log(data.events); Please note, that this only works for Events which have been bound using jQuery. AFAIK you there is no way to … Read more

How do I read the file content from the Internal storage – Android App

Take a look this how to use storages in android http://developer.android.com/guide/topics/data/data-storage.html#filesInternal To read data from internal storage you need your app files folder and read content from here String yourFilePath = context.getFilesDir() + “https://stackoverflow.com/” + “hello.txt”; File yourFile = new File( yourFilePath ); Also you can use this approach FileInputStream fis = context.openFileInput(“hello.txt”); InputStreamReader isr … Read more

Using internal sun classes with javac

I have found the answer myself. When javac is compiling code it doesn’t link against rt.jar by default. Instead it uses special symbol file lib/ct.sym with class stubs. Surprisingly this file contains many but not all of internal sun classes. In my case one of those more-internal-than-usual classes was sun.awt.event.IgnorePaintEvent. And the answer to my … Read more

Android create folders in Internal Memory

I used this to create folder/file in internal memory : File mydir = context.getDir(“mydir”, Context.MODE_PRIVATE); //Creating an internal dir; File fileWithinMyDir = new File(mydir, “myfile”); //Getting a file within the dir. FileOutputStream out = new FileOutputStream(fileWithinMyDir); //Use the stream as usual to write into the file.

tech