Search Results

Search found 35 results on 2 pages for 'appwidget'.

Page 1/2 | 1 2  | Next Page >

  • Looking for an elegant appwidget skin solution

    - by sam-henwood
    I have an appwidget application and would like to enable users to create skins which can be applied at runtime. My preferred solution is to use apk files with nine patch png images that stretch to fit the ImageView's of widget, however its starting to look like I might have to use another packaging technique (e.g. zip files). What I've tried: Importing nine patch resources as Drawable with context.getResourcesForApplication(my.app).getResources..., converting them to bitmaps using a canvas and setting the bitmap to the RemoteView using setImageViewBitap. This didn't work because I needed to specify the size of the resulting view (myBitmap.setBounds(..,..)) during conversion and some of the widths/heights in my appwidget aren't fixed. Perhaps there is a way to get the heights etc that I missed. Importing resources directly to the RemoteView using setImageViewUri() This doesn't work because the function doesn't seem to read android.resource:// Uri's anymore (I poked around in the ImageView source and it only seems to read files paths and content:// Uri's) Importing resources directly to the RemoteView using setImageViewResource() which didn't work because the id retrieved from the external package obviously doesn't include a package reference. What I'm trying to avoid is hard coding all my appwidget width's and height's, or using a separate packaging scheme. Has anyone implemented appwidget skins nicely and want to share the knowledge? Alternately there might be a hole in my logic somewhere that can be pointed out. I can provide code if required though I don't have any here right now.

    Read the article

  • How can I get the correct DisplayMetrics from an AppWidget in Android?

    - by Gary
    I need to determine the screen density at runtime in an Android AppWidget. I've set up an HDPI emulator device (avd). If set up a regular executable project, and insert this code into the onCreate method: DisplayMetrics dm = getResources().getDisplayMetrics(); Log.d("MyTag", "screen density " + dm.densityDpi); This outputs "screen density 240" as expected. However, if I set up an AppWidget project, and insert this code into the onUpdate method: DisplayMetrics dm = context.getResources().getDisplayMetrics(); Log.d("MyTag", "screen density " + dm.densityDpi); This outputs "screen density 160". I noticed, hooking up the debugger, that the mDefaultDisplay member of the Resources object here is null in the AppWidget case. Similarly, if I get a resource at runtime using the Resources object obtained from context.getResources() in the AppWidget, it returns the wrong resource based on screen density. For instance, I have a 60x60px drawable for mdpi, and an 80x80 drawable for hdpi. If I get this Drawable object using context.getResources().getDrawable(...), it returns the 60x60 version. Is there any way to correctly deal with resources at runtime from the context of an AppWidget? Thanks!

    Read the article

  • How to programmatically disable onClick handler on Android AppWidget Button

    - by Gaks
    I have a Button on appwidget, that I need to 'enable'/'disable' programmatically from a Service. First idea was to call setBoolean(R.id.buttonid, "setClickable", false) to disable it, but apparently you can't call setClickable remotely. Another idea was was remove the text label from it with rv.setTextViewText(R.id.buttonid, "") and then remove the click handler by rv.setOnClickPendingIntent(R.id.buttonid, null). Unfortunately passing null to it causes NullPointerException in in android.app.ActivityThread.handleServiceArgs Is there some other way to programmatically disable/enable appwidget Button? I could just call rv.setViewVisibility(R.id.buttonid, View.GONE) to hide the button completely instead of disabling it. This would however completely break whole widget layout and I would like to avoid it. The solution I'm using now is hiding the button with setViewVisibility and showing other blank button instead to the keep appwidget layout as it was before.

    Read the article

  • Calling SharedPrefences on AppWidget

    - by Rexx
    Hello all, I would like to know if there is an issue with calling a sharedPeference value on an appWidget provider class so i can use it for an update. I have this code which i call on a method in the appWidget provider class, but it keeps giving me compilation error and that i should create a method for it. this is the code: prefs = getSharedPreference("myPrefs", Context.MODE_PRIVATE); is this a known issue and is there any other way i can pass the value from my configuration class, if this is not possible. Thank you

    Read the article

  • Android AppWidget TextView: How to set background color programmaticly

    - by Amit
    I am trying to create an AppWidget, in which the background color of a TextView changes at random at specified periodic interval. The TextView is defined in layout xml file as <?xml version="1.0" encoding="utf-8" ?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/widget" android:layout_width="fill_parent" android:layout_height="wrap_content" android:orientation="vertical" > <TextView android:id="@+id/message" android:background="#ff99ff" android:text="Hello Widget" /> </LinearLayout> In update method, i have loaded the layout as RemoteViews remoteView=new RemoteViews(context.getPackageName(),R.layout.widget_message); To change the background of TextView i used the following statement remoteView.setInt(R.id.message, "setBackgroundResource", R.color.col_1); But i am getting a widget saying problem loading widget. If i remove the above line everything works fine. LogCat says: updateAppWidget couldn't find any view, using error view android.widget.RemoteViews$ActionException: view: android.widget.TextView can't use method with RemoteViews: setBackgroundResource(int)

    Read the article

  • Android AppWidget TextView: How to set background color at run time

    - by Amit
    I am trying to create an AppWidget, in which the background color of a TextView changes at random at specified periodic interval. The TextView is defined in layout xml file as <?xml version="1.0" encoding="utf-8" ?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/widget" android:layout_width="fill_parent" android:layout_height="wrap_content" android:orientation="vertical" > <TextView android:id="@+id/message" android:background="#ff99ff" android:text="Hello Widget" /> </LinearLayout> In update method, i have loaded the layout as RemoteViews remoteView=new RemoteViews(context.getPackageName(),R.layout.widget_message); To change the background of TextView i used the following statement remoteView.setInt(R.id.message, "setBackgroundResource", R.color.col_1); But i am getting a widget saying problem loading widget. If i remove the above line everything works fine. LogCat says: updateAppWidget couldn't find any view, using error view android.widget.RemoteViews$ActionException: view: android.widget.TextView can't use method with RemoteViews: setBackgroundResource(int)

    Read the article

  • Android AppWidget maps activity problem

    - by Andy Armstrong
    Right. So I have an app widget. It has 4 buttons, one one of the buttons I want it to show me the current location of the user on the map. So - I make a new activity as below: package com.android.driverwidget; import java.util.List; import android.os.Bundle; import com.google.android.maps.MapActivity; import com.google.android.maps.MapController; import com.google.android.maps.MapView; import com.google.android.maps.MyLocationOverlay; import com.google.android.maps.Overlay; public class MyLocation extends MapActivity{ public void onCreate(Bundle icicle) { super.onCreate(icicle); setContentView(R.layout.main); MapView myMapView = (MapView)findViewById(R.id.mapview); MapController mapController = myMapView.getController(); List<Overlay> overlays = myMapView.getOverlays(); MyLocationOverlay myLocationOverlay = new MyLocationOverlay(this, myMapView); overlays.add(myLocationOverlay); myLocationOverlay.enableMyLocation(); } protected boolean isRouteDisplayed() { return false; } } And then I added the appropriate uses library line to the manifest <activity android:name=".MyLocation" android:label="myLocation"> </activity> <uses-library android:name="com.google.android.maps" /> Ok yet - when I run the app the following errors occur, looks like it cannot find the MapActivity class, im running it on the GoogleApps 1.5 instead of normal android 1.5 as well. http://pastebin.com/m3ee8dba2 Somebody plz help me - i am now dying.

    Read the article

  • Send a public broadcast from an AppWidget in Android

    - by greve
    I have a widget for a music player and want to be able to send broadcasts when pushing the different buttons. What I want to do is when a button is pushed, the widget sends a public broadcast to another BroadcastReceiver so it can handle the different actions. In my activity class with the BroadcastReceiver: private BroadcastReceiver broadcastReceiver = new BroadcastReceiver() { @Override public void onReceive(Context context, Intent intent) { String action = intent.getAction(); if (action.equals(Constants.ACTION_NEXT)) { Log.d("RECEIVER", "ACTION_NEXT"); } } }; @Override protected void onStart() { super.onStart(); IntentFilter filter = new IntentFilter(); //Widget actions filter.addAction(Constants.ACTION_NEXT); registerReceiver(broadcastReceiver, new IntentFilter(filter)); } In my Widget: public void onUpdate(Context context, AppWidgetManager appWidgetManager, int[] appWidgetIds) { RemoteViews views = new RemoteViews(context.getPackageName(), R.layout.widget); PendingIntent pendingIntent = PendingIntent.getBroadcast(context, 0, new Intent(Constants.ACTION_NEXT), 0); views.setOnClickPendingIntent(R.id.WidgetNextButton, pendingIntent); appWidgetManager.updateAppWidget(appWidgetId, views); } Any help or other solutions are very much appreciated!

    Read the article

  • Get preferences in AppWidget Provider

    - by Brian515
    Hi all, I seem to be having trouble reading preferences from my AppWidgetProvider class. My code works in an Activity, but it does not in an AppWidgetProvider. Here is the code I am using to read back a boolean: SharedPreferences settings = getSharedPreferences(PREFS_NAME, 0); boolean autoreplyon = settings.getBoolean("autoreplyon", false); However, I get the "The method getSharedPreferences(String, int) is undefined for the type widget" error (widget is the name of my AppWidgetProvider class). Thanks in advance for any suggestions!

    Read the article

  • How to influence linebreak in Android Textview

    - by Lord Flash
    I have an Appwidget displaying days until an event like: eventname (-231 days) If possible I want to display this String in one line. If the eventname is too long I want to display the full term in braces into a new line. So that it is like: longeventname (-231 days) instead of: longeventname (-231 days) (or anything similar) Is there a way to archive this? Can I make (-231 days) "atomic"? string.getLength won't work since the size of the widget will vary by device.

    Read the article

  • Don't launch application from widget

    - by Brian515
    Hi all, I'm trying to make an appwidget where I have a dialog pop up on top of the home screen. (Ex the Facebook widget). I have button on the widget and an activity that I run when the button is clicked. I have the activity set to the Theme.Translucent.NoTitleBar theme so that the dialog and/or toast I have should pop up over the home screen. Anyways, whenever I have the transparent activity open, it opens the application instead of staying on the home screen. Any help would be appreciated! Thanks in advance!

    Read the article

  • How to launch activity from android home screen widget

    - by Brian515
    Hi all, I am desperately trying to get my head wrapped around how to implement home screen widgets. Right now, I (finally) was able to get a button on my widget respond to a button press setting up an intent filter in the manifest. However, I cannot for the life of me figure out how to launch an activity when the button is pressed. Basically, here's the code i have: @Override public void onReceive(Context context, Intent intent) { super.onReceive(context, intent); if(intent.getAction().equals("com.bic.search.searchWidget.CLICK")) { Toast.makeText(context, "It works!!", Toast.LENGTH_SHORT).show(); } } What I really want to do, though, is start a new activity, not display a toast message. I know it has something to do with pending intents, but I can't figure out how to get that to work. Any help and sample code would be appreciated. Thanks a ton to whoever answers this!

    Read the article

  • How to highlight clicks in app widget?

    - by steff
    Hi everyone, I have an app widget which runs neatly. However, I am unable to highlight a click on a linked item. I've seen it in the standard app widgets like 'Music' and 'Power Control', for instance. Moreover, I've also been studying the Music app widget's source at album_appwidget.xml. The only thing I could think of is the LinearLayout defined at lines 23-35 which states android:clickable="true" Unfortunately, this does not work for me. So does anyone have a hint on how to highlight a click on an app widget? I've tried the LinearLayout, TextView and Button. None of them displayed a border as a highlight. Thanks in advance, Steff

    Read the article

  • Custom component which displays voice recognition button if available

    - by steff
    Hi evereyone, I'd like to create a custom component which supports voice recognition. It will primarily be an extended EditText which should show the microphone button for voice recognition if it is available. I wanted to to look at the search app-widget on the homescreen but I don't find it in the source. This is intended to use the voice recognition as some sort of dictation device, i.e. the user does not have to type but use his voice instead. So could anyone please point me in some direction? Thanks in advance, Steff

    Read the article

  • asses resouces from another apk for widget(like theme apk)

    - by Diljeet
    asses resouces from another apk for widget(like theme apk) Hello i made a theme with drawables and strings, i can access the theme's resources by following commands String packagename="com....."; Resources res = context.getPackageManager().getResourcesForApplication(packagename); int strid = res.getIdentifier(packagename+":string/"+name, "string", packagename); int drawableid = res.getIdentifier(packagename+":drawable/"+name, "drawable", packagename); String name = res.getString(resid); Bitmap bmp = BitmapFactory.decodeResource(res, resid); //or Drawable dr=res.getDrawable(resid); I can get the drawables, but i don't know how to set the drawables in xml to a widget. I only can set setImageViewResource(int viewid, int resId); So i am asking that how to access xml resources from another apk and set widget drawables from it. I want to access a resource like this from another theme apk, but i can only access the drawable(so can't use it for widgets) <?xml version="1.0" encoding="utf-8"?> <selector xmlns:android="http://schemas.android.com/apk/res/android"> <item android:state_pressed="true" android:drawable="@drawable/wplayh" /> <item android:drawable="@drawable/wplay" /> </selector>

    Read the article

  • [android] Is it possible to receive SMS message on appWidget?

    - by cappuccino
    [Android] Hi, everyone. Is it possible to receive SMS message on appWidget? I saw android sample soucrce(API Demos). In API Demos, ExampleAppWidgetProvider class extends AppWidgetProvider, not Activity. So, I guess it is impossible to regist SMS Receiver like this, rcvIncoming = new BroadcastReceiver() { @Override public void onReceive(Context context, Intent intent) { Log.i("telephony", "SMS received"); Bundle data = intent.getExtras(); if (data != null) { // SMS uses a data format known as a PDU Object pdus[] = (Object[]) data.get("pdus"); String message = "New message:\n"; String sender = null; for (Object pdu : pdus) { SmsMessage part = SmsMessage.createFromPdu((byte[])pdu); message += part.getDisplayMessageBody(); if (sender == null) { sender = part.getDisplayOriginatingAddress(); } } Log.i(sender, message); } } }; registerReceiver(rcvIncoming, new IntentFilter("android.provider.Telephony.SMS_RECEIVED")); My goal is to receive SMS message on my custom appWidget. any help would be appreciated!!

    Read the article

  • Is it possible to receive SMS message on appWidget?

    - by cappuccino
    Is it possible to receive SMS message on appWidget? I saw android sample source(API Demos). In API Demos, ExampleAppWidgetProvider class extends AppWidgetProvider, not Activity. So, I guess it is impossible to regist SMS Receiver like this, rcvIncoming = new BroadcastReceiver() { @Override public void onReceive(Context context, Intent intent) { Log.i("telephony", "SMS received"); Bundle data = intent.getExtras(); if (data != null) { // SMS uses a data format known as a PDU Object pdus[] = (Object[]) data.get("pdus"); String message = "New message:\n"; String sender = null; for (Object pdu : pdus) { SmsMessage part = SmsMessage.createFromPdu((byte[])pdu); message += part.getDisplayMessageBody(); if (sender == null) { sender = part.getDisplayOriginatingAddress(); } } Log.i(sender, message); } } }; registerReceiver(rcvIncoming, new IntentFilter("android.provider.Telephony.SMS_RECEIVED")); My goal is to receive SMS message on my custom appWidget. Any help would be appreciated!!

    Read the article

  • Android - Widget to Play Video (onclick trouble)

    - by Josh
    I am trying to make a simple widget that will play a movie from the sdcard when clicked on. This seems simple enough, and by following tutorials I've come up with the following code, but it seems the onclick is never setup. Manifest: <receiver android:name="WidgetProvider" android:label="DVD Cover"> <intent-filter> <action android:name="android.appwidget.action.APPWIDGET_UPDATE"/> </intent-filter> <meta-data android:name="android.appwidget.provider" android:resource="@xml/appwidget_info_2x4"/> </receiver> Layout (widget.xml): <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/holder" android:orientation="vertical" android:layout_width="fill_parent" android:layout_height="fill_parent" android:background="#ff777777" > <ImageView android:id="@+id/cover" android:layout_width="wrap_content" android:layout_height="fill_parent" android:textColor="#000000" /> </LinearLayout> appwidget.xml: <?xml version="1.0" encoding="utf-8"?> <appwidget-provider xmlns:android="http://schemas.android.com/apk/res/android" android:minWidth="200dip" android:minHeight="300dip" android:updatePeriodMillis="180000" android:initialLayout="@layout/widget" > </appwidget-provider> WidgetProvider.java: public class WidgetProvider extends AppWidgetProvider { public void onUpdate(Context context, AppWidgetManager appWidgetManager, int[] appWidgetIds) { String movieurl = Environment.getExternalStorageDirectory().getPath() + "/Movie.mp4"; Intent notificationIntent = new Intent(Intent.ACTION_VIEW); notificationIntent.setDataAndType(Uri.parse(movieurl), "video/*"); PendingIntent contentIntent = PendingIntent.getActivity(context, 0, notificationIntent,0); // Get the layout for the App Widget and attach an on-click listener // to the button RemoteViews views = new RemoteViews(context.getPackageName(), R.layout.widget); views.setOnClickPendingIntent(R.id.holder, contentIntent); // Tell the AppWidgetManager to perform an update on the current app widget appWidgetManager.updateAppWidget(appWidgetIds, views); } } Any help would be greatly appreciated. Thanks, Josh

    Read the article

  • Button click does not start Service in Android App Widget

    - by Feanor
    I'm having trouble starting a Service to update an AppWidget that I'm creating as an exercise. I'm trying to get the latitude and longitude of spoofed location data from DDMS to display in the widget. The widget uses a service to update the TextView, which may be slightly overkill, but I wanted to follow the template that seems to be common in AppWidgets that do more work (like the Forecast widget or the Wiktionary widget). Right now, I'm not getting any error messages or strange behavior; nothing at all happens when the button is pressed. I'm a bit mystified as to what might be wrong. Could anyone out there point me in the right direction? Additionally, if my logic for location is faulty, I'd love recommendations on that too. I've looked at several blogs, the Google examples, and the documentation, but I feel a little fuzzy on how it works. Here is the current state of the widget: public class Widget extends AppWidgetProvider { static final String TAG = "Widget"; /** * {@inheritDoc} */ public void onUpdate(Context context, AppWidgetManager appWidgetManager, int[] appWidgetIds) { // Create an intent to launch the service Intent serviceIntent = new Intent(context, UpdateService.class); // PendingIntent is required for the onClickPendingIntent that actually // starts the service from a button click PendingIntent pendingServiceIntent = PendingIntent.getService(context, 0, serviceIntent, 0); // Get the layout for the App Widget and attach a click listener to the // button RemoteViews views = new RemoteViews(context.getPackageName(), R.layout.main); views.setOnClickPendingIntent(R.id.address_button, pendingServiceIntent); super.onUpdate(context, appWidgetManager, appWidgetIds); } // To prevent any ANR timeouts, we perform the update in a service; // really should have its own thread too public static class UpdateService extends Service { static final String TAG = "UpdateService"; private LocationManager locationManager; private Location currentLocation; private double latitude; private double longitude; public void onStart(Intent intent, int startId) { // Get a LocationManager from the system services locationManager = (LocationManager) getSystemService(Context.LOCATION_SERVICE); // Register for updates from spoofed GPS locationManager.requestLocationUpdates("gps", 30000L, 0.0f, new LocationListener() { @Override public void onLocationChanged(Location location) { currentLocation = location; } @Override public void onProviderDisabled(String provider) {} @Override public void onProviderEnabled(String provider) {} @Override public void onStatusChanged(String provider, int status, Bundle extras) {} }); // Get the last known location from GPS currentLocation = locationManager.getLastKnownLocation("gps"); // Build the widget update RemoteViews updateViews = buildUpdate(this); // Push update for this widget to the home screen ComponentName thisWidget = new ComponentName(this, Widget.class); // AppWidgetManager updates AppWidget state; gets information about // installed AppWidget providers and other AppWidget related state AppWidgetManager manager = AppWidgetManager.getInstance(this); // Updates the views based on the RemoteView returned from the // buildUpdate method (stored in updateViews) manager.updateAppWidget(thisWidget, updateViews); } public RemoteViews buildUpdate(Context context) { latitude = currentLocation.getLatitude(); longitude = currentLocation.getLongitude(); RemoteViews updateViews = new RemoteViews(context.getPackageName(), R.layout.main); updateViews.setTextViewText(R.id.latitude_text, "" + latitude); updateViews.setTextViewText(R.id.longitude_text, "" + longitude); return updateViews; } @Override public IBinder onBind(Intent intent) { // We don't need to bind to this service return null; } } }

    Read the article

  • How do I get a Java to call data from the Internet? Where to even start??

    - by cdg
    Hello oh great wizards of all things android. I really need your help. Mostly because my little brain just doesn't know were to start. I am trying to pull data from the internet to make a widget for the home screen. I have the layout built: <?xml version="1.0" encoding="utf-8"?> <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/Layout" android:layout_width="fill_parent" android:layout_height="fill_parent" android:background="@drawable/widget_bg_normal" android:clipChildren="false" > <TextView android:id="@+id/text_view" android:layout_width="100px" android:layout_height="wrap_content" android:paddingTop="18px" android:layout_centerHorizontal="true" android:textSize="8px" android:text="158x154 Image downloaded from the internet goes here. Needs to be updated every evening at midnight or unless the button below is pressed. Now if I could only figure out exactly how to do this, life would be good." /> <Button android:id="@+id/new_button" android:layout_width="fill_parent" android:layout_height="wrap_content" android:text="Get New" android:layout_below="@+id/scroll_image" android:layout_centerHorizontal="true" android:padding="0px" android:textSize="10px" android:height="8px" android:includeFontPadding="false" /> </RelativeLayout> Got the provider xml bulit: <?xml version="1.0" encoding="utf-8"?> <appwidget-provider xmlns:android="http://schemas.android.com/apk/res/android" android:minWidth="150dip" android:minHeight="150dip" android:updatePeriodMillis="10000" android:initialLayout="@layout/widget" /> The Manifest works great. <?xml version="1.0" encoding="utf-8"?> <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.dge.myandroid" android:versionCode="1" android:versionName="1.0"> <application android:icon="@drawable/icon" android:label="@string/app_name"> <activity android:name=".myactivty" android:label="@string/app_name"> <intent-filter> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" /> </intent-filter> </activity> <!-- Widget --> <receiver android:name=".mywidget" android:label="@string/app_name" > <intent-filter> <action android:name="android.appwidget.action.APPWIDGET_UPDATE" /> </intent-filter> <meta-data android:name="android.appwidget.widgetprovider" android:resource="@xml/widgetprovider" /> </receiver> <!-- Widget End --> </application> <uses-permission android:name="android.permission.INTERNET" /> <uses-sdk android:minSdkVersion="7" /> </manifest> The data it is calling looks something like this when it is called. It basically goes to a website that uses php to random the image: <html><body bgcolor="#000000">center> <a href="http://www.website.com" target="_blank"> <img border="0" src="http://www.webiste.com//0.gif"></a> <img src="http://www.webiste.com" style="border:none;" /> </center></body></html> But here is were I am stuck. I just don't know where to start at all. The java is so far beyond my little head that I don't know what to do. package com.dge.myandroid; import android.appwidget.AppWidgetProvider; public class mywidget extends AppWidgetProvider { } The wiki example just confused me more. I just don't know where to begin. Please help.

    Read the article

  • App cannot start at all in Android 2.2 (Froyo)

    - by Roland Lim
    Dear fellow Android developers & Google Engineers, My app has been running okay until the recent Froyo update. After installing the Android 2.2 SDK, I can compile my code without any errors. However, when I run it, it just force closes: Here's the log: 05-23 10:15:13.463: DEBUG/AndroidRuntime(423): >>>>>>>>>>>>>> AndroidRuntime START <<<<<<<<<<<<<< 05-23 10:15:13.463: DEBUG/AndroidRuntime(423): CheckJNI is ON 05-23 10:15:14.193: DEBUG/AndroidRuntime(423): --- registering native functions --- 05-23 10:15:15.293: DEBUG/AndroidRuntime(423): Shutting down VM 05-23 10:15:15.303: DEBUG/dalvikvm(423): Debugger has detached; object registry had 1 entries 05-23 10:15:15.333: INFO/AndroidRuntime(423): NOTE: attach of thread 'Binder Thread #3' failed 05-23 10:15:16.003: DEBUG/AndroidRuntime(431): >>>>>>>>>>>>>> AndroidRuntime START <<<<<<<<<<<<<< 05-23 10:15:16.013: DEBUG/AndroidRuntime(431): CheckJNI is ON 05-23 10:15:16.273: DEBUG/AndroidRuntime(431): --- registering native functions --- 05-23 10:15:17.392: INFO/ActivityManager(59): Starting activity: Intent { act=android.intent.action.MAIN cat= [android.intent.category.LAUNCHER] flg=0x10000000 cmp=com.handyapps.easymoney/.EasyMoney } 05-23 10:15:17.602: DEBUG/AndroidRuntime(431): Shutting down VM 05-23 10:15:17.662: DEBUG/dalvikvm(431): Debugger has detached; object registry had 1 entries 05-23 10:15:17.742: INFO/AndroidRuntime(431): NOTE: attach of thread 'Binder Thread #3' failed 05-23 10:15:17.912: INFO/ActivityManager(59): Start proc com.handyapps.easymoney for activity com.handyapps.easymoney/.EasyMoney: pid=438 uid=10035 gids={1006, 1015} 05-23 10:15:19.032: DEBUG/AndroidRuntime(438): Shutting down VM 05-23 10:15:19.032: WARN/dalvikvm(438): threadid=1: thread exiting with uncaught exception (group=0x4001d800) 05-23 10:15:19.062: ERROR/AndroidRuntime(438): FATAL EXCEPTION: main 05-23 10:15:19.062: ERROR/AndroidRuntime(438): java.lang.RuntimeException: Unable to instantiate application com.handyapps.easymoney.EasyMoney: java.lang.ClassCastException: com.handyapps.easymoney.EasyMoney 05-23 10:15:19.062: ERROR/AndroidRuntime(438): at android.app.ActivityThread$PackageInfo.makeApplication (ActivityThread.java:649) 05-23 10:15:19.062: ERROR/AndroidRuntime(438): at android.app.ActivityThread.handleBindApplication (ActivityThread.java:4232) 05-23 10:15:19.062: ERROR/AndroidRuntime(438): at android.app.ActivityThread.access$3000(ActivityThread.java:125) 05-23 10:15:19.062: ERROR/AndroidRuntime(438): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2071) 05-23 10:15:19.062: ERROR/AndroidRuntime(438): at android.os.Handler.dispatchMessage(Handler.java:99) 05-23 10:15:19.062: ERROR/AndroidRuntime(438): at android.os.Looper.loop(Looper.java:123) 05-23 10:15:19.062: ERROR/AndroidRuntime(438): at android.app.ActivityThread.main(ActivityThread.java:4627) 05-23 10:15:19.062: ERROR/AndroidRuntime(438): at java.lang.reflect.Method.invokeNative(Native Method) 05-23 10:15:19.062: ERROR/AndroidRuntime(438): at java.lang.reflect.Method.invoke(Method.java:521) 05-23 10:15:19.062: ERROR/AndroidRuntime(438): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run (ZygoteInit.java:868) 05-23 10:15:19.062: ERROR/AndroidRuntime(438): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626) 05-23 10:15:19.062: ERROR/AndroidRuntime(438): at dalvik.system.NativeStart.main(Native Method) 05-23 10:15:19.062: ERROR/AndroidRuntime(438): Caused by: java.lang.ClassCastException: com.handyapps.easymoney.EasyMoney 05-23 10:15:19.062: ERROR/AndroidRuntime(438): at android.app.Instrumentation.newApplication(Instrumentation.java:957) 05-23 10:15:19.062: ERROR/AndroidRuntime(438): at android.app.Instrumentation.newApplication(Instrumentation.java:942) 05-23 10:15:19.062: ERROR/AndroidRuntime(438): at android.app.ActivityThread$PackageInfo.makeApplication (ActivityThread.java:644) 05-23 10:15:19.062: ERROR/AndroidRuntime(438): ... 11 more 05-23 10:15:19.082: WARN/ActivityManager(59): Force finishing activity com.handyapps.easymoney/.EasyMoney 05-23 10:15:19.592: WARN/ActivityManager(59): Activity pause timeout for HistoryRecord{450018f0 com.handyapps.easymoney/.EasyMoney} //////////////THE ANDROID MANIFEST FILE//// <uses-permission android:name="android.permission.READ_PHONE_STATE"/> <uses-permission android:name="android.permission.CAMERA"/> <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" /> <uses-feature android:name="android.hardware.camera" /> <uses-sdk android:minSdkVersion="3" android:targetSdkVersion="4" /> <application android:icon="@drawable/icon" android:name="@string/app_name" android:label="@string/app_name" android:debuggable="false"> <activity android:name=".EasyMoney" android:label="@string/app_name" android:theme="@android:style/Theme.NoTitleBar" android:launchMode="singleTask" android:clearTaskOnLaunch="true"> <intent-filter> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" /> </intent-filter> </activity> <activity android:name=".TranList" android:label="@string/app_name" android:theme="@android:style/Theme.Light.NoTitleBar"/> <activity android:name=".TranEdit" android:theme="@android:style/Theme.Light.NoTitleBar" android:windowSoftInputMode="stateAlwaysHidden"/> <activity android:name=".BillReminderEdit" android:theme="@android:style/Theme.Light.NoTitleBar" android:windowSoftInputMode="stateAlwaysHidden"/> <activity android:name=".BillReminderList" android:launchMode="singleTop" android:theme="@android:style/Theme.Light.NoTitleBar"/> <activity android:name=".BudgetList" android:theme="@android:style/Theme.Light.NoTitleBar"/> <activity android:name=".BudgetEdit" android:theme="@android:style/Theme.Light.NoTitleBar" android:windowSoftInputMode="stateAlwaysHidden"/> <activity android:name=".Search" android:theme="@style/CustomDialogTheme" android:windowSoftInputMode="stateAlwaysHidden"/> <activity android:name=".PasscodeEntry" android:theme="@style/CustomDialogTheme" android:windowSoftInputMode="stateAlwaysHidden" android:screenOrientation="portrait"/> <activity android:name=".AccountList" android:theme="@android:style/Theme.Light.NoTitleBar"> </activity> <activity android:name=".AccountEdit" android:theme="@android:style/Theme.Light.NoTitleBar" android:windowSoftInputMode="stateAlwaysHidden"/> <activity android:name=".UserSettingsEdit" android:theme="@android:style/Theme.Light.NoTitleBar" android:windowSoftInputMode="stateAlwaysHidden"/> <activity android:name=".CurrencySettingsEdit" android:theme="@android:style/Theme.Light.NoTitleBar" android:windowSoftInputMode="stateAlwaysHidden"/> <activity android:name=".DisplaySettingsEdit" android:theme="@android:style/Theme.Light.NoTitleBar" android:windowSoftInputMode="stateAlwaysHidden"/> <activity android:name=".BackupSettingsEdit" android:theme="@android:style/Theme.Light.NoTitleBar" android:windowSoftInputMode="stateAlwaysHidden"/> <activity android:name=".CategoryList" android:theme="@android:style/Theme.Light.NoTitleBar" /> <activity android:name=".CategoryEdit" android:theme="@android:style/Theme.Light.NoTitleBar" android:windowSoftInputMode="stateAlwaysHidden"/> <activity android:name=".ExpenseByCategory" android:theme="@android:style/Theme.Light.NoTitleBar"/> <activity android:name=".BalanceReport" android:theme="@android:style/Theme.Light.NoTitleBar"/> <activity android:name=".MonthlyExpenseReport" android:theme="@android:style/Theme.Light.NoTitleBar"/> <activity android:name=".MonthlyIncomeReport" android:theme="@android:style/Theme.Light.NoTitleBar"/> <activity android:name=".MonthlyCashflowReport" android:theme="@android:style/Theme.Light.NoTitleBar"/> <activity android:name=".PhotoList" android:theme="@android:style/Theme.Light.NoTitleBar" /> <activity android:name=".ExpenseByPayee" android:theme="@android:style/Theme.Light.NoTitleBar"/> <activity android:name=".ExpenseBySubCategory" android:theme="@android:style/Theme.Light.NoTitleBar"/> <service android:name="StartAlarm_Service"> <intent-filter> <action android:name="com.handyapps.easymoney.StartAlarm_Service" /> </intent-filter> </service> <service android:name=".AlarmService_Service" android:process=":remote" /> <receiver android:name="StartupIntentReceiver"> <intent-filter> <action android:name="android.intent.action.BOOT_COMPLETED" /> <category android:name="android.intent.category.HOME" /> </intent-filter> </receiver> <receiver android:name=".WidgetProvider" android:label="@string/widget_name"> <intent-filter> <action android:name="android.appwidget.action.APPWIDGET_UPDATE" /> </intent-filter> <meta-data android:name="android.appwidget.provider" android:resource="@xml/widget" /> </receiver> <receiver android:name=".WidgetProvider" android:label="@string/widget_name"> <intent-filter> <action android:name="android.appwidget.action.APPWIDGET_UPDATE" /> <data android:scheme="easymoney_widget" /> </intent-filter> <meta-data android:name="android.appwidget.provider" android:resource="@xml/widget" /> </receiver> <receiver android:name=".WidgetProvider"> <intent-filter> <action android:name="com.handyapps.easymoney.WIDGET_CONTROL" /> <data android:scheme="easymoney_widget" /> </intent-filter> </receiver> </application> The main startup class is com.handyapps.easymoney.EasyMoney. I placed a breakpoint at the start of the onCreate() method but I discovered it didn't even reach there. Somehow, the application just couldn't be loaded in Android 2.2... but it works perfectly fine for all the previous Android versions. Been trying to find the cause for the past 2 days but am totally stumped!! Any help will be greatly appreciated!!!! Thanks!! Roland

    Read the article

  • findViewById undefined

    - by areyling
    Eclipse is marking findViewById(int) as undefined; it was doing the same thing for getResources(), but I was able to get around that by calling context.getResources() instead (as seen below) and can't seem to find a similar workaround for findViewById. Here is the code: package com.myapp.android.MyWidget; import android.appwidget.AppWidgetProvider; import android.appwidget.AppWidgetManager; import android.content.Context; import android.content.ComponentName; import android.content.pm.PackageManager; import android.content.res.Resources; import android.util.Log; import android.view.View; import android.widget.RemoteViews; import android.widget.Button; import android.os.Bundle; public class MyWidget extends AppWidgetProvider { private static String[] states; @Override public void onEnabled(Context context) { final Button button = (Button) findViewById(R.id.widget_state_button); states = context.getResources().getStringArray(R.array.states); } Is there another package I need to import for findViewById? Thanks in advance.

    Read the article

  • Clickable widgets in android

    - by Leif Andersen
    The developer documentation has seemed to have failed me here. I can create a static widget without thinking, I can even create a widget like the analogue clock widget that will update itself, however, I can not for the life of me figure out how to create a widget that reacts to when a user clicks on it. Here is the best code sample that the developer documentation gives to what a widget activity should contain (the only other hint being the API demos, which only creates a static widget): public class ExampleAppWidgetProvider extends AppWidgetProvider { public void onUpdate(Context context, AppWidgetManager appWidgetManager, int[] appWidgetIds) { final int N = appWidgetIds.length; // Perform this loop procedure for each App Widget that belongs to this provider for (int i=0; i<N; i++) { int appWidgetId = appWidgetIds[i]; // Create an Intent to launch ExampleActivity Intent intent = new Intent(context, ExampleActivity.class); PendingIntent pendingIntent = PendingIntent.getActivity(context, 0, intent, 0); // Get the layout for the App Widget and attach an on-click listener to the button RemoteViews views = new RemoteViews(context.getPackageName(), R.layout.appwidget_provider_layout); views.setOnClickPendingIntent(R.id.button, pendingIntent); // Tell the AppWidgetManager to perform an update on the current App Widget appWidgetManager.updateAppWidget(appWidgetId, views); } } } from: The Android Developer Documentation's Widget Page So, it looks like pending intent is called when the widget is clicked, which is based off of an intent (I'm not quite sure what the difference between an intent and a pending intent is), and the intent is for the ExampleActivity class. So I made my sample activity class a simple activity that when created, would create a mediaplayer object, and start it (it wouldn't ever release the object, so it would eventually crash, here is it's code: @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); MediaPlayer mp = MediaPlayer.create(getApplicationContext(), R.raw.sound); mp.start(); } However, when I added the widget to the home screen, and clicked on it, nothing played, in fact, nothing played when I set the update timer to just a few hundred milliseconds (in the appwidget provider xml file). Furthermore, I set break points and found out that not only was it never reaching the activity, but no break points I set would ever get triggered. (I still haven't figured out why that is), however, logcat seemed to indicate that the activity class file was being run. So, is there anything I can do to get an appwidget to respond to a click? As the onClickPendingIntent() method is the closest I have found to a onClick type of method. Thank you very much.

    Read the article

1 2  | Next Page >