我从chanel读取文件,代码工作正常,但在app中添加了更多功能后
05-11 09:23:53.339: E/ThrottleService(300): problem during onPollAlarm: java.lang.IllegalStateException: problem parsing stats: java.io.FileNotFoundException: /proc/net/xt_qtaguid/iface_stat_all: open failed: ENOENT (No such file or directory)
05-11 09:24:05.699: D/dalvikvm(300): GC_CONCURRENT freed 584K, 63% free 4903K/13000K, paused 99ms+56ms, total 569ms
我已经搜索了这个问题,但没有足够的信息来解决这个问题。我在以下代码中遇到此问题。我在asyntask中运行此代码
public class screencahnge extends AsyncTask < String, Bitmap, Bitmap > {
ImageView im2 = null;
Bitmap b = null;
int ch = 0;
boolean flag = true;
public screencahnge(ImageView im) {
im2 = im;
}
@Override
protected Bitmap doInBackground(String...arg0) {
// TODO Auto-generated method stub'
// Runtime.getRuntime().availableProcessors();
if (RemoteScreen.out == null) {
System.out.print("Its null dude");
}
try {
RemoteScreen.out.write(210);
//Home.threadloop = false;
b = fileReceived(RemoteScreen. in );
publishProgress(b);
b = null;
ch = 4646;
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
return null;
}
@Override
protected void onProgressUpdate(Bitmap...images) {
if (images[0] != null)
im2.setImageBitmap(images[0]);
images = null;
b.recycle();
doInBackground("");
System.gc();
}
protected void onPostExecute(Void unused) {
b.recycle();
}
public Bitmap fileReceived(InputStream is)
throws FileNotFoundException, IOException {
Bitmap bitmap = null;
String baseDir = Environment.getExternalStorageDirectory().getAbsolutePath();
String fileName = "a.png";
String imageInSD = baseDir + File.separator + fileName;
System.out.println(imageInSD);
if (is != null) {
FileOutputStream fos = null;
BufferedOutputStream bos = null;
try {
// Log.i("IMSERVICE", "FILERECCC-1");
//ContextWrapper context = null;
fos = new FileOutputStream(imageInSD);
bos = new BufferedOutputStream(fos);
byte[] aByte = new byte[1024];
int bytesRead;
while ((bytesRead = is.read(aByte)) > 0) {
if (bytesRead == 1)
break;
bos.write(aByte, 0, bytesRead);
System.out.println("Loop" + aByte);
}
bos.close();
System.out.println("Loop out");
java.io.FileInputStream in = new FileInputStream(imageInSD);
bitmap = BitmapFactory.decodeStream( in );
bitmap = BitmapFactory.decodeFile(imageInSD);
Log.i("IMSERVICE", "saved");
if (bitmap != null)
System.out.println(bitmap.toString());
} catch (IOException ex) {
// Do exception handling
// Log.i("IMSERVICE", "exception ");
}
}
return bitmap;
}
}
此代码从通道读取图像并设置为imageview,此代码以前对我来说很好,但现在我在这个应用程序中使用此代码有这个问题。我尝试了很多解决方案。我在该模拟器上创建了新的模拟器并进行测试。我检查了所有必需的权限。我添加了互联网权限,网络状态权限等。
提前致谢