'on click' listener to app widget

by Vladyslav Namashko » Fri, 02 Apr 2010 22:27:23 GMT


Sponsored Links
 Hi all,

Some built in Android widgets (like 'Music', a lot of specific HTC
apps...) has on 'click listeners' (for example, music has 'play' and
'next' buttons). So, is there possibility to add such listeners to my
widget or to some certain view from widget (I found only
setOnClickPendingIntent method from RemoteViews obj. which allows to
start some activity, but this is not what I'm looking for), something
like 'onClickListener'?

Regards

--



'on click' listener to app widget

by Mark Murphy » Fri, 02 Apr 2010 22:45:58 GMT


 


setOnClickPendingIntent is exactly what you are looking for.

-- 
Mark Murphy (a Commons Guy)
 http://commonsware.com  |  http://twitter.com/commonsguy 

Android App Developer Books:  http://commonsware.com/books 

--


Sponsored Links


Other Threads

1. AlertDialog setDapter

I am trying to use setAdapter to populate a dialog list. My array
adapter is getting populated with the correct values and is assigned
to the alert dialog with setAdapter fine.

The dialog knows that it should be displaying 3 value and shows a list
with 3 values. However the list displayed in the alert had 3 empty
lines. They are just blank without the text values on them.

What am I doing wrong here? Thanks in advance.

final ArrayList<String> vehicleList = new ArrayList<String>();
vehicleList.add("List entry 1");
vehicleList.add("List entry 2");
vehicleList.add("List entry 3");
ArrayAdapter<String> vehicleAdapter = new ArrayAdapter<String>(this,
android.R.layout.simple_list_item_1, vehicleList);


                    AlertDialog.Builder builder = new AlertDialog.Builder(this);
                    builder.setTitle("Choose vehicle");
                    //builder.setItems(items, new 
DialogInterface.OnClickListener()
{
                    builder.setAdapter(vehicleAdapter, new
DialogInterface.OnClickListener() {
                        public void onClick(DialogInterface dialog, int item) {
                            Toast.makeText(getApplicationContext(), "Item 
selected",
Toast.LENGTH_SHORT).show();
                        }
                    });
                    AlertDialog alert = builder.create();
                    alert.show();
--~--~---------~--~----~------------~-------~--~----~

2. layout_gravity does not center the control

Hi

I have a list, a web view and certain buttons on my activity's layout.
I am trying to center the web view in the layout. The layout_gravity  
attribute that I use for the webview doesn't seem to work. It stays  
put aligned to the left of the screen when I view the activity.

Can someone please tell me how I can center the web view? Thanks.

This is the XML I am using

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent"
xmlns:android="http://schemas.android.com/apk/res/android"
 >

<ListView
android:id="@+id/SCHEDULE"
android:layout_width="fill_parent"
android:layout_height="200px"
android:layout_marginTop="1px"
android:layout_below="@id/text">
</ListView>

<WebView
android:id="@+id/MYVIEW"
android:layout_width="175px"
android:layout_height="130px"
android:layout_below="@id/SCHEDULE"
android:layout_marginTop="15px"
android:layout_gravity="center_horizontal"
 >
</WebView>
<Button
android:id="@+id/updatebtn"
android:layout_width="70px"
android:layout_height="36px"
android:text="Update Now"
android:textSize="14sp"
android:textColor="#ff000000"
android:layout_marginTop="15px"
android:layout_below ="@id/RIDERMAP"
/>
</RelativeLayout>



--~--~---------~--~----~------------~-------~--~----~

3. how make the ListView be above the button

4. Does fastboot tools support large img download?

5. Developer does't see comments on android market from other countries

6. Is this possible? Launching one application from another?

7. Developer does't see comments on android market from other countries