i want t run multiple activities simultaneously

by honey » Thu, 02 Sep 2010 01:54:42 GMT


Sponsored Links
 i have buil a file explorer just like a mycomputer.it reads the whole
storage and system for files and directories now.i am working with
start menu.i have built it in an other activity i wan to make them
active at the same time? can anyone help me out?

--



i want t run multiple activities simultaneously

by Mark Murphy » Thu, 02 Sep 2010 02:13:56 GMT


 You cannot have more than one activity visible at one time, sorry.




-- 
Mark Murphy (a Commons Guy)
 http://commonsware.com  |  http://github.com/commonsguy 
 http://commonsware.com/blog  |  http://twitter.com/commonsguy 

Android App Developer Books:  http://commonsware.com/books 

--


Sponsored Links


Other Threads

1. Howto cleanup location listeners in activities properly

I have an Activity that implements LocationListener.

public class MyActivity extends MapActivity  implements
LocationListener

In my activity, I register a locationlistener in the onCreate()

lm.requestLocationUpdates(LocationManager.GPS_PROVIDER, minTime,
distance, this);

In the onDestroy method, I'm removing the registration for my
locationlistener.

@Override
protected void onDestroy() {
    Utils.addDebugMsg(this,"onDestroy");
    lm.removeUpdates(this);
    super.onDestroy();
}
In my application, I can change the minTime and distance, so I re-
initialize my listener like this :

private void initializeGpsListener() {
    lm.removeUpdates(this);
    lm.requestLocationUpdates(LocationManager.GPS_PROVIDER, minTime,
distance, this);
}
For debugging purposes, I write something to the screen whenever a
provider is enabled (in this case GPS).

    @Override
    public void onProviderEnabled(String provider) {
        Utils.addDebugMsg(this,"onProviderEnabled : " + provider);
    }

What I noticed is that sometimes, multiple instances of my activity
(or locationlistener) are "kept around". Each time I turn the GPS
provider on, instead of seeing 1 statement "onProviderEnabled : GPS",
I see several different instances of my Activity printing this line
(all at the same time).

I want to keep the listener around, as it needs to update the location
even when the activity is not in the front , so removing it in
onPause() is not an option.

How do I clean up these listeners ( = my activities), and make sure
that only 1 remains active throughout the application.



-- 

2. Help interpreting MediaPlayer error

I have the following code:

...
this.mediaController = new MediaController(this);
this.videoView.setMediaController(this.mediaController);
this.videoView.setOnPreparedListener(this);
this.videoView.setOnCompletionListener(this);
this.videoView.setOnErrorListener(this);
this.videoView.setVideoURI(Uri.parse(getVideoUrl()));
this.videoView.requestFocus();
...

In an activity onCreate, where videoView is, surprisingly, a VideoView.

when getVideoUrl is:
http://www.pocketjourney.com/downloads/pj/video/famous.3gp
everything works fine.

when getVideoUrl is:http://www.afneurope.net/portals/main/Media%
20Assets/3GP/AIR%20REFUELING%20POINT.3gp
I get a very cryptic error in my error logs and no other information on
a failure:
11-03 14:29:14.905: DEBUG/MediaPlayer(8900): Couldn't open file on
client side, trying server side
11-03 14:29:14.905: INFO/StagefrightPlayer(34):
setDataSource('http://www.afneurope.net/portals/main/Media%
20Assets/3GP/AIR%20REFUELING%20POINT.3gp')
http://metrics.doapps.com/services/ad_metrics.php?phoneType=1&hash=b626e90da9039d33a6ad51169f40b6bc&status=success&adNetwork=1&phoneVersion=2.2&runId=a78739b6fa1070a7d3e1d1e9b048905c&phoneDesc=google_sdk&timestamp=1288812554704&feedId=8904&linkId=0072c238c35442fe509d33d312d23d15&adagogoId=0000737&phoneId=c3c159a447643c503be0b8d7e40989aa&catId=2782&longitude=0.0&adType=banner&latitude=0.0
 :200
11-03 14:29:16.015: ERROR/MediaPlayer(8900): error (1, -2147483648)
11-03 14:29:16.025: ERROR/MediaPlayer(8900): Error (1,-2147483648)
11-03 14:29:16.025: DEBUG/VideoView(8900): Error: 1,-2147483648
11-03 14:29:19.385: DEBUG/dalvikvm(61): GC_EXPLICIT freed 9548 objects /
505216 bytes in 242ms

The two streams have some differences, mainly audio codec, but both
codecs are supported by Android afaik.  Here is ffmpeg output for
instance:

Seems stream 1 codec frame rate differs from container frame rate:
1000.00 (1000/1) -> 14.98 (2997/200)
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from
'http://www.pocketjourney.com/downloads/pj/video/famous.3gp':
  Metadata:
    major_brand     : 3gp5
    minor_version   : 256
    compatible_brands: 3gp53gp4
  Duration: 00:01:35.60, start: 0.000000, bitrate: 161 kb/s
    Stream #0.0(eng): Audio: amrnb, 8000 Hz, 1 channels, flt, 12 kb/s
    Stream #0.1(eng): Video: mpeg4, yuv420p, 320x240 [PAR 1:1 DAR 4:3],
122 kb/s, 14.92 fps, 14.98 tbr, 2997 tbn, 1k tbc
    Stream #0.2(eng): Data: rtp  / 0x20707472, 4 kb/s
    Stream #0.3(eng): Data: rtp  / 0x20707472, 15 kb/s

Seems stream 1 codec frame rate differs from container frame rate:
1000.00 (1000/1) -> 15.00 (15/1)
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from
'http://www.afneurope.net/portals/main/Media%20Assets/3GP/AIR%
20REFUELING%20POINT.3gp':
  Metadata:
    major_brand     : mmp4
    minor_version   : 1
    compatible_brands: mmp43gp53gp4
  Duration: 00:01:02.13, start: 0.000000, bitrate: 189 kb/s
    Stream #0.0(eng): Audio: aac, 22050 Hz, stereo, s16, 32 kb/s
    Stream #0.1(eng): Video: mpeg4, yuv420p, 320x240 [PAR 1:1 DAR 4:3],
140 kb/s, 15 fps, 15 tbr, 600 tbn, 1k tbc
    Stream #0.2(eng): Data: rtp  / 0x20707472, 5 kb/s
    Stream #0.3(eng): Data: rtp  / 0x20707472, 8 kb/s
At least one output file must be specified

Can anyone give me some insight into what that error might mean?  

Thanks,
Nick

-- 

3. counting files in a cache

4. How to include external files into apk

5. Can't read our data from USB audio device (/dev/snd/dsp)

6. certification for android developers

7. Obtaining Name of Object Reference