Different AlarmClock applications for every phone?

by Thomas » Fri, 12 Mar 2010 01:50:07 GMT


Sponsored Links
 I have a widget that should launch the AlarmClock when its clicked.
After searching for a result it seems to me that every phone can have
its own AlarmClock-application, and that what I am trying to do isnt
really possible?

I have been using this for HTC Hero:
i.setClassName("com.htc.android.worldclock",
"com.htc.android.worldclock.WorldClockTabControl");
resolved = packageManager.resolveActivity(i,
PackageManager.MATCH_DEFAULT_ONLY);

And this if not HTC Hero:
i.setClassName("com.android.alarmclock",
"com.android.alarmclock.AlarmClock");
resolved = packageManager.resolveActivity(i,
PackageManager.MATCH_DEFAULT_ONLY);

This way I can check if the AlarmClock application is there. But now
it seems that the Nexus One has yet another application. Does anyone
know the component name and class for the Nexus AlarmClock?

I can see that this will be a growing list of checks, so is there a
better way?

Thomas

--



Different AlarmClock applications for every phone?

by Dianne Hackborn » Fri, 12 Mar 2010 02:49:14 GMT


 There is no standard alarm clock API in the platform.  Heck, some devices
may not even have one.




>


Sponsored Links


Different AlarmClock applications for every phone?

by Thomas Ermesjo » Fri, 12 Mar 2010 03:02:31 GMT


 So anyone with a Nexus One can check their logcat to see what the Alarmclock
classname for the nexus is?

Thomas

2010/3/11 Dianne Hackborn <hack...@android.com>


>>



Different AlarmClock applications for every phone?

by Mark Murphy » Fri, 12 Mar 2010 03:11:06 GMT


 


You should not be doing this. The alarm clock is an application, not
part of the SDK.

 http://www.androidguys.com/2009/12/14/code-pollution-reaching-past-the-sdk/ 

Some applications that may exist on Android have publicly documented
Intents, such as:

 http://developer.android.com/uide/appendix/g-app-intents.html 

The alarm clock is not one of them.

Now, if you want to allow the user to choose an application to launch,
by pulling up a list of available activities from the PackageManager,
that's perfectly reasonable.

But please don't go around hard-wiring class names in your code.

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

_Android Programming Tutorials_ Version 2.0 Available!

--



Different AlarmClock applications for every phone?

by Thomas Ermesjo » Fri, 12 Mar 2010 03:30:18 GMT


 >Now, if you want to allow the user to choose an application to launch,

Thanks. Good idea.


2010/3/11 Mark Murphy <mmur...@commonsware.com>



>



Other Threads

1. Download image from server

Hi,

I have to download an image from server.But I got an error "D/skia
( 197): xxxxxxxxxxx jpeg error 53 Not a JPEG file: starts with 0x%02x
0x%02x"

I have to perform two continues Http connection.First is used to get
server response and second to get image from the server.First task is
performed correctly but while downloading image I got the given
eror.So the problem in getting image from server.

My code is:
Code:

public ImageView getView(String myImageURL) {
       Log.i("TAG","downloadFile000000000000000000"+myImageURL);
        ImageView i = new ImageView(this);

        try {
                /* Open a new URL and get the InputStream to load data
from it. */
                URL aURL = new URL(myImageURL);
                URLConnection conn = aURL.openConnection();
 
Log.i("TAG","downloadFile1111111111111111111"+myImageURL);
                conn.connect();
                InputStream is = conn.getInputStream();
 
Log.i("TAG","downloadFile2222222222222222222222"+is.read());
                /* Buffered is always good for a performance plus. */
                BufferedInputStream bis = new BufferedInputStream(is);
 
Log.i("TAG","downloadFile33333333333333333333="+bis.read());
                /* Decode url-data to a bitmap. */
               // Bitmap bm = BitmapFactory.decodeStream(bis);
                Bitmap bm = BitmapFactory.decodeStream(is);
               //
Log.i("TAG","downloadFile4444444444444444444"+bm.getHeight());
               // bis.close();
                is.close();
                /* Apply the Bitmap to the ImageView that will be
returned. */
                i.setImageBitmap(bm);
                Log.i("TAG","downloadFile555555555555555555555");
           } catch (IOException e) {
              Log.i("TAG","downloadFile666666666666666666666666");
                Log.e("DEBUGTAG", "Remtoe Image Exception", e);
           }

        /* Image should be scaled as width/height are set. */
       // i.setScaleType(ImageView.ScaleType.FIT_CENTER);
        /* Set the Width/Height of the ImageView. */

        return i;
    }


This code works fine when I performed this task alone in another
project.
--~--~---------~--~----~------------~-------~--~----~

2. How do I use View(Context context,AttributeSet attrs) constructor??

I'm trying to convert an Xml string into a view by parsing out the
attributes into a set, and keep getting the following exception...

java.lang.ClassCastException: android.util.XmlPullAttributes

is called whenever I attempt to call Xml.asAttributeSet(XmlPullParser
parser).

Code below:

   XmlPullParserFactory factory = XmlPullParserFactory.newInstance();
   factory.setNamespaceAware(true);
   XmlPullParser xpp = factory.newPullParser();
   Log.d("ABC","**********");
   xpp.setInput(new StringReader(XML_STRING));
   int eventType = xpp.getEventType();
   while (eventType!=XmlPullParser.END_DOCUMENT)
        eventType = xpp.next();
   try
   {
                View v = new View(this,Xml.asAttributeSet(xpp));
                setContentView(v);
    }
   catch (Exception e)
    {
                Log.d("ERROR","EXCEPTION:"+e);
    }
--~--~---------~--~----~------------~-------~--~----~

3. UnsupportedClassVersionError with 0.9 and Eclipse layout editor

4. Google Android Developers...

5. best performing xml parser for android?

6. changing path r.java

7. T-Mobile will be restricting voice over internet protocol (VoIP) applications.