Switching between activities in android design - android

I'd like to make an application using the DJI SDK. I'm very new to Android development, and I'd like the application to be able to do two things: show the plane's current gps on a map and also connect to the plane's camera.
So, is it better from a design standpoint to show the plane's current gps on a map, and then hide the plane's camera view until a button is clicked to toggle the view? Or is it better to make an entire new activity to show the camera view or map, and then toggle between activities but save the information on each activity so that when I switch back, I can still see the current state of the aircraft from the current viewpoint?
Which is better when considering design, memory/battery usage, and scalability?

What you can do is to have a activity with a google map as base layout (it's a fragment i know) and put an Frame Layout on top of it, and by clicking on the frame layout you can increase and decrease the size of the camera view.
I did it like that way, and works great for me.

Related

how can I sync second screen and make it clickable?

I am making an app for a dual display device for 1:1, face to face consulting.
Basically, the secondary screen is not clickable. So, what I need to do is implementing a presentation.
But some activities are sharable screen. So, it must be clickable in both screens. By default, the second screen is not clickable, but the second monitor displays the same screen. For making it clickable, I need to implement the presentation class for it. However, it will take a lot of times to implement it. So, Is there any simpler way to share the second screen and clickable?
(In presentation, the views are clickable/scrollable/etc)

Virtual button in ARToolkit

I want to develop an Android application to detect some target and show play icon over it. When user click the play icon, augmented reality played on another activity.
I use ARToolkit as a SDK. The Interaction example is the best match my requirements. But the problem is i cant make the play icon clickable and in that example, the whole view is clickable.
In brief, how can i get marker coordinates on Android view?
The play button you want to place is a 3D object inside a GLSurfaceView, there is no "View" associated to that object, so you can't just use an OnClickListener.
ARToolkit gives you the marker coordinates on 3DSpace, but that I don't think that coordinates are what you are asking for.
As I see it, you have 2 main options:
You made a play button that appears in the screen (not overlaid on the marker) and then you use it as a normal View. You can link the visibility to the object to the event of the marker being found or not.
You process the touch event on the GLSurfaceView doing raycasting and checking if it hits the object that is the play button.
Option 1 is the simplest, option 2 is what you describe.

Android slide out view

I am wondering how to achieve some kind of draggable view. I am not speaking about the navigation drawer!
Several other applications implement this kind of views, for example the new stock Android Lollipop Calculator application. There you can drag out the extended symbols view from the right hand corner.
Another application is Google maps. When checking out a location, it's possible to extend the location information by dragging up the bottom information view.
It appears that there are two points where the view is able to lock in, meaning that when pulling the view up to a specific point and releasing, will result in the drawer not closing entirely but to align to the specific locking points.
How is that achieved or is a library required?
Thanks in advance
The stock calculator app appears to use ViewPager to achieve the slideout numberpad. It's a part of android, no libraries so that would be a good starting point.
Here's the class in question (Rest of the code to the left)

Android Fragments or Layouts - advice needed

I am developing an application which should display a number of tiles on the first page. Tiles are generated dynamically from json, each should allocate itself according to size specified in json and should take as much screen as required. Each tile represents short summary of information. The requirement is that when tile is pressed user is redirected to another page which provides more detailed info (like a form) which takes the whole page. User then should be able to go back to previous page and choose another tile if needed or go back to the first one. I don't know in advance how many tiles there will be and what are their components, so everything is dynamic. There is also a possibility that small tiles(with different info) can be required to be drawn on detailed view.
At the moment I am on the stage where all small tiles are displayed on the first page and I need to find the best way to display detailed view and allow user to navigate easily and quickly. Each tile extends RelativeLayout because of absolute positioning of components inside. I am considering switching tiles from Layout to Fragments because they seem to be providing flexibility required and many articles and tutorials I search refer to them. In this case when user presses the tile fragment, all existing tiles would be replaced with required detail fragment. Pressing back button would replace detail fragment with previous smaller ones on the screen (would it be display all of them or only one?).
Another option I am considering is to leave layouts and on tile press redirect user to a separate Activity with detail view. In this case navigating back seems to be destroying activity and it will need to be redrawn again if user wants to come back to it (redraw is not desirable).
My question is what is better for performance. Each tile as well as detail view might have some images in it and full page will take time to load. But figuring out how to handle this with Fragments programmatically might take a while and the last thing I want to find is that Fragments are not suitable. Maybe you have other ideas for scenario described? Any good tutorials/articles where Fragments are created and managed programmatically completely(no XML).
I am relatively new to Android and completely lost now.
Edit:
Thanks everyone for your advice. I can't choose the best answer at this point. I have to do some more research and learning now. Will do that later.
Fragment should be the best way to go. because filling details in a fragment dynamically is easy. will help check some codes i have written that could solve this
Fragments are a new style in Android for creating GUIs, they should not be compared with simple Activity + xml layout's in performance terms. Fragments were created to make it easier to build complicated GUIs, on both phones and tablets. You can create low performance GUI using both methods.
From your description I suppose its best to create two fragments, and wire them in Master Detail pattern. Master will be your json list with short summaries, and detail will be your additional data fragment. You can still put both fragments in separate activities, and show detail fragment from master one (master actitity will get hidden) - this makes sense on small screen devices. But you can show both fragments on one screen on tablets. See 'Master Detail Flow Template', http://developer.android.com/tools/projects/templates.html.
So fragments gives you a lot of flexibility to modify your UI, without huge code rewrites.
Some new widgets like ViewPager will work only with fragments, so if you want to use it you better invest time in learning them.
From what you have described above you do not need Fragments to do this. On your main page you can use a GridView to display your tiles. You could create two other Activities. One called TileActivity which will open each time a tile is pressed. Then you could create a PopulateActivity which would populate the TileActivity with the relevant information depending on which Tile was pressed. In terms of performance instead of closing the TileActivity to go back to the main page you could use Intent Flags so that the TileActivity isn't closed it is just added to the stack and then restarted instead of recreated each time its called.

Android Map Marker-New Screen

I’m new to development, specifically Android. Through tutorials, I’ve managed to display a map with a marker for a building that displays a “toast” box with text identifying that building, when tapped (I fashioned it after the “Noo Yawk” example). I need to display a new full screen with a photo of that building and text describing it, and use the back button to return to the map. I need to do this for at least 30 buildings.
Do I need to start a new activity for each building? It would seem complicated and resource intensive. If so, where will the photo and text reside? Do I need to have a button in the layout to call the map again? Or is there a simpler way to do this? Given the number of buildings, will content management or a database be required?
Thanks in advance and forgive my ignorance. I’ve parsed so many articles and tutorials that I’m becoming confused.
I would just show Dialog with ImageView (photo), TextView (information) and Button (to close Dialog).
Android dialog Screen Example
I think it would be better to keep photo and info inside database and pass them into Dialog before show.
You can display any view on top of the view. Add marker to your map and listen for onClick events on your marker. (see https://developers.google.com/maps/documentation/android/reference/com/google/android/gms/maps/GoogleMap.OnMarkerClickListener)
Within the onClick event you show a view on top of the map.
Do not try to use the InfoWindows of the Maps API as the InfoWindows are rendered as an image and not as a live view. Therefor async loading of your images is not possible with InfoWindows.

Categories

Resources