Go Back   Android Forums > Android Discussion > Android Applications
Android Applications All the information you could ever want about Android Applications. Learn about apps and get help with them... all here! New apps can be found and announced in the Applications Announcements forum linked below.
Gamers - Check out our new sister sites!
Nintendo Wii U!    |    OUYA - $99 Android System!

test: Reply
 
LinkBack Thread Tools
Old November 30th, 2012, 01:58 AM   #1 (permalink)
New Member
Thread Author (OP)
 
Join Date: Nov 2012
Posts: 1
 
Device(s):
Carrier: Not Provided

Thanks: 0
Thanked 0 Times in 0 Posts
Unhappy Image in android widget

I'm trying to make a widget which changes displayed image from sdcard in specific timeer. My onUpdate function looks like:
public void onUpdate(Context context, AppWidgetManager appWidgetManager, int[] appWidgetIds) { 
     RemoteViews remoteViews = new RemoteViews(context.getPackageName(), R.layout.main); 
     ComponentName thisWidget = new ComponentName(context, PhotoWidgetProvider.class); 
     boolean mExternalStorageWriteable = false; 
     String state = Environment.getExternalStorageState(); 
     if (Environment.MEDIA_MOUNTED.equals(state))
          mExternalStorageWriteable = true;  
     if(mExternalStorageWriteable) {
          BitmapFactory.Options options = new BitmapFactory.Options(); 
          options.inSampleSize = 2;
          //of course it's a sample filename 
          String fileName = Environment.getExternalStorageDirectory().getPath() + "/DCIM/100MEDIA/IMAG0159.jpg"; 
          Bitmap bitmap = BitmapFactory.decodeFile(fileName, options); 
          remoteViews.setImageViewBitmap(R.id.widget_imageview, bitmap);
          appWidgetManager.updateAppWidget(thisWidget, remoteViews);
     } 
}
But I can not see any photo on my widget. File of course exists.

lesio is offline  
Last edited by lesio; November 30th, 2012 at 02:06 AM.
Reply With Quote
Sponsors
Reply
Tags
android, image, widget


Go Back   Android Forums > Android Discussion > Android Applications
Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT -5. The time now is 09:53 PM.
Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2013, vBulletin Solutions, Inc.