喜?我Fragment
RecyclerView
Adapter
RecyclerView
setOnClickListener
我希望getSupportFragmentManager().add()
打开另一个片段,只有getSupportFragmentManager()
,但我无法拨打支持Constructor
。
这是我的适配器fragment1 f1;
public Adapters(Context context){
f1 = (fragment1)context; //here has error
}
:
onClickListener
这是我的fragment2 frg = new fragment2();
f1.getSupportFragmentManager.beginTransaction().add(R.id.idLayout, frg).commit();
:
Private Sub ExportToExcel(ByVal dtTemp As DataTable, ByVal filepath As String)
Dim strFileName As String = filepath
Dim _excel As New Excel.Application
Dim wBook As Excel.Workbook
Dim wSheet As Excel.Worksheet
Dim newCulture As System.Globalization.CultureInfo
Dim OldCulture As System.Globalization.CultureInfo
OldCulture = System.Threading.Thread.CurrentThread.CurrentCulture
newCulture = New System.Globalization.CultureInfo( _
_excel.LanguageSettings.LanguageID(Office.MsoAppLanguageID.msoLanguageIDUI))
System.Threading.Thread.CurrentThread.CurrentCulture = newCulture
wBook = _excel.Workbooks.Add()
wSheet = wBook.ActiveSheet()
Dim dt As System.Data.DataTable = dtTemp
Dim dc As System.Data.DataColumn
Dim dr As System.Data.DataRow
Dim colIndex As Integer = 0
Dim rowIndex As Integer = 0
For Each dc In dt.Columns
colIndex = colIndex + 1
wSheet.Cells(1, colIndex) = dc.ColumnName
Next
For Each dr In dt.Rows
rowIndex = rowIndex + 1
colIndex = 0
For Each dc In dt.Columns
colIndex = colIndex + 1
wSheet.Cells(rowIndex + 1, colIndex) = dr(dc.ColumnName)
Next
Next
wSheet.Columns.AutoFit()
wBook.SaveAs(strFileName)
_excel.Visible = True
End Sub
如何getSupportFragmentManager?
答案 0 :(得分:0)
我已经解决了我的问题,从Object
创建了新的fragment1
并将其用于getSupportFragmentManager
。