Android Question I can't load an image field been borrowed from another table having the same ID code

Enthousiastic

Active Member
Licensed User
Hello ,

I have a database with two tables the MyAmagrams table and MyAmPersons table.

MyAmagrams has the following composition :

AmID as integer , AmPCode as integer , Page as integer and the fields AmAch,Title,Category,Speaker,Origin,SuccLevel,SuccMY,PhotoYN,Tefxos,PinPhoto,PdfFile,Exofyllo as char.

MyAmPersons has the following composition :

AmPID , AmPCode as integer and GroupOccup , AmPerson , PhotoYesNo , AmPersonPhoto as Char.

All I want is in an activity that shows me from MyAmagrams table the records one by one , to display the image from MyAmPersonPhoto table that has the same AmPCode with MyAmagrams Table

So I wrote the following code but has errors in FindImage3 in Sub LoadRecords.
( Please understand , i wrote those lines becaude the file extends the limit so i can'n sent you )



#Region Module Attributes

#FullScreen: False

#IncludeTitle: True

#End Region


#Region Module Attributes

#FullScreen: False

#IncludeTitle: True

#End Region


'Activity module

Sub Process_Globals

'These global variables will be declared once when the application starts.

'These variables can be accessed from all modules.



Dim SelectedRow AsInt


EndSub


Sub Globals

'These global variables will be redeclared each time the activity is created.

'These variables can only be accessed from this module.





Dim scvTest AsScrollView

Dim pnlTest,pnlbuttons AsPanel

Dim btnFirst,btnNext,btnPrev,btnLast,btnExit AsButton

'Dim lstTable As List

Dim ImageView1,ImageView2 AsImageView

Dim path1,path2,path3,path4 ,file1 AsString

Dim col, crow,row, RTID ,RecNum AsInt

Dim RecIndex, RecIndex1 AsInt

Dim Curs AsCursor

Dim b1,b2 ,b3 AsBitmap


Dim rsie AsRSImageEffects


Dim rsip AsRSImageProcessing



' Dim lblAmPId As Label

' Dim lblAmPId2 As Label

Dim lblAmAch AsLabel

Dim lblAmAch2 AsLabel

Dim lblAmMY AsLabel

Dim lblAmMY2 AsLabel

Dim lblPage AsLabel

Dim lblPage2 AsLabel

Dim lblTitle AsLabel

Dim lblTitle2 AsLabel

Dim lblCategory AsLabel

Dim lblCategory2 AsLabel

Dim lblSpeaker AsLabel

Dim lblSpeaker2 AsLabel

Dim lblOrigin AsLabel

Dim lblOrigin2 AsLabel

Dim lblSuccLevel AsLabel

Dim lblSuccLevel2 AsLabel

Dim lblSuccMY AsLabel

Dim lblSuccMY2 AsLabel

Dim lblExofyllo AsLabel

Dim lblExofyllo2 AsLabel

Dim lblPhotoYN AsLabel

Dim lblPhotoYN2 AsLabel

Dim lblTefxos AsLabel

Dim lblTefxos2 AsLabel

Dim lblPinPhoto , lblPinPhoto2 AsLabel

Dim lblPdfFile AsLabel

Dim lblPdfFile2 AsLabel

Dim btnPdf AsButton

Private lblAmPCode AsLabel

Private lblAmPCode2 AsLabel

Private lblAmID AsLabel

Private lblAmID2 AsLabel



' for ImageView3

Private ImageView3 AsImageView

Dim FindImage3 AsString

Dim QlImageView3 AsString

EndSub


Sub Activity_Create(FirstTime AsBoolean)

'Do not forget to load the layout file created with the visual designer. For example:

'Activity.LoadLayout("Layout1")



' Dim Query As String

Activity.LoadLayout("MyAmsOnebyone")

scvTest.Panel.LoadLayout("MyAmsOnebyOne scroll")



pnlbuttons.Top = 100%y - pnlbuttons.Height

scvTest.Panel.Height = pnlTest.Height



RecIndex1 = RecIndex + 1

RecNum=Main.SQL1.ExecQuerySingleResult("SELECT count(*) FROM " & Main.DBTableName6)

Activity.Title= "RECORDS.: " & RecIndex1 & " FROM : " & RecNum

row=0

pnlbuttons.Visible = True



FillTable

RecIndex=0







LoadRecords




EndSub


Sub Activity_Resume


EndSub


Sub Activity_Pause (UserClosed AsBoolean)


EndSub


Sub LoadRecords


' Dim t As Long

Curs.Position =RecIndex



lblAmID2.Text = Curs.GetString2(0)

lblAmPCode2.Text = Curs.GetString2(1)

lblAmAch2.Text = Curs.GetString2(2)

lblAmMY2.Text = Curs.GetString2(3)

lblPage2.Text = Curs.GetString2(4)

lblTitle2.Text = Curs.GetString2(5)

lblCategory2.Text = Curs.GetString2(6)

lblSpeaker2.Text = Curs.GetString2(7)

lblOrigin2.Text = Curs.GetString2(8)

lblSuccLevel2.Text = Curs.GetString2(9)

lblSuccMY2.Text = Curs.GetString2(10)

lblPhotoYN2.Text = Curs.GetString2(11)

lblTefxos2.Text = Curs.GetString2(12)

lblPinPhoto2.Text = Curs.GetString2(13)

lblPdfFile2.Text = Curs.GetString2(14)

lblExofyllo2.Text = Curs.GetString2(15)





RecIndex1 = RecIndex + 1

Activity.Title= "RECORDS : " & RecIndex1 & " FROM : " & RecNum



' ImageFolder=File.DirRootExternal

path1="mnt/extSdCard/Epix/AmExof/"

path2="mnt/extSdCard/Epix/PinLevels/"



' ImageView1.Bitmap=LoadBitmapSample(ImageFolder, lblPhoto2.Text, 160dip, 160dip)


b1=LoadBitmap(path1,lblExofyllo2.Text)

' b=LoadBitmapSample(path1,lblExofyllo2.Text,400dip,400dip)



b1=rsip.createScaledBitmap(b1,400dip, 400dip,False)

ImageView1.Bitmap=rsie.RoundCorner(b1,10)



b2=LoadBitmap(path2,lblPinPhoto2.Text)

' b=LoadBitmapSample(path1,lblExofyllo2.Text,400dip,400dip)



b2=rsip.createScaledBitmap(b2,400dip, 400dip,False)

ImageView2.Bitmap=rsie.RoundCorner(b2,10)



path3="mnt/extSdCard/Epix/AmPersons/"





FindImage3="SELECT AmPersonPhoto FROM " & Main.DBTableName5 & " WHERE AmPCode = " & lblAmPCode2.Text



Curs = Main.SQL1.ExecQuery(FindImage3)

Log(" Image3 is = " & Curs.GetString("AmPersonPhoto") )






QlImageView3=Curs.GetString2("AmPersonPhoto")





b3=LoadBitmap(path4,QlImageView3)

' b=LoadBitmapSample(path1,lblExofyllo2.Text,400dip,400dip)



b3=rsip.createScaledBitmap(b3,400dip, 400dip,False)

ImageView3.Bitmap=rsie.RoundCorner(b3,10)



EndSub





Sub FillTable




Curs = Main.SQL1.ExecQuery("SELECT * FROM " & Main.DBTableName6)



EndSub




Sub edtItem_FocusChanged (HasFocus AsBoolean)

Dim Send AsEditText



If HasFocus Then

Send = Sender



scvTest.ScrollPosition = Send.Top - 10dip

EndIf





EndSub



Sub btnFirst_Click

RecIndex=0

Msgbox("THIS IS THE 1st RECORD", "ATTENTION !")

' Activity.RemoveAllViews

LoadRecords

EndSub



Sub btnPrev_Click


RecIndex = Max(RecIndex - 1, 0)



LoadRecords


EndSub



Sub btnNext_Click


RecIndex = Min(RecIndex + 1, Curs.RowCount - 1)


LoadRecords

EndSub



Sub btnLast_click


RecIndex = Curs.RowCount - 1

Msgbox("THIS IS THE LAST RECORD", "ATTENTION !")



LoadRecords

EndSub




Sub btnPdf_click


Dim PdfFileName AsString


Dim MyPath AsString="file:///mnt/extSdCard/Epix/Amagr/"


PdfFileName=lblPdfFile2.Text


Dim MyFile AsString=MyPath & PdfFileName



Dim PdfIntent AsIntent


PdfIntent.Initialize(PdfIntent.ACTION_VIEW,MyFile)

PdfIntent.SetComponent("android/com.android.internal.app.ResolverActivity")

PdfIntent.SetType("application/pdf")


StartActivity(PdfIntent)



EndSub






Sub btnExit_Click

Activity.Finish

Activity.RemoveAllViews

StartActivity(Amagrmenu)

EndSub



Can youtell me where is the error ?
Many thanks Enthousiastic
 

Enthousiastic

Active Member
Licensed User
I am very shorry , forgive me ! Can you please tell me how to post the code ? In the forum i shaw there is a button on toolbar like #. but can you tell me more details , because i can;t find it.

THANKS AND SORRY AGAIN !
 
Top