The file extension and read per mission issue Hi, I am in the problem about reading data fr om some new file extensions, the problem is gets -1 from the first run wit

by 100town » Sat, 24 Oct 2009 19:39:16 GMT

Sponsored Links

I am in the problem about reading data from some new file extensions,
the problem is gets -1 from the first run without and
exceptions being thrown. Check the code below:
String path = sdcard/wanshuiqianshan.lrc fis = null;
                        fis= new;
                        int c=0;
                        StringBuffer sb=new StringBuffer();
                        Log.e("INFO", "Here 1;
                        return sb.toString();
                }catch(Exception ioe){
                        Log.e("EROOR", "file: "+path, ioe);
                        return null;
                        }catch(Exception e){
If I change the file extension to xt everything is all right. I
debugged into the android source then the code running into the native
C code so not any clue was found.

I searched in the group. Only some discuss leads to the cycle about
mime-type and file extensions which cannot help me.
I guess it is a build-in security mechanism about the undefined file
extension types. Can anybody help? Thanks.


Other Threads

1. AlertDialog error with events

I am new to java/android. I am trying to create an AlertDialog inside
my SmartApp class when an event is fired in my DataRobot class. I am
getting an error when doing this. The event is firing and calling the
function successfully in SmartApp, but when it gets to
the following error is printed to logcat. Does anyone know what i am
doing wrong or a better way to implement what i am wanting? The
AlertDialog does not pop up on screen, logcat just complains about
something. Code and logcat output below:

    02-06 10:27:30.673: VERBOSE/SmartApp(276): data alert event caught
    02-06 10:27:31.013: WARN/System.err(276):
java.lang.RuntimeException: Can't create handler inside thread that
has not called Looper.prepare()
    02-06 10:27:31.042: WARN/System.err(276):     at
    02-06 10:27:31.052: WARN/System.err(276):     at
    02-06 10:27:31.052: WARN/System.err(276):     at
    02-06 10:27:31.062: WARN/System.err(276):     at
    02-06 10:27:31.082: WARN/System.err(276):     at
    02-06 10:27:31.082: WARN/System.err(276):     at
    02-06 10:27:31.102: WARN/System.err(276):     at
    02-06 10:27:31.102: WARN/System.err(276):     at
    02-06 10:27:31.122: WARN/System.err(276):     at
    02-06 10:27:31.122: WARN/System.err(276):     at
    02-06 10:27:31.133: WARN/System.err(276):     at
    02-06 10:27:31.133: WARN/System.err(276):     at
    02-06 10:27:31.153: WARN/System.err(276):     at


    // datarobot class
    public class DataRobot extends Activity {
        /* This class is for analyzing the data */
        private List _listeners = new ArrayList();
        private List<DataAlertListener> _listeners2 = new
        private SmartDataObject data;
        private int sI1;
        private int sI2;
        private float w1;
        private float w2;
        private float w3;
        private int hRB;
        private int hRVMin;
        private int hRVMax;

        public boolean analyzeData(SmartDataObject temp) {
                /* Analyze the data
                 * Returns true if data was successfully analyzed
                 * Returns false if an error occurred
                data = temp;
                if(data.getHeartRate()>290) {
                return true; //for now this will always return true

        public synchronized void addDataAnalyzedListener(DataAnalyzedListener
listener) {
        public synchronized void
removeDataAnalyzedListener(DataAnalyzedListener listener) {
        private synchronized void fireDataAnalyzedEvent(SmartDataObject temp)
                DataAnalyzedEvent dRE = new DataAnalyzedEvent(this, temp);
                Iterator listeners = _listeners.iterator();
                while(listeners.hasNext()) {
        public interface DataAnalyzedListener {
                public void dataAnalyzedReceived(DataAnalyzedEvent event);

        public synchronized void addDataAlertListener(DataAlertListener
listener) {
        public synchronized void removeDataAlertListener(DataAlertListener
listener) {
        private synchronized void fireDataAlertEvent() {
                DataAlertEvent dAE = new DataAlertEvent(this);
                Iterator listeners = _listeners2.iterator();
                while(listeners.hasNext()) {
        public interface DataAlertListener {
                public void dataAlertReceived(DataAlertEvent event);


    public class DataAlertEvent extends EventObject {
        public DataAlertEvent(Object source) {
                // TODO Auto-generated constructor stub


    public class SmartApp extends Activity implements
OnSharedPreferenceChangeListener {
        TextView smartConnectionStatus;
        TextView testOutputView;
        Thread cThread;
        private ConnectDevice cD = new ConnectDevice();
        private DataRobot dR = new DataRobot();
        private DataBuilder dB = new DataBuilder();
        private DataSender dS = new DataSender();

        /** Called when the activity is first created. */
        public void onCreate(Bundle savedInstanceState) {

        final AlertDialog alert = new
                Log.v("SmartApp", "inside sendalert");
                //AlertDialog alert = new AlertDialog.Builder(this).create();
                Log.v("SmartApp", "after builder1");
                //{*filter*} {*filter*};
                //{*filter*} = ({*filter*}) 
                alert.setMessage("Testing alert dialog...");
                alert.setButton("Ok", new DialogInterface.OnClickListener() {
                        public void onClick(DialogInterface dialog, int which) {
                                // TODO Auto-generated method stub
                Log.v("SmartApp", "after builder2");
                //AlertDialog alert = builder.create();

                cD.addDataReceivedListener(new DataReceivedListener() {
                        public void dataReceivedReceived(DataReceivedEvent 
event) {
                                // TODO Auto-generated method stub
                dR.addDataAlertListener(new DataAlertListener() {
                        public void dataAlertReceived(DataAlertEvent event) {
                                Log.v("SmartApp", "data alert event caught");



2. lg ally android cant connect to blocks editor

what needs to be done to make this work?


3. How to save geolocation data on server.....

4. Where is best to start?

5. Emulator Uninstall to Previous One (2.3 to 2.2)

6. Problems with notification bar when called from a widget

7. Scrolling Problem