我想發送圖像到服務類的位圖,我想使用位圖有設置壁紙 我使用的代碼....如何發送位圖[]到服務類?
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
if (resultCode == RESULT_OK) {
if (requestCode == PICK_IMAGE_MULTIPLE) {
imagesPathList = new ArrayList<String>();
String[] imagesPath = data.getStringExtra("data").split("\\|");
try {
lnrImages.removeAllViews();
} catch (Throwable e) {
e.printStackTrace();
}
for (int i = 0; i < imagesPath.length; i++) {
imagesPathList.add(imagesPath[i]);
yourbitmap = BitmapFactory.decodeFile(imagesPath[i]);
resized[i] = Bitmap.createScaledBitmap(yourbitmap, 480,
800, true);
ImageView imageView = new ImageView(this);
imageView.setImageBitmap(resized[i]);
imageView.setAdjustViewBounds(true);
lnrImages.addView(imageView);
}
}
}
}
case R.id.btnsetwall:
Intent i = new Intent(MainActivity.this, WallService.class);
Log.i("Main Activity", "Before putExtra");
i.putExtra("Imagess", resized);
Log.i("Main Activity", "After putExtra");
startService(i);
Log.i("Main Activity", "Start Service");
break;
//如果我使用我。 putExtra(「Imagess」,調整大小);它提供了錯誤,如果我不使用該行的服務得到啓動
在服務類...
@Override
public void onCreate() {
// TODO Auto-generated method stub
super.onCreate();
Log.i("on create", "Service Created");
}
的logcat的是...
05-06 15:53:57.932: I/Main Activity(14185): Before putExtra
05-06 15:53:57.932: I/Main Activity(14185): After putExtra
05-06 15:53:57.942: E/JavaBinder(14185): !!! FAILED BINDER TRANSACTION !!!
05-06 15:53:57.952: I/Main Activity(14185): Start Service
,你初始化調整[I]? – duggu
public class MainActivity extends Activity實現View.OnClickListener私有位圖resized [] = new Bitmap [10]; –
resized [] = new Bitmap [imagesPath.length]; for(int i = 0; i
duggu