split screen and run 2 different activities on android - android

I'm developing an android app that needs 2 separate activities running at the same time, they both have their own layout. What i am doing right now is creating 2 different intents and start them in sequence. But it looks like they are not running at the same time, I have to quit the first activity to start the second one.
Can someone help me with this issue? If I can display 2 activities at the same time using split screen, that will be awesome.
Thank you!

Take a look at Fragments. They were originally designed with a different goal in mind, but they might work for what you're trying to do.

What exactly are your needs for the project? You can setup a single layout with 2 RelativeLayouts overlapping, and just bringToFront the one that you will need, and use Threads to do your processing. Not clean, but it would work.

I'm developing an android app that needs 2 separate activities running at the same time
That is not supported by the stock Android OS at this time. You will need to come up with some other solution for whatever problem you think you have. Fragments, as Mr. Cherkashyn mentions in his answer, would be one candidate.
What i am doing right now is creating 2 different intents and start them in sequence. But it looks like they are not running at the same time, I have to quit the first activity to start the second one.
Correct.
Can someone help me with this issue?
Step #1: Download the Android source code.
Step #2: Modify the OS to support displaying two activities at once.
Step #3: Compile your revised OS and put it into a ROM mod.
Step #4: Install that ROM mod on the device of your choice.

Related

Using one layout file for multiple fragments

I'm working on ftp client for android right now, In my app I wanna have 2 fragments, one for local file system and one for the remote, even though they obviosuly function differently I still want them to have the same layout, as they should look the same.
So I've been wondering, is it ok to use the same layout for different fragments or should I just copy to 2 different file?
Doesn't know if that is relevant but the fragments will definitely be active on the same time as I intend they'll both be on a pager viewer.
Also, if you could answer more generally, could two different "particles" use the same layout without problems?
Preety nooby question, but I'm new to android so...
There is no problem with this.
You can use one blue-print to build a whole bunch of houses. This is the exact same. Eventually, you might build them with separate layout files, but for now, one is fine.

Android app display on top of another

I'm trying to build an application that would run at the same time as another one, on top of it (hiding only partially the original app), that would display useful information for the user of the main app.
But it seems that 2 activities cannot run at the same time, overlap, etc...
For argument sake, lets say the app would be displaying date & time in a corner of the screen, while playing a specific game.
Anyone got any doc or sample code on how to achieve such a result ?
I'm also interested in how to know which app is currently running in order to decide in my app-on-top to be visible or invisible.
Any help appreciated :)
Thx
Looks like you are in need of Fragments: Fragments
The Android system is designed to be user friendly, and two activities at same time is not, so only one activity is on foreground at once. if you need the other to be running in background make it a Service, if you want to show some data and get back first one use a Dialog, finally if you want both you can either put them in one activity or use Fragments as #Tooroop suggsets.
Its propably too late ... but for others with the same problem:
check out how-to-draw-on-top-of-other-applications
and maybe also this if your app need to be on top on fullscreen apps

Cut phone screen on two parts that do simultaneously two things

Can i create a program which will cut phone screen on two parts.
Those two screen will do simultaneously two things, for example to watch a clip and to read and write sms.
I think that:
1) i need to create a home luncher application first.
How can I create a custom home-screen replacement application for Android?
2) Then i can start two fragment in my activity.
http://developer.android.com/guide/components/fragments.html
3) Finaly i open app1 in first fragment and app 2 in second fragment. Can i do that, open an application in a fragment?
Any other ideas will be usefull.
I think you need a modified version of the Android ROM to be able to do this. With the standard ROM you can only have 1 application running in foreground at any given time.
Samsung has done something similar on the Galaxy Note by allowing you to watch video while doing other things.
If you don't want to change the ROM you could implement this on your own apps, but not on all the apps.
I'm no expert, but it seems to me that you can have one application with two fragments in it. The top fragment would display video and the bottom fragment would have the messaging. Since fragments are only API 11 and up you don't have to worry about old phones being able to handle it.
Your step 3 states that you'll open apps in your fragments and I don't think that's how they work.
You can think of a fragment as a modular section of an activity, which has its own lifecycle, receives its own input events, and which you can add or remove while the activity is running (sort of like a "sub activity" that you can reuse in different activities).
Read more about Fragments here:
http://developer.android.com/guide/components/fragments.html
You can customize the launcher and the homescreen and lancher, check out the links below
https://android.googlesource.com/platform/packages/apps/Launcher2.git
How can I create a custom home-screen replacement application for Android?
Compile Launcher/AOSP from Eclipse:
Android Launcher application compilation on Eclipse
Read this for your information on how to compile and run your custom launcher.
https://groups.google.com/forum/?fromgroups=#!topic/android-developers/zI9LPeU1mbc

Android: How to fork a new process

I want to run two processes in the same DalvikVM. This means that I want to run a first app and then that this app starts the second app. And I want that this two apps are then running in the same DalvikVM. I think it is possible if the first app forks an process for the second app. But I´m not sure how can I do that.
Thanks
I want to run two processes in the same DalvikVM.
By definition, that is impossible.
This means that I want to run a first app and then that this app starts the second app. And I want that this two apps are then running in the same DalvikVM.
By definition, that is impossible.
I think it is possible if the first app forks an process for the second app.
No.
I very much doubt what you actually want to do is go digging into the specifics of processes (if you do I would question why). In any case, Android deliberately makes it very difficult for you to go near processes as the platform provides sufficient mechanisms to achieve virtually any functional flow without needing to.
I suspect what you actually mean is you need to start a new Android task (has it's own back stack, functionally operates like a separate application).
Have a read of the Tasks and Back Stack document from the dev guide, particularly the section on tasks. What you probably want to look at is starting your new activity using the FLAG_ACTIVITY_NEW_TASK flag in the Intent.

Multiple frame buffer in android

I am working on creating multiple displays on a single screen, i.e., I want to run two different activities simultaneously.
I came to know that, to achieve this requirement we need to change the surfaceflinger code and some hardware properties in the android source.
Can anybody help me in finding the exact procedure in modifying the surfaceflinger and other parts of the android source in order to get two displays
Thanks in advance.
You cannot run two activities simultaneously just by getting two displays. Only one application/activity can be run at a time on the activity stack.

Categories

Resources