Resources error

sacad

Member
Licensed User
Longtime User
Can someone please help me? been struggling with this problem for a while now. I did the quick action bar and tried to implement it in my program but i get the following error. i did copy everything in my resources folder and made it read only but still getting this error when it tries to q.Initialize("AC",ac2.vertical)
 

Attachments

  • Quick action error.png
    Quick action error.png
    78.9 KB · Views: 401

sacad

Member
Licensed User
Longtime User
Hi Erel thank you for the help but it still does not work. If someone have time will you please look at it and tell me what I have done wrong?
Thank you so much! i cannot upload my zip since its too big.

this is the quick action 3d with the action bar that i want to integrate.
'Activity module
Sub Process_Globals
'These global variables will be declared once when the application starts.
'These variables can be accessed from all modules.

'Some constants
Dim ID_ACTION_HOME As Int : ID_ACTION_HOME = 0
Dim ID_ACTION_REFRESH As Int : ID_ACTION_REFRESH = 1
Dim ID_ACTION_STAR As Int : ID_ACTION_STAR = 2
Dim ID_ACTION_SHARE As Int : ID_ACTION_SHARE = 3
Dim ID_ACTION_OVERFLOW As Int : ID_ACTION_OVERFLOW = 99
End Sub

Sub Globals
'These global variables will be redeclared each time the activity is created.
'These variables can only be accessed from this module.

Dim ab As AHActionBar
Dim ListView1 As ListView

Dim homeIcon, overflowIcon, shareIcon, refreshIcon, starIcon As BitmapDrawable
Dim Timer1 As Timer

'Dim btActionBarShow As Button
'Dim btActionBarHide As Button
Dim pContent As ScrollView
'Dim btTitleHide As Button
'Dim btTitleShow As Button
'Dim btSubTitleHide As Button
'Dim btSubTitleShow As Button
'Dim btHomeHide As Button
'Dim btHomeShow As Button
'Dim btShowHomeAsNormal As Button
'Dim btShowHomeAsUp As Button
'Dim btProgressHide As Button
'Dim btProgressShow As Button
'Dim btActionAdd As Button
'Dim btActionRemove As Button
Dim spColor As Spinner
Dim ac2 As AHQuickAction3D
End Sub

Sub Activity_Create(FirstTime As Boolean)
'Load the layout of our activity.

Activity.LoadLayout("main")
pContent.Panel.LoadLayout("content")

'Load some icons to use as action items
homeIcon.Initialize(LoadBitmap(File.DirAssets, "ic_title_home_default.png"))
overflowIcon.Initialize(LoadBitmap(File.DirAssets, "ic_action_overflow.png"))
shareIcon.Initialize(LoadBitmap(File.DirAssets, "ic_action_share.png"))
refreshIcon.Initialize(LoadBitmap(File.DirAssets, "ic_action_refresh.png"))
starIcon.Initialize(LoadBitmap(File.DirAssets, "ic_action_star.png"))

'Initialize the activity and set our defined background.
ab.Initialize("AB")

'You can change the width of an action item. 42dip is default
ab.ActionWidth = 42dip


'Add a home action item
ab.addHomeAction(ID_ACTION_HOME, homeIcon)

'Add some action items
ab.addAction2(ID_ACTION_SHARE, shareIcon, "Share the content with your friends")
ab.addActionAt2(ID_ACTION_REFRESH, refreshIcon, 0, "Refresh the content of the app")
ab.addAction(ID_ACTION_OVERFLOW, overflowIcon)
Dim AA As GradientDrawable
AA.Initialize("TR_BL", Array As Int(Colors.LightGray, Colors.Black))
ab.Background= AA
'spColor_ItemClick(0, "Initialize")

'ab.TitleColor= Colors.Green

'Add the action bar to the activity.
Activity.AddView(ab, 0, 0, 100%x, 46dip)

'Enable/Disable buttons
' SetButtonState

spColor.Add("Blue")
spColor.Add("Green")
spColor.Add("Red")

Timer1.Initialize("Timer1", 2000)
ListView1.Initialize("ListView1")
Dim GD As GradientDrawable
GD.Initialize("TR_BL", Array As Int(Colors.LightGray, Colors.cyan))
Activity.Background = GD
ListView1.ScrollingBackgroundColor = Colors.Transparent
Dim Bitmap1 As Bitmap
Bitmap1.Initialize(File.DirAssets, "newmail.png")
Dim Bitmap2 As Bitmap
Bitmap2.Initialize(File.DirAssets, "signoff.jpg")
Dim Bitmap3 As Bitmap
Bitmap3.Initialize(File.DirAssets, "1337679750_inbox_blue.png")
Dim Bitmap4 As Bitmap
Bitmap4.Initialize(File.DirAssets, "1337681990_outbox_blue.png")
ListView1.SingleLineLayout.ItemHeight = 100dip
ListView1.SingleLineLayout.Label.TextSize = 20
ListView1.SingleLineLayout.Label.TextColor = Colors.Blue
ListView1.SingleLineLayout.Label.Gravity = Gravity.CENTER
ListView1.FastScrollEnabled = True
ListView1.AddTwoLinesAndBitmap("Issue Action request", "Create a new Action request.", Bitmap1)
ListView1.AddTwoLinesAndBitmap("Inbox", "see your new messages.", Bitmap3)
ListView1.AddTwoLinesAndBitmap("Sent items", "see your sent messages.", Bitmap4)
ListView1.AddTwoLinesAndBitmap("Sign Off/Reinstate", "sign off action request or do one over.", Bitmap2)
Activity.AddView(ListView1,0,150,150%x, 500dip)

