asked    Walter     2018-10-22       android       37 view        1 Answer

[SOLVED] Array of Bitmap from array in xml file

I have in my array.xml an array of more than 100 images with all different name.

<array name="icons">
        <item>@drawable/setting</item>
        <item>@drawable/simplemode</item>
...

I need to load all them inside an array of Bitmap How can I do? Thanks

  1 Answer  

        answered    Leo     2018-10-22      

Resources arrays that contains references to Drawables are called TypedArray in Android.

You can refer to them very easily. Here's an example:

TypedArray icons = getResources().obtainTypedArray(R.array.icons);

Not, icons can retrieve the drawables for you. You can find the reference here:

For example, you could know how many drawables are references in that array with:

icons.length()

or you can get the drawable at the first position with:

icons.getDrawable(0);




Your Answer





 2018-10-22         Eve

VBA: Use of "On Error" when calling a sub in another workbook,

I am building a process capable of sequentially launching and running subroutines in other multiple Excel workbooks. This is controlled by a 'master' batch launcher. If there is any error in any one of these spreadsheets being run, the launcher needs to quit the run of that workbook and move onto the next workbook in the batch. This process must be continuous without user input, so any error dialogue boxes need to be suppressed.Simplified to its core essence, my code is as such:For I = 1 To NumberOfSubsToRun On Error GoTo ErrorHandler Application.Run (SpreadsheetName ...
 excel                     1 answers                     14 view
 2018-10-22         Bertram

Quotes in CSV created by VBA

in the xlsb file, in cell A1 I have names of columns separated with commas and in B2 there are comma separated values.When I save the file using macro and then open it with notepad, there are two rows of text with quotes on the beggining and end of each line.When I save the file manually, the same file opened with Notepad has no quotes.Unfortunately the quotes generate a conflict with a system I try to import the csv to.The VBA code I use to save the file is simpleActiveWorkbook.SaveAs path & "\Import DS", FileFormat:=xlCSVUTF8I will be gratefull for a tip on how to sav...
 vba                     1 answers                     12 view
 2018-10-22         Matthew

Push notifications and token device in Swift

I am working on an App that need to know the device token to send notification to the users when they give their authorization.The first time the system ask the authorization for notification. If user say "allow" the system calls for me the method didRegisterForRemoteNotificationsWithDeviceToken and in the body of this method I write in UserDefaults the device token.This is the flow:1) System ask for permission2) in didFinishLaunchingWithOptions (inside AppDelegate) I call this method in my class that manage the Notification Framework: func registerForPushNotifications() ...
 ios                     1 answers                     16 view