How would I show a map in an activity with a customized marker that shows the current location of the device?
If you're planning to use Google Maps, it's pretty easy: https://google-developers.appspot.com/maps/documentation/android/
And for the device location: http://developer.android.com/training/location/retrieve-current.html
Ianlmt said:
How would I show a map in an activity with a customized marker that shows the current location of the device?
Click to expand...
Click to collapse
Look into using a MapFragment.
Stick one in your layout;
Code:
<fragment
class="com.google.android.gms.maps.MapFragment"
android:id="@+id/myMap"
android:layout_width="match_parent"
android:layout_height="match_parent"/>
Then in the onCreate of your activity, get a handle to the fragment and then get the map as a GoogleMap object from there;
Code:
final MapFragment mapFragment = ((MapFragment)getFragmentManager().findFragmentById(R.id.myMap));
final GoogleMap googleMap = mapFragment.getMap();
When you have the GoogleMap instance, it's easy to set positions and markers;
Code:
final LatLng position = new LatLng(100, 100);
map.setMyLocationEnabled(true);
map.moveCamera(CameraUpdateFactory.newLatLngZoomposition, 10));
map.addMarker(new MarkerOptions().title("Some place of interest").position(position));
Hope this helps.
Thank you so much! Going to play with it later today and see what I can produce!
Ianlmt said:
Thank you so much! Going to play with it later today and see what I can produce!
Click to expand...
Click to collapse
Cool, remember that you need to get you API key's sorted to get it to work.
bornander said:
Cool, remember that you need to get you API key's sorted to get it to work.
Click to expand...
Click to collapse
How do I do that (sorry so new to this whole thing)... Do you mean I need to apply for an API key?
Ok I have attached what I worked out in a zipped project file below this post, what it produces is this:
{
"lightbox_close": "Close",
"lightbox_next": "Next",
"lightbox_previous": "Previous",
"lightbox_error": "The requested content cannot be loaded. Please try again later.",
"lightbox_start_slideshow": "Start slideshow",
"lightbox_stop_slideshow": "Stop slideshow",
"lightbox_full_screen": "Full screen",
"lightbox_thumbnails": "Thumbnails",
"lightbox_download": "Download",
"lightbox_share": "Share",
"lightbox_zoom": "Zoom",
"lightbox_new_window": "New window",
"lightbox_toggle_sidebar": "Toggle sidebar"
}
Close, but no actual map is displayed... where did I go wrong?
Thanks for all the help
never-mind it appears I have fixed it ... what I did;
was missing a bunch of code, and the keystone had to match the one that was given to google api, I also had to enable the api from google develper control panel.
Seems to be working now! I am going to keep on tinkering with it, but this is the first map activity I have created... yaaaay
Related
I would like to launch some applications via the startup menu, and some of them simply need to be running in the background to function properly.
Is there a tag on the shortcut like -minimize that will work for all applications or does the specific application need to support it?
Thank you so much
Try Quickmenu....its nice start menu/task manager it has option to exclude programs from closing when u click on X
you could create a simple mortscript that calls the today screen (maybe with a delay) and make sure the shortcut to it is the last one in startup.
Yep, you can use MortScript to do what you need. I think it's the only way because I needed to do it also. I don't use the script anymore so I deleted it, but if you search the MortScript manual for 'minimize' you should find what you need.
I think its dependant upon the app.. but i have used -s successfully before.. you may also want to try to search MSDN
Give a try to the one attached here........
{
"lightbox_close": "Close",
"lightbox_next": "Next",
"lightbox_previous": "Previous",
"lightbox_error": "The requested content cannot be loaded. Please try again later.",
"lightbox_start_slideshow": "Start slideshow",
"lightbox_stop_slideshow": "Stop slideshow",
"lightbox_full_screen": "Full screen",
"lightbox_thumbnails": "Thumbnails",
"lightbox_download": "Download",
"lightbox_share": "Share",
"lightbox_zoom": "Zoom",
"lightbox_new_window": "New window",
"lightbox_toggle_sidebar": "Toggle sidebar"
}
JBabey said:
I would like to launch some applications via the startup menu, and some of them simply need to be running in the background to function properly.
Is there a tag on the shortcut like -minimize that will work for all applications or does the specific application need to support it?
Thank you so much
Click to expand...
Click to collapse
I assume you want to run an app from \Startup. Your question is a little confusing. Anyway, it will be app dependent as far as the functionality using command lines in a .lnk. I do not know of a general command that would work for this as the point of shortcuts is to open the app. If the app is not intended to run in the background on its own, it will open like normal.
What are you trying to do exaclty? Perhaps that would help answer your question a bit more.
Is there a way to force a shortcut to minimize an application when launched?
i need this too.. for UL links..
I found browsing on the Internet a little program here is very interesting
Description: mToday is an application for you to switch between two today screen profiles to enable/disable pre-defined today plug-ins quickly and conveniently.
{
"lightbox_close": "Close",
"lightbox_next": "Next",
"lightbox_previous": "Previous",
"lightbox_error": "The requested content cannot be loaded. Please try again later.",
"lightbox_start_slideshow": "Start slideshow",
"lightbox_stop_slideshow": "Stop slideshow",
"lightbox_full_screen": "Full screen",
"lightbox_thumbnails": "Thumbnails",
"lightbox_download": "Download",
"lightbox_share": "Share",
"lightbox_zoom": "Zoom",
"lightbox_new_window": "New window",
"lightbox_toggle_sidebar": "Toggle sidebar"
}
link for more informations here
thanks Vicott Wong
nice catch bro, i like it
thanks
great find, thanks.
hmm, interesting, thanks.
Nice idea, but very very slow.
good but keep improving
This is a good idea but as mentioned slow, so keep improving.
If you want a quick second today, take the battery status today. Then you have two today screens. But this kill one today and go to the other today. This good to save memory. For me its good. In one I have all my things. And if I want IGO8 I take the other.
NEO130,
Could you please elaborate what is the "battery status today" that you use for mToday with minimal memory?
I try to do the same: one mToday profile with the applications I commonly use and the other mToday profile for iGO8. The profile with commonly used applications works OK but when the link of the empty profile for iGO8 is invoked it stuck my HTC Trinity such that it needs a hard reset. The succeeding boot yields the empty Today.
Not a convenient way to switch profiles, though...
Thank you,
Shkauf
Hi.
I posted this over at MobiSapienz but it may be easier to chat over here?
So I read:
"Added command line option to launch settings (-p0)"
When I do:
Run(SystemPath( "ProgramFiles" ) \ "Vicsoft\MToday\mToda y.exe","-p1")
It pops up the mToday Switcher and leaves it there.
Am I not doing the command line argument correctly. I did try "-1" but as I suspected that also popped up the switcher.
I am also assuming -p0 refers to mToday 1, and -p1 would refer to mToday 2.
I kind of wish there were a reg setting for "Current mToday Profile" for last switched profile.
Thanks...
(Integrating StatusTicker with mToday)
thank you lepsyfou
thats very helpful
Hello Guys,
How can i add an ongoing notification with 2 or 3 buttons... play stop next !?
Something like this
{
"lightbox_close": "Close",
"lightbox_next": "Next",
"lightbox_previous": "Previous",
"lightbox_error": "The requested content cannot be loaded. Please try again later.",
"lightbox_start_slideshow": "Start slideshow",
"lightbox_stop_slideshow": "Stop slideshow",
"lightbox_full_screen": "Full screen",
"lightbox_thumbnails": "Thumbnails",
"lightbox_download": "Download",
"lightbox_share": "Share",
"lightbox_zoom": "Zoom",
"lightbox_new_window": "New window",
"lightbox_toggle_sidebar": "Toggle sidebar"
}
...When i tap a button i want to do an url post.
android 4+
Thanks
Its actually very easy to just add an expandable button to the bottom of your notification (android 4.1+ only I believe):
Code:
Intent mIntent = new Intent();
mIntent.setClass(context, MyClass.class);
PendingIntent mPendingIntent = PendingIntent.getService(context, 0, mIntent, PendingIntent.FLAG_UPDATE_CURRENT);
mNotificationBuilder.addAction(R.drawable.icon, "Test", mPendingIntent);
This call will simply add a button at the bottom of the layout with a little icon called "icon" from your drawables, the text "Test" next to it, and when clicked on will take you to the class that you set as the pending intent.
you can add up to 3 of these (i believe, someone correct me if i'm wrong) per notification.
To get layouts that have buttons on the side (or anywhere other then just under the actual notification) is little trickier though. you'll have to create a layout and then use remote views to get the job done and I dont have an example for that! check out here at the bottom of the page though and it talks about using remote views a little bit. Just be careful with the layout that it will work for different screen sizes and devices!
as for an ongoing notification, here is what you want to call:
Code:
mNotificationBuilder.setOngoing(true)
its also a good idea to set priority for ongoing notifications in my opinion so that they appear where you want them to in the drawer.
Code:
mNotificationBuilder.setPriority(Notification.PRIORITY_MIN); // there are lots of options other then PRIORITY_MIN as well to check out
Hope that helps get you started!
@klinkdawg what you are describing are the action buttons which appear below the notification. In the Google Music app the play/stop buttons are embedded within a custom notification design. You can set a RemoveView with your layout with SetContent function:
http://developer.android.com/refere...er.html#setContent(android.widget.RemoteViews)
However all this good stuff is only available in API level 11+, and the notification with bigger content in API level 16+.
{
"lightbox_close": "Close",
"lightbox_next": "Next",
"lightbox_previous": "Previous",
"lightbox_error": "The requested content cannot be loaded. Please try again later.",
"lightbox_start_slideshow": "Start slideshow",
"lightbox_stop_slideshow": "Stop slideshow",
"lightbox_full_screen": "Full screen",
"lightbox_thumbnails": "Thumbnails",
"lightbox_download": "Download",
"lightbox_share": "Share",
"lightbox_zoom": "Zoom",
"lightbox_new_window": "New window",
"lightbox_toggle_sidebar": "Toggle sidebar"
}
GitHub- Source
Hey Guys i was fiddling around with the PlayView developed by GadgetCheck and thought it would be nice to recreate the whole Google Market Layout so that's what i did . Soon i realised the easiest way to implement Card like layout of Google Play was using a 9 patch drawable. During the process i also observed that the market listview had different no of cards for various screen orientations and resolutions like an auto adjust gridview . So it seemed that Every Single Listitem was holding a variable no of cards according to the dimensions of the screen that's when the Bucket-ListAdapter came into play . This is an adapter contributed by rzsombor at GitHub similar to what you see in the Google Play application. It features a grid-like layout of list elements, with the advantage that you can still use list headers and footers - something that's not possible with the standard GridView.The market like PagerSlidingTabStrip have already been implemented by astuetz . So In an hour or so i was ready with my implementation of the Android Market .
Listview with Simple ListAdapter
Listview with Bucket-ListAdapter
Listview with Bucket-ListAdapter Emulating GridView
GitHub Projects Used
Bucket-ListAdapter
Pager-SlidngTabStip
GitHub- Source-PlayCardsGrid
Note :
The bucket-List Adapter is still a work in progress and there are optimization issues .The adapter does not use recycling of views. Neither does it use the viewHolder pattern. So, it is very likely that the app will go out of memory if the number of items in list goes high. Also, the rendering of the items is very slow and the scrolling is not much smooth. We need to work on it to optimize it. Any Developers who wish to Contribute can fork the project and Share their implementation of the Bucket List Adapter in this thread.
Thanks . Happy Coding !
how to implement context menu on the items?
cHu-X said:
how to implement context menu on the items?
Click to expand...
Click to collapse
Its super simple to implement context menu on items. Register a onClickListener on the Overflow ImageView and start a PopupMenu when the overflow icon is clicked. That's it..hope it helped. Also you can now check the code on GitHub. I have added a GitHuB repo for PlayCards GridView
Here you go. :angel:
GitHub - Source
Often we find ourselves messed up with simple things such as layouts.
So I made this library modifying AOSP code to help put items in a Grid Layout.
You can add this as a library or put it separately into your package since it consists of just a single Java file.
Its pretty simple and extremely easy to use. Just put the items in xml between the following tags:
Code:
<tk.eatheat.gridlayout.GridLayout>
....
</tk.eatheat.gridlayout.GridLayout>
By default, it creates a 3x3 grid. To change it just set the number of rows and columns in these lines:
Code:
static private final int COLUMNS = 3;
static private final int ROWS = 3;
Here's a sample app made with the library to show the result.
{
"lightbox_close": "Close",
"lightbox_next": "Next",
"lightbox_previous": "Previous",
"lightbox_error": "The requested content cannot be loaded. Please try again later.",
"lightbox_start_slideshow": "Start slideshow",
"lightbox_stop_slideshow": "Stop slideshow",
"lightbox_full_screen": "Full screen",
"lightbox_thumbnails": "Thumbnails",
"lightbox_download": "Download",
"lightbox_share": "Share",
"lightbox_zoom": "Zoom",
"lightbox_new_window": "New window",
"lightbox_toggle_sidebar": "Toggle sidebar"
}
Click to expand...
Click to collapse
Sample app can be found here.
Library can be found here on my Github here.
-------------------------------
Featured on Portal:
http://www.xda-developers.com/android/simple-gridlayout/
Hey, cool library.
Thanks. :good:
I recently started hobby android app development and this was the thing that always bothered me the most !
Thanks a ton ! this saves me a lot of effort and simplifies everything
sheennick123456 said:
I recently started hobby android app development and this was the thing that always bothered me the most !
Thanks a ton ! this saves me a lot of effort and simplifies everything
Click to expand...
Click to collapse
You are welcome. Glad to be of help.
EatHeat said:
You are welcome. Glad to be of help.
Click to expand...
Click to collapse
Could you add activity starter to buttons?
Sent from my GT-S5570I using xda app-developers app
@m4RinKo2
Code:
Intent intent = new Intent(Intent.ACTION_MAIN);
intent.setComponent(newComponentName("com.package.app","com.package.app.ExampleActivity"));
startActivity(intent);
Set intent on the buttons with the correct package and activity names.
Thanks for your hard-work.
This library will be surely somewhere used by me.
Sent from my GT-I9300 using XDA Premium 4 mobile app
Nice lib brother I have a question before importing it to my project how can we add Item click listener so that if i have a list of images in grid i can select one image from that silly question plz help @EatHeat