ac2.Initialize("AC",ac2.vertical)
For i = 1 To 7
Dim ai As AHActionItem
Dim bd As BitmapDrawable
Dim Filename, Text As String

Select i
Case 1
Filename = "menu_up_arrow.png"
Text = "Prev"
Case 2
Filename = "menu_down_arrow.png"
Text = "Next"
Case 3
Filename = "menu_info.png"
Text = "Info"
Case 4
Filename = "menu_eraser.png"
Text = "Delete"
Case 5
Filename = "menu_search.png"
Text = "Search"
Case 6
Filename = "menu_cancel.png"
Text = "Cancel"
Case 7
Filename = "menu_ok.png"
Text = "Ok"
End Select

'Initialize a bitmap drawable and the action item
bd.Initialize(LoadBitmap(File.DirAssets, Filename))
ai.Initialize(i, Text, bd)
ai.Selected = True

'Make the Prev and Next items sticky so they will not close the popup
If i = 1 OR i = 2 Then ai.Sticky = True
ac2.addActionItem(ai)
Next

End Sub

Sub Activity_Resume

End Sub

Sub Activity_Pause (UserClosed As Boolean)

End Sub



Sub AB_ItemClicked(ItemID As Int,Position As Int)
'If the refresh action is pressed, show the progress indicator a few seconds.
Select ItemID
Case ID_ACTION_REFRESH
ab.ProgressBarVisible = True
ab.SetActionVisibility(ID_ACTION_REFRESH, False)
Timer1.Enabled = True
Case ID_ACTION_HOME
Msgbox("Home action pressed", "Item clicked")
Case ID_ACTION_SHARE
Msgbox("Share some content ...", "Item clicked")
Case ID_ACTION_STAR
Msgbox("Star action pressed", "Item clicked")
Case ID_ACTION_OVERFLOW
'Msgbox("Open a Menu here (Perhaps with AHQuickAction popups)", "Item clicked")
ac2.getActionItem(Position)

End Select
End Sub



Sub Timer1_Tick
ab.ProgressBarVisible = False
ab.SetActionVisibility(ID_ACTION_REFRESH, True)
Timer1.Enabled = False
End Sub
Sub spColor_ItemClick (Position As Int, Value As Object)
Dim c1, c2, c3 As Int

Select Position
Case 0
c1 = Colors.RGB(180, 0, 180)
c2 = Colors.RGB(100, 100, 220)
c3 = Colors.RGB(0, 0, 120)

End Select

'Gradient background for the action bar.
Dim background As GradientDrawable
Dim Clrs(2) As Int
Clrs(0) = c1
Clrs(1) = c2
background.Initialize("TOP_BOTTOM", Clrs)

'Background of an action item if it is pressed
Dim background_pressed As ColorDrawable
background_pressed.Initialize(c3, 0)

'Define a StateListDrawable that has the background for our action bar and
'a background if an action item is pressed.
Dim bd As StateListDrawable
bd.Initialize
bd.AddState(bd.State_Pressed, background_pressed)
bd.AddState(bd.State_Enabled, background)
bd.AddCatchAllState(background)


End Sub
Sub ListView1_ItemClick (Position As Int, Value As Object)
Activity.Title = Value
If Value = "Inbox" Then
Msgbox("inbox clicked","inbox")
End If
End Sub
Sub AC_Click (Position As Int, ActionItemID As Int)
Dim action As AHActionItem


ToastMessageShow(action.Title & " pressed", False)
End Sub

'Event Sub when popup window is just dismissed
Sub AC_Dismiss
ToastMessageShow("Dismissed", False)
End Sub
 
Upvote 0

barx

Well-Known Member
Licensed User
Longtime User
Did you add the 'res' folder to you project and make the files within it read only?

Sent from my HTC Desire Z
 
Upvote 0

eps

Expert
Licensed User
Longtime User
I would recommend stepping through the code, to see the statement that gives the error and also check the logs.
 
Upvote 0

sacad

Member
Licensed User
Longtime User
Resources error status

I did do breakpoints and debugged and got the same error. I also cleaned the project and complied and run but also didn't work. ive copied the res folder over and made sure its read only but still no success.
However i did manage to get another program working using the same principles and will experiment a bit with it. Thank for everyone help i am still a newbie in android coding and must say you guys rock.
 
Upvote 0

corwin42

Expert
Licensed User
Longtime User
ive copied the res folder over and made sure its read only but still no success.

Be sure to make all files under the res folder and all subfolders read only. Not the folder itself! The FILES must be read only.
 
Upvote 0
Top