Open another application inside a fragment - android

This is a follow up question to this question:
Open another app within a fragment
I'm creating an application with a single activity with a SlidingTabsLayout and every tab is a fragment. Is there a way to open an installed application and just run it as it is inside one of the tabs? The other application is just a single activity which I want to display in my tab as it is. The answer in the question above said I can't do it, but maybe in the 1.5 years that passed since the question was asked, something has changed?

Is there a way to open an installed application and just run it as it is inside one of the tabs
No.
The answer is the question above said I can't do it
The answer is correct.

Related

How is Android's Instagram structured? [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 7 years ago.
Improve this question
I'm building an android app which, although it has a completely different function, has a very similar UI to Instagram. There is a bottom bar with buttons for viewing timeline, posting (my app's content), checking notifications, and viewing your own profile.
I am a fourth year electrical engineering student, but I am relatively new to Android development. In order to teach myself more stuff faster, I went ahead and made a lot of the functions of my app (like viewing posts, profile, timeline, friends, etc.) their own activities with their own bottom bar (which are just buttons as of now). In doing this I have learned a lot about development and have built an app that, for what I have built out so far, functions as it's supposed to, but is not too fast or pretty. I realize this is probably not the best practice and I wanted to ask you all what you think a simple explanation of how to implement an Instagram-like UI would be? When I say Instagram-like I mainly mean: it includes a bottom bar; the app "preserves" where a user is, like if I'm viewing a friend from the timeline, then press the view profile button, then press the timeline again, then I will still be viewing my friend.
I have tried to read up as much as I could to tackle the redesign but I'm still a little fuzzy on the standard for doing something like this.Should I try TabHost (which is deprecated)? should each button represent an activity with swappable views (for example in IG I click a post on my timeline and it swaps to the pictures post view)? Should I associate an activity with each button and swap fragments based on where the user navigates? I realize this is an open ended question, and I hope it's not too vague for Stack Overflow, but I have thought about it a great deal, and I would appreciate the feedback of some more experienced developers! Thanks!
You can use the new TabLayout that is contained in the support design library along with a view pager to switch between your different fragments.
You can read about the TabLayout as well as some of the other things packed in to the design library here.
Reference for TabLayout
edit: In the comments I mentioned an analogy for you to think about how to use fragments vs. activities. In the interest of not spreading misinformation I'm gonna back peddle on what I said a little bit. You can absolutely use separate activities and switch between them using the tabs. So, the correct answer is kind of somewhere in the middle. The MainActivity would still hold the tablayout and manage the tab listener and switch between the tabs but you can set the content of the tablayout to hold the content a new activity. But you can do it with fragments as well and possibly more efficiently.
It really depends on the structure of your app and how deep it goes. If you only have 4 fragments and the information is centric to one work flow then you might choose to only use one activity with four fragments. It is really up to the developer on how to manage this.
Since fragments have come out, one philosophy has been if the space that you are using can be repurposed, that is, if you are working in the same box (the area above the tab bar of the instagram application for example), use a fragment. (Referencing from here). The camera tab is a good example of where to use an activity. The camera functionality represents an entirely different workflow than is seen when navigating feeds, pictures and profiles of the instagram application. So the feed might be one fragment, and the user profile another fragment but they are all being managed by the same activity and using the same content frame.
There are other answers posted in the reference I provided above which should help your understanding further.

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

How to use Android activity fragment from other packages?

I have just begun development on Android ICS.
I have a requirement to reuse some activity fragments inside my application.
For example, when I want to write a 'setup wizard' application, I need to reuse the WIFI setting activity fragment in my own APK.
But it seems that activity fragment can only be used within the same package(APK).
Does any one know how to deal with this?
Thanks a lot.
-Robin
But it seems that activity fragment can only be used within the same package(APK)
Correct.
I need to reuse the WIFI setting activity fragment in my own APK
I do not know if your app can have all the permissions necessary to do all the things the Setting app's WiFi screen does. That being said, you are welcome to browse the source code for Settings and pull out what you want.

Android Application Structure

I'm currently working on my first ever Android application and it's for my University. The structure of this app is that there 5 specific tabs each of which when inside that tab give you multiple options to perform other actions. So for instance when you click on tab 1, you are given the option to view a news feed, twitter feed, rss feed, etc. Tab 2 might give you information about different parts of the school, so there might be a button to go to Academics Info, another button for Financial Info, etc. I started on this about a month ago and was making good progress using ActivityGroups nested inside TabActivities. Then one day I found that both of those class had been deprecated and it was suggested that Fragments be used instead, so I restarted using Fragments. So my question is can anyone give me guidance on the overall structure behind what I'm trying to accomplish. Right now I have my basic tabs setup using fragments, but that doesn't allow me to have activities running inside my tabs, let alone the option for switching between separate activities all in their own respected tab.
I've been working for a very long time and I just need some guidance, so any help is appreciated. Thank you for your time and if you need any additional information please let me know. Thanks.
Im sure you've read the documentation on TabActivity. Bottom line is that the Activities you had for each of the tabs should be replaced by Fragments. An activity is now more of a superstructure which can contain multiple fragments each with their own views. The reason behind it is that it makes your application more modular. You could have the fragments as tabs on the phone, but next to eachother on bigger screens etc.

Android app - Integrate another apk

I am developing an application in android. I have situation wherein I have the need to call another app from the main app. Basically when the user presses a tab in the main app the second app should open and it should remain within the main app tab view.
I have developed the complete code for the main app. I also have the source code for the second app and the apk. I am totally not sure as how to integrate the 2 apps. Based on references I am understanding that we can call the apk of the second app from the first, but I am not clear on the same. Please advice or suggest any steps towards the same.
Regards,
Harry
You can't have one application load inside a tab of another application. You can easily have one application start a second application.
How to call one android application from another android application
I hope this helps.
I have situation wherein I have the need to call another app from the main app.
Why? You appear to be the author of both apps. Why not simply combine them?
Basically when the user presses a tab in the main app the second app should open and it should remain within the main app tab view.
This is not supported, on two levels:
You cannot embed another application's UI into your own, except via RemoteViews
Embedding activities inside of activities is now deprecated
I doubt it's possible to open up a view from another app in your existing tab view.
It is however possible to start the activity from another app by a button click. This will then allow you to go back with back button to your own app activity.

Categories

Resources