Map in android widget - android

I m trying to show map in android widget . But as far as i see there is no mapview in android widget. Anybody please tell me is there any possible way to display a map in android widget?

a Mapview is NOT a view that is supported in a widget. As can be noted here:
http://developer.android.com/guide/topics/appwidgets/index.html
Creating the App Widget layout is simple if you're familiar with XML
Layouts. However, you must be aware that App Widget layouts are based
on RemoteViews, which do not support every kind of layout or view
widget.
A RemoteViews object (and, consequently, an App Widget) can support
the following layout classes:
FrameLayout
LinearLayout
RelativeLayout
And the following widget classes:
AnalogClock
Button
Chronometer
ImageButton
ImageView
ProgressBar
TextView
ViewFlipper
ListView
GridView
StackView
AdapterViewFlipper
Descendants of these classes are not supported.

You can use simple ImageView with Static Maps API and draw over returned image from Google Maps. It's not exactly Google Maps, but it's extremely light weight (which is perfect for app widgets).

If you are app developer, there is no way.
If you can modify the framework, you can.

Related

Android: How I can I add a background image to a GridLayout?

I have a GridLayout full of buttons - similar to a calculate with spaces between the buttons. I wants to skin the background including the those areas between the buttons but not the buttons themselves.
What is the best way to do this? Is there a means of setting a background image on the GridLayout itself or do I need to create a View hierarchy?
I had started experimenting thinking that child Views can be added to parent Views but it would appear that you can only add Views to ViewGroup derived classes?
Without a background, I'm dynamically constructing my GridLayout and adding it to the activity's default layout using setContentView( gridLayout ).
How would I go about doing this please?
EDIT: What I would really like to understand is how to compose complex view hierachies. It also appears the simple approach of gridLayout.setBackground() requires API 16 and I'm using API 14 for my devices too.
GridView is derived from View class. The View class has a method called void setBackgroundResource (), you can call it on your grid view object, pass an id of a drawable resource to it. This method was introduced since API level 1, so you don't have to worry about API compatibility issues.
You can add a background image to a GridLayout easily like this:
A) gridLayout.setBackgroundResource(R.drawable.background_image);
B)
Resources res = getResources();
Drawable drawable = res.getDrawable(R.drawable.background_image);
gridLayout.setBackground(drawable);
However, please note, that I found when OTA upgraded from Android 6.0 to 7.1.1 (Galaxy J5 (2016)), that GridLayout doesn't support displaying a background drawable since API 24. (Neither of the above code seems to be working above API 23, not even on Android Emulator images)
However, TableLayout's background image is properly displayed even at API 24+.
(Therefore I had to rewrote all my relevant code from GridLayout to TableLayout, but these layouts quite similar, so it not much a problem.)

How to make a User Interface of my android application

I am trying to make android application which display newsfeeds through web,I have done with all functionality, as I programmed well but not design well I am getting problem to desing UI of my Application,I donot have enough idea how to do this, whether I use relative layout,or linear layout etc, Would you suggest me the way how can I design UI in xml file, I would be very grateful to you
Use the UI Guidelines from Android Dev site. Take the trainings provided there if you require. Read the Quick Overview page as well to cover important aspects.
... and here is a resource listing page for further reference.
First you have to learn android layouts. Try with some examples on each layouts. People here can help you if you have any issue with layouts, but don't expect someone to design and code for you.
OK . I would suggest you to use these layouts for this screen
Use ActionbarActivity with menu items ( action icon)
Search view or Edit text
Image view
Text view
Vertical Linearlayout with Imageview and Text view
Grid view with text view items.

Android Widget Scrollabe Textview

i'm developing a SMS Widget.So came to across messages-widget
When i tried to replicate, the scroll feature is not available to that widget.
when i surfed, results where http://stackoverflow.com/questions/3879748/scrollable-textview-in-android-widget
Note i'm using Android 2.2 API Level 8.
Can anyone tell me how textview is scrollable with that opensource coding.
Is it possible to make a scrollable textview in widget ?
The link you provided is not a scrollable widget. It has buttons to move to the next/previous message.
HTC (and maybe others) have scrollable widgets, but it's their own implementation.
Scrollable widgets (with ListView and GridView) are available in Android 3.0+ (API 11+).

Why should I use RemoteViews for Android home screen widgets?

I'm trying to realize an Android home screen widget. I am interested to know why I should use RemoteViews in implementing widgets?
Refer this link site.
Creating the App Widget layout is simple if you're familiar with Declaring Layout in XML. However, you must be aware that App Widget layouts are based on RemoteViews, which do not support every kind of layout or view widget.
A RemoteViews object (and, consequently, an App Widget) can support the following layout classes:
FrameLayout
LinearLayout
RelativeLayout
And the following widget classes:
AnalogClock
Button
Chronometer
ImageButton
ImageView
ProgressBar
TextView
Descendants of these classes are not supported.
Most of the time Widget is hosted within another application, like Launcher, which is run within that parent application's process.
RemoteViews describes a view hierarchy that can be displayed in another process. The hierarchy is inflated from a layout resource file, and this class provides some basic operations for modifying the content of the inflated hierarchy.
The main reason behind this choice is related to security and performance.
RemoteViews is used for the app widgets. They are part of separate process but bind to the main process i.e. why when we click over widgets it redirects to the associated application with more detailed information.

Can the "Buddies Now" widget be implemented with the standard Android launcher?

The Samsung Galaxy S includes the custom widget "Buddies Now". This widget implements a carousel that can be rotated with a a press-drag. Here's a description of the widget:
http://www.phonescoop.com/articles/article.php?a=389&p=2830&g=3054&h=25816
This widget exhibits features not commonly seen in other widgets: animated images and interactivity beyond a simple click. Does this widget take advantage of Samsung's custom launcher (TwLauncher), or is it a standard widget? If it is a standard widget, what API does it use for the animation and interactivity?
It's using Samsung's custom launcher to provide those features.
To see what can/can't be done with app widgets currently look here: http://developer.android.com/guide/topics/appwidgets/index.html
Specifically this section:
A RemoteViews object (and,
consequently, an App Widget) can
support the following layout classes:
FrameLayout
LinearLayout
RelativeLayout
And the following
widget classes:
AnalogClock Button Chronometer
ImageButton ImageView ProgressBar
TextView
So you don't have the UI components at your disposal when creating app widgets to design something with that level of interactivity. Not if you are targeting the stock launcher anyway.
However, from what I've seen of the Android 3.0 SDK, I think this level of interactivity will be possible on the stock Android 3.0 (Honeycomb) launcher.

Categories

Resources