runOnUiThread(new Runnable() {
@Override
public void run() {
Toast.makeText(PhotoListActivity.this, "ok", Toast.LENGTH_SHORT).show();
LogUtils.printDebug("123", "ok");
}
});
日志LogUtils.printDebug("123", "ok")
有效,但Toast
未显示。
答案 0 :(得分:1)
尝试将PhotoListActivity.this
更改为getAplicationContext()
答案 1 :(得分:0)
要么尝试这个..
PhotoListActivity.this.runOnUiThread(new Runnable() {
@Override
.....
});
或者在getAplicationContext()
PhotoListActivity.this
代替makeText()
答案 2 :(得分:0)
试试这个。唯一的问题是你给了Toast Short time
void PDFToImage(MemoryStream inputMS, int dpi)
{
GhostscriptRasterizer rasterizer = null;
GhostscriptVersionInfo version = new GhostscriptVersionInfo(
new Version(0, 0, 0), @"C:\PathToDll\gsdll32.dll",
string.Empty, GhostscriptLicense.GPL);
using (rasterizer = new GhostscriptRasterizer())
{
rasterizer.Open(inputMS, version, false);
for (int i = 1; i <= rasterizer.PageCount; i++)
{
using (MemoryStream ms = new MemoryStream())
{
DrawImage img = rasterizer.GetPage(dpi, dpi, i);
img.Save(ms, ImageFormat.Jpeg);
ms.Close();
AspImage newPage = new AspImage();
newPage.ImageUrl = "data:image/png;base64," + Convert.ToBase64String((byte[])ms.ToArray());
Document1Image.Controls.Add(newPage);
}
}
rasterizer.Close();
}
}