Using Droid-fu

by Marco Rodriguez-Suarez » Tue, 08 Mar 2011 05:38:49 GMT


Sponsored Links
 Hello everyone,
                       I'm trying to use the droid-fu libraries in my
project but I guess I have no idea what I am doing. I plan on using
BetterAsyncTask to send a couple of images to a server and then have
the program return a response. The problem I am having is after I add
the droid-fu .jar file into my build path. I then try to extend my
main activity as follows

import com.github.droidfu.activities.BetterDefaultActivity;

        public class MainActivity extends BetterDefaultActivity {
        /** Called when the activity is first created. */
        @Override
        protected void onCreate(Bundle savedInstanceState) {
                super.onCreate(savedInstanceState);
                setContentView(R.layout.main);

}
}


Before I even add any code to my project the program crashes if I try
to run it. I get the following exception:


03-02 20:43:47.784: ERROR/AndroidRuntime(3238):
java.lang.RuntimeException: Unable to start activity
ComponentInfo{com.marco.servertest/com.marco.servertest.MainActivity}:
java.lang.ClassCastException: android.app.Application

Any help would really be appreciated! I am about ready to give up on
the droid-fu libraries and just use the regular AsyncTask . Do I need
to add anything to my manifest file??

-- 



Re: Using Droid-fu

by TreKing » Tue, 08 Mar 2011 22:28:05 GMT


 On Wed, Mar 2, 2011 at 10:55 PM, Marco Rodriguez-Suarez




Does this library not have a dedicated site / forum? That would be a more
appropriate place for such a question.



Always include the names of Services, Activities, Application, etc, sub
classes.

Your error, in particular, indicates a problem with the app's Application
class.

-------------------------------------------------------------------------------------------------
TreKing < http://sites.google.com/site/rezmobileapps/treking> ; - Chicago
transit tracking app for Android-powered devices

-- 


Sponsored Links


Re: Using Droid-fu

by Sandeep sp » Mon, 25 Apr 2011 20:14:37 GMT


 Hi Mr Marco,

      Did you able to resolve the crash? I Am also facing the same
issue, please let me know. What needs to be done to resolve this
issue?

Regards
Sandeep S.P






-- 



Other Threads

1. LooperThread

Can anyone tell me the proper way to terminate a LooperThread? 

Below is the code from the Developer site, but it seems all the methods for
stopping it have been deprecated. 



class LooperThread extends Thread {
      public Handler mHandler;
      
      public void run() {
          Looper.prepare();
          
          mHandler = new Handler() {
              public void handleMessage(Message msg) {
                  // process incoming messages here
              }
          };
          
          Looper.loop();
      }
  }


I'm using this in a Service, which creates a main Thread, and the main
thread checks to see if I need to update my server with GPS coordinates. If
I do need to send the GPS info, I create a looper thread using the base code
above, and join to it for a maximum of 60 seconds. 

I am able to register to receive the GPS information, and set a
LocationListener inside the Looper Thread, and receive the GPS information.
When I get the onStatusChanged event with a status of 2 (Available), I want
to stop/terminate the looperThread, so that I can continue on with the main
thread, but I don't see any methods left that allow me to terminate it
properly. The join times out, and the main thread continues, but the
LooperThread never disappears. 

Should I be using another method with SDK 1.5.r2 ? 





Sincerely,

Brad Gies


-----------------------------------------------------------------
Brad Gies
27415 Greenfield Rd, # 2,
Southfield, MI, USA
48076
www.bgies.com www.truckerphone.com
www.EDI-Easy.com www.EDI-Simple.com
-----------------------------------------------------------------

Moderation in everything, including abstinence



--~--~---------~--~----~------------~-------~--~----~

2. Is referencing resources across resource files dependent on the filename?

Hi,

This happens because files are processed in the order of the
filesystem, probably alphabetically in this case:

layout1.xml
main.xml
zlayout2.xml

By the time main.xml is processed, zlayout2 hasn't been, and the id
does not exist. But that does not matter since you can simply use
@+id/layout2 in both main.xml and zlayout2.xml. You could also declare
your id in res/values instead.






-- 
Romain Guy
Android framework engineer
romain...@android.com

Note: please don't send private questions to me, as I don't have time
to provide private support.  All such questions should be posted on
public forums, where I and others can see and answer them

--~--~---------~--~----~------------~-------~--~----~

3. How do I pass data between applications?

4. Ability to quit/disable an app after trial period?

5. Why did Google Groups not post my comments?

6. ADP1 stops recieving data

7. Reporting a Bug