Is this is possible guys i want to add two different Activities of different application in a Fragment?
For example Video Preview and chat List view in a single view.
It is not possible to have two applications in one window. Each application runs under a different window session and cannot share windows. It is possible to display both windows side by side but the window manager has no stable API (it may change in any new version and it already did change in the history), and either each application would need to request that itself or you need root access.
Also, you understand fragments incorrectly. A fragment is hosted inside an acitivity, not the other way around.
Related
I have an android application working in mobile, this app has two types of activities ones that loads a list of items, and forms that open when you touch one item.
Now I have to port the app to tablet and the layouts need to be fully restructured to fit big screens, so much that the java code has to be heavily changed so i thought to merge both activities in one as shown below
Is that possible?
And if its what i need to use, fragments?
Can each activity still in its own class?(this is critical)
Can each activity have its own network operations and AsyncTasks?
Yes as you said you can use fragments for your situation (Infact their main purpose is to support different screens without code duplication). So you'll have only 1 Activity class and 2 layouts for different devices and you just need to do some run time checks and perform actions according to them.
Here you can find tutorial :- https://developer.android.com/training/basics/fragments/index.html
is not possible because only one activity working in single screen in android. i have one idea to put two fragment in single activity then use your own AsyncTasks network operation.
I would like to display two activities side by side using the split view in my app. I have read the content of the below google's site and I am unable to implement the multi-window mode in android nougat. Have anybody implemented that?
Ref: https://developer.android.com/guide/topics/ui/multi-window.html
From Android Nougat you can display two activities side by side in same app using FLAG_ACTIVITY_LAUNCH_ADJACENT when launching a new activity.
As per doc
When you launch a new activity, you can hint to the system that the
new activity should be displayed adjacent to the current one, if
possible. To do this, use the intent flag
FLAG_ACTIVITY_LAUNCH_ADJACENT. Passing this flag requests the
following behavior:
If the device is in split-screen mode, the system attempts to create
the new activity next to the activity that launched it, so the two
activities share the screen. The system is not guaranteed to be able
to do this, but it makes the activities adjacent if possible. If the
device is not in split-screen mode, this flag has no effect.
You could use Fragments (see the documentation). Fragments are like sub-activities that have their own life cycle, and multiple fragments can be combined in one activity to make a multi-pane user interfaces. Fragments requires Android 3.0 or higher.
Split view or multi-window mode is not meant for activities with an app. This new feature, introduced in Android Nougat, enables display of 2 different apps at the same time.
AFAIK, Android does not currently support displaying 2 activities side by side within an app. However, you may be looking for fragments that can be placed side-by-side in an activity as described here.
I split my LinearLayout into two. Is there any possibility to show the other application on the layouts ? When I search with Google it's not possible. I need to know is there any possibility to show the other application view with my application.
no its not possible to displays 2 activities at the same time however,fragments will do the job.
here is a good example for you:
http://examples.javacodegeeks.com/android/core/app/fragment/android-fragments-example/
Is there any possibility to show the other application view with my
application
Only one application can be shown at a time on the screen. It is possible to run multiple applications but impossible to show multiple applications on the screen at the same time.
However, you can create own application to show different functionalities/ widgets on one screen by using Fragments
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
Were looking into Android for writing a tablet based system. Part of the design is for the system to be as modular as possible. One aspect of this is to display any "STATUS" activities in a side view on the screen. It looks like I can use PackageManager queryIntentActivities() to find the activities that show status information. But, can I display these in a single view all at the same time (via a linear layout)? The activities would be installed in separate apk's (features).
Can this be accomplished using ActivityGroup? Is this even allowed in Android? Everything I've read implies that Activities take the whole screen or float on top. This implies only one activity can be active at a time where as the design I'm thinking of uses the activities more like widgets.
You should be to be able to do what you want with just one activity, plus multiple (background) Services (on different threads) for your status updates.
Don't worry, you can still package them in different apks. You'll just need to sign them the same way, and your apks won't even be sandboxed from each other, so they'll be able to share the same data and share the same memory footprint of just one apk.
Also, take a look at NotificationManager, I know you want to roll your own solution, and you can certainly do that if you want, but you could also just reuse/extend NotificationManager and save yourself a bunch of work.