- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
你好,我在文件中添加了一个位图来解析平台,但在开始时遇到了一些问题,它工作正常,但在第二次或第三次尝试后,我搞砸了。我想这是因为 put 方法不接收位图。但我不知道为什么它一开始有效,然后就停止了。
这是我的代码...
package com.example.mac.mycarapp.UI;
import android.support.v7.app.ActionBar;
import android.app.Activity;
import android.app.AlertDialog;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.graphics.drawable.BitmapDrawable;
import android.net.Uri;
import android.os.Build;
import android.os.Bundle;
import android.os.Environment;
import android.provider.MediaStore;
import android.support.annotation.Nullable;
import android.support.v4.content.FileProvider;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.DividerItemDecoration;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.support.v7.widget.SearchView;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.MenuItem;
import android.view.View;
import android.widget.AdapterView;
import android.widget.ArrayAdapter;
import android.widget.Button;
import android.widget.EditText;
import android.widget.ImageView;
import android.widget.ScrollView;
import android.widget.Spinner;
import android.widget.TextView;
import android.widget.Toast;
import android.support.v7.widget.Toolbar;
import com.example.mac.mycarapp.Adapter.DatosCompletosOtroAdapterSearch;
import com.example.mac.mycarapp.Adapter.RecyclerTouchListener;
import com.example.mac.mycarapp.LoginActivity;
import com.example.mac.mycarapp.Modelos.Ciudad;
import com.example.mac.mycarapp.R;
import com.example.mac.mycarapp.Util.Config;
import com.example.mac.mycarapp.Util.MarshMallowPermission;
import com.parse.FindCallback;
import com.parse.GetCallback;
import com.parse.GetDataCallback;
import com.parse.ParseException;
import com.parse.ParseFile;
import com.parse.ParseObject;
import com.parse.ParseQuery;
import com.parse.ParseUser;
import com.parse.SaveCallback;
import java.io.ByteArrayOutputStream;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStream;
import java.util.ArrayList;
import java.util.List;
import butterknife.BindView;
import butterknife.ButterKnife;
import de.hdodenhof.circleimageview.CircleImageView;
public class DatosCompletosClienteOtro extends AppCompatActivity implements AdapterView.OnItemSelectedListener {
@BindView(R.id.imagen_por_tipo_de_empresa)
ImageView imagenPorTipoDeEmpresa;
@BindView(R.id.circleImageView3)
CircleImageView circleImageView3;
@BindView(R.id.inscripcion_nombre_cliente_otro)
EditText inscripcionNombreClienteOtro;
@BindView(R.id.inscripcion_cedula_cliente_otro)
EditText inscripcionCedulaClienteOtro;
@BindView(R.id.inscripcion_correo_cliente_otro)
EditText inscripcionCorreoClienteOtro;
@BindView(R.id.inscripcion_telefono_cliente_otro)
EditText inscripcionTelefonoClienteOtro;
@BindView(R.id.inscripcion_direccion_cliente_otro)
EditText inscripcionDireccionClienteOtro;
@BindView(R.id.inscripcion_ciudad_cliente_otro)
Spinner inscripcionCiudadClienteOtro;
@BindView(R.id.boton_seleccion_automotriz_otro)
Button botonSeleccionAutomotriz;
@BindView(R.id.boton_seleccion_inmobiliaria_otro)
Button botonSeleccionInmobiliaria;
@BindView(R.id.datos_completos_usuario_seleccion_empresa)
TextView datosCompletosUsuarioSeleccionEmpresa;
@BindView(R.id.datos_completos_buscar_empresa_por_sector)
SearchView datosCompletosBuscarEmpresaPorSector;
@BindView(R.id.recyclerview_relacion_escoge_empresa)
RecyclerView recyclerviewRelacionEscogeEmpresa;
@BindView(R.id.scrollView2)
ScrollView scrollView2;
ParseUser user;
@BindView(R.id.boton_guardar_usuario_otro)
Button botonGuardarUsuarioOtro;
private ArrayList<String> listCiudad;
private List<Ciudad> ciudadList;
private Ciudad ciudadSelect;
String stringTipoDeEmpresa;
private ArrayList<ParseObject> listaEmpresa;
DatosCompletosOtroAdapterSearch adapter;
Context context = DatosCompletosClienteOtro.this;
AlertDialog pd;
String empresaObjectId;
String tipoDeEmpAuto = "Automotriz";
String tipoDeEmpInmo = "Inmobiliaria";
Uri imageUrl;
int CAMERA = 0;
int GALLERY = 1;
private MarshMallowPermission mmp;
String ciudadId;
String referentCiudad="null";
String spinnerValue;
public static final int REQUEST_IMAGE=100;
public static final int REQUEST_GALLERY=101;
Bitmap bitmap;
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.datos_completos_usuario_inmobiliaria);
ButterKnife.bind(this);
ActionBar actionBar = getSupportActionBar();
actionBar.setDisplayHomeAsUpEnabled(true);
mmp = new MarshMallowPermission(this);
listCiudad = new ArrayList<String>();
ciudadList = new ArrayList<Ciudad>();
listaEmpresa = new ArrayList<ParseObject>();
AlertDialog.Builder db = new AlertDialog.Builder(this);
LayoutInflater inflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
View dialogView = inflater.inflate(R.layout.alert_inicial_uno, null);
db.setView(dialogView);
db.setCancelable(true);
db.setPositiveButton("Siguiente", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
pd.dismiss();
}
});
pd = db.create();
pd.show();
showUserDetailsIfInDatabase();
user = ParseUser.getCurrentUser();
//Todo:LLenar spinner con ciudades
inscripcionCiudadClienteOtro.setOnItemSelectedListener(this);
datosCompletosBuscarEmpresaPorSector.setOnQueryTextListener(new SearchView.OnQueryTextListener() {
@Override
public boolean onQueryTextSubmit(String s) {
return false;
}
@Override
public boolean onQueryTextChange(String s) {
adapter.getFilter().filter(s);
return true;
}
});
circleImageView3.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
openOptionPhotografy();
}
});
recyclerviewRelacionEscogeEmpresa.addOnItemTouchListener(new RecyclerTouchListener(getApplicationContext(), recyclerviewRelacionEscogeEmpresa, new RecyclerTouchListener.ClickListener() {
@Override
public void onClick(View view, int position) {
ParseObject item = listaEmpresa.get(position);
String empresaSeleccion = item.getString("Nombre");
empresaObjectId = item.getObjectId();
user = ParseUser.getCurrentUser();
user.put("Empresa", ParseObject.createWithoutData("Empresa", empresaObjectId));
}
@Override
public void onLongClick(View view, int position) {
}
}));
botonSeleccionAutomotriz.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
datosCompletosUsuarioSeleccionEmpresa.setText("");
datosCompletosUsuarioSeleccionEmpresa.setText(tipoDeEmpAuto);
// ParseQuery<ParseObject> query = ParseQuery.getQuery("Empresa");
//
// // Retrieve the object by id
// query.getInBackground(empresaObjectId, new GetCallback<ParseObject>() {
// public void done(ParseObject entity, ParseException e) {
// if (e == null) {
// // Update the fields we want to
// entity.put("tipoDeEmpresa", tipoDeEmpAuto);
// }
// }
// });
stringTipoDeEmpresa = datosCompletosUsuarioSeleccionEmpresa.getText().toString().trim();
queryListadoDeEmpresas(stringTipoDeEmpresa);
}
});
botonSeleccionInmobiliaria.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
datosCompletosUsuarioSeleccionEmpresa.setText("");
datosCompletosUsuarioSeleccionEmpresa.setText(tipoDeEmpInmo);
// ParseQuery<ParseObject> query = ParseQuery.getQuery("Empresa");
//
// // Retrieve the object by id
// query.getInBackground(empresaObjectId, new GetCallback<ParseObject>() {
// public void done(ParseObject entity, ParseException e) {
// if (e == null) {
// // Update the fields we want to
// entity.put("tipoDeEmpresa", tipoDeEmpInmo);
// }
// }
// });
stringTipoDeEmpresa = datosCompletosUsuarioSeleccionEmpresa.getText().toString().trim();
queryListadoDeEmpresas(stringTipoDeEmpresa);
}
});
botonGuardarUsuarioOtro.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
updateProfileUser();
Intent intent=new Intent(DatosCompletosClienteOtro.this,MainActivity.class);
startActivity(intent);
}
});
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
Intent myIntent = new Intent(getApplicationContext(), LoginActivity.class);
startActivityForResult(myIntent,0);
return true;
}
private void lleneCiudadCliente(final String parameter) {
ParseQuery<ParseObject> parseQuery = ParseQuery.getQuery("Ciudad");
parseQuery.findInBackground(new FindCallback<ParseObject>() {
@Override
public void done(List<ParseObject> objects, ParseException e) {
for (ParseObject ciudades : objects) {
Ciudad ciudad = new Ciudad(ciudades.getObjectId(), ciudades.getString("Ciudad"));
ciudadList.add(ciudad);
listCiudad.add(ciudades.getString("Nombre"));
}
ArrayAdapter<String> adapter = new ArrayAdapter<String>(DatosCompletosClienteOtro.this,
android.R.layout.simple_spinner_dropdown_item, listCiudad);
inscripcionCiudadClienteOtro.setAdapter(adapter);
if (!parameter.equals("null")) {
int selectionPosition = adapter.getPosition(parameter);
inscripcionCiudadClienteOtro.setSelection(selectionPosition);
}
}
});
}
@Override
public void onItemSelected(AdapterView<?> adapterView, View view, int position, long id) {
spinnerValue= adapterView.getItemAtPosition(position).toString();
String idValue= String.valueOf(adapterView.getSelectedItemId());
String item= listCiudad.get(position);
ciudadSelect = ciudadList.get(position);
ciudadId=ciudadSelect.getId();
// switch (adapterView.getId()) {
// case R.id.inscripcion_ciudad_cliente:
// ciudadSelect = ciudadList.get(position);
// ciudadId=ciudadSelect.getId();
// break;
//
// }
}
@Override
public void onNothingSelected(AdapterView<?> parent) {
}
private void showUserDetailsIfInDatabase() {
ParseUser parseUser = ParseUser.getCurrentUser();
if (parseUser != null) {
if (parseUser.getString("Nombre") != null) {
inscripcionNombreClienteOtro.setText(parseUser.getString("Nombre"));
Log.i("nombre:", parseUser.getString("Nombre"));
}
if(parseUser.getString("Cedula") != null) {
inscripcionCedulaClienteOtro.setText(parseUser.getString("Cedula"));
}
if(parseUser.getEmail()!=null) {
inscripcionCorreoClienteOtro.setText(parseUser.getEmail());
}
if(parseUser.getNumber("Telefono")!=null) {
inscripcionTelefonoClienteOtro.setText(parseUser.getInt("Telefono") + "");
}
if(parseUser.getString("Direccion")!=null) {
inscripcionDireccionClienteOtro.setText(parseUser.getString("Direccion"));
}
ParseQuery<ParseUser> query = ParseUser.getQuery();
query.whereEqualTo("objectId", ParseUser.getCurrentUser().getObjectId());
query.setCachePolicy(ParseQuery.CachePolicy.NETWORK_ELSE_CACHE);
query.include("Ciudad");
query.include("Marca");
query.findInBackground(new FindCallback<ParseUser>() {
public void done(final List<ParseUser> objects, ParseException e) {
if (e == null) {
Log.d("Resultados ", "" + objects.size());
for (ParseObject pointer : objects) {
ParseObject ciudades = pointer.getParseObject("Ciudad");
if (ciudades != null) {
lleneCiudadCliente(ciudades.getString("Nombre"));
} else {
lleneCiudadCliente("null");
}
}
}
}
});
ParseFile parseFile = parseUser.getParseFile("Avatar");
if (parseFile != null) {
parseFile.getDataInBackground(new GetDataCallback() {
@Override
public void done(byte[] data, ParseException e) {
if (e == null) {
Bitmap bmp = BitmapFactory.decodeByteArray(data, 0, data.length);
if (bmp != null) {
circleImageView3.setImageBitmap(bitmap);
}
}
}
});
}
}
}
private void updateProfileUser() {
if (datosCompletosUsuarioSeleccionEmpresa.getText().toString().matches("")
) {
Config.simpleAlert("Porfavor seleccione un tipo de empresa", this);
}
if (inscripcionNombreClienteOtro.getText().toString().matches("") ||
inscripcionCedulaClienteOtro.getText().toString().matches("") ||
inscripcionTelefonoClienteOtro.getText().toString().matches("") ||
inscripcionDireccionClienteOtro.getText().toString().matches("")
) {
Config.simpleAlert("Debe ingresar sus datos de perfil", this);
} else {
Config.showDP("Guardando registros...", this);
ParseUser currUser = ParseUser.getCurrentUser();
currUser.put("Nombre", inscripcionNombreClienteOtro.getText().toString().trim());
currUser.put("Cedula", inscripcionCedulaClienteOtro.getText().toString().trim());
currUser.put("email", inscripcionCorreoClienteOtro.getText().toString().trim());
currUser.put("Telefono", Integer.parseInt(inscripcionTelefonoClienteOtro.getText().toString().trim()));
currUser.put("Direccion", inscripcionDireccionClienteOtro.getText().toString().trim());
currUser.put("Ciudad", ParseObject.createWithoutData("Ciudad", ciudadId));
currUser.saveInBackground();
// Bitmap bitmap = ((BitmapDrawable) circleImageView3.getDrawable()).getBitmap();
// Bitmap bm = Config.scaleBitmapToMaxSize(240, bitmap);
// ByteArrayOutputStream stream = new ByteArrayOutputStream();
// bm.compress(Bitmap.CompressFormat.JPEG, 100, stream);
// byte[] bytesArray = stream.toByteArray();
// ParseFile imageFile = new ParseFile("image.jpg", bytesArray);
// currUser.put("Avatar", imageFile);
// currUser.saveInBackground();
// currUser.saveInBackground(new SaveCallback() {
// @Override
// public void done(ParseException e) {
//
// if (e == null) {
//
// Config.hidePD();
// Config.simpleAlert("Datos guardados correctamente", DatosCompletosClienteOtro.this);
// } else {
// Toast.makeText(DatosCompletosClienteOtro.this, e.getMessage(), Toast.LENGTH_SHORT).show();
// Config.hidePD();
// }
// }
// });
}
}
private void queryListadoDeEmpresas(String stringTipoDeEmpresa) {
ParseQuery<ParseObject> query = ParseQuery.getQuery("Empresa");
query.whereEqualTo("tipoDeEmpresa", stringTipoDeEmpresa);
query.include("Ciudad");
query.findInBackground(new FindCallback<ParseObject>() {
@Override
public void done(List<ParseObject> objects, ParseException e) {
for (ParseObject obj : objects
) {
listaEmpresa.add(obj);
}
recyclerviewRelacionEscogeEmpresa.addItemDecoration(new DividerItemDecoration(getApplicationContext(),
LinearLayoutManager.VERTICAL));
// Pass results to ListViewAdapter Class
recyclerviewRelacionEscogeEmpresa.setLayoutManager(new LinearLayoutManager(getApplicationContext()));
adapter = new DatosCompletosOtroAdapterSearch(getBaseContext(), listaEmpresa);
// Binds the Adapter to the ListView
recyclerviewRelacionEscogeEmpresa.setAdapter(adapter);
adapter.notifyDataSetChanged();
}
});
}
private void openOptionPhotografy() {
android.support.v7.app.AlertDialog.Builder alert = new android.support.v7.app.AlertDialog.Builder(DatosCompletosClienteOtro.this);
alert.setTitle("Seleccione una opción")
.setIcon(R.mipmap.ic_launcher_round)
.setItems(new CharSequence[]{"Tomar fotografía", "Seleccionar de galería"}, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialogInterface, int which) {
switch (which) {
case 0:
if (!mmp.checkPermissionForCamera()) {
mmp.requestPermissionForCamera();
} else {
openCameraIntent();
}
break;
case 1:
if (!mmp.checkPermissionForReadExternalStorage()) {
mmp.requestPermissionForReadExternalStorage();
} else {
openImageGallery();
}
break;
}
}
})
.setNegativeButton("Cancelar", null);
alert.show();
}
// @Override
// protected void onActivityResult(int requestCode, int resultCode, @Nullable Intent data) {
// super.onActivityResult(requestCode, resultCode, data);
//
// if (resultCode == Activity.RESULT_OK) {
// Bitmap bm = null;
// //Image from camera
// if (requestCode == CAMERA) {
// try {
// bm = MediaStore.Images.Media.getBitmap(this.getContentResolver(), imageUrl);
//
//
// } catch (IOException e) {
// e.printStackTrace();
// }
//
// } else if (requestCode == GALLERY) {
// try {
// bm = MediaStore.Images.Media.getBitmap(getApplicationContext().getContentResolver(), data.getData());
//
// } catch (IOException e) {
// e.printStackTrace();
// }
// }
// //set image
// circleImageView3.setImageBitmap(bm);
// ParseUser currentUser = ParseUser.getCurrentUser();
// if (currentUser != null) {
// // Other attributes than "email" will remain unchanged!
// currentUser.put("Avatar", bm);
// currentUser.saveInBackground();
// //mm
// }
// }
// }
private void openCameraIntent(){
Intent pictureIntent=new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
if(pictureIntent.resolveActivity(getPackageManager())!=null){
startActivityForResult(pictureIntent,REQUEST_IMAGE);
}
}
private void openImageGallery(){
Intent photoPickerIntent=new Intent(Intent.ACTION_PICK);
File pictureDirectory=Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_PICTURES);
String picDirectoryPath=pictureDirectory.getPath();
Uri data=Uri.parse(picDirectoryPath);
photoPickerIntent.setDataAndType(data,"image/*");
startActivityForResult(photoPickerIntent,REQUEST_GALLERY);
}
@Override
protected void onActivityResult(int requestCode, int resultCode, @Nullable Intent data) {
super.onActivityResult(requestCode, resultCode, data);
if(requestCode== REQUEST_IMAGE && resultCode==RESULT_OK){
if(data!=null && data.getExtras()!=null ){
bitmap=(Bitmap)data.getExtras().get("data");
circleImageView3.setImageBitmap(bitmap);
user.put("Avatar",bitmap);
user.saveInBackground();
}
}
if(requestCode==REQUEST_GALLERY && resultCode==RESULT_OK){
Uri imageUri=data.getData();
InputStream inputStream;
try {
inputStream=getContentResolver().openInputStream(imageUri);
Bitmap image=BitmapFactory.decodeStream(inputStream);
circleImageView3.setImageBitmap(image);
user.put("Avatar",image);
user.saveInBackground();
} catch (FileNotFoundException e) {
e.printStackTrace();
Toast.makeText(this,"No fue posible abrir la imagen",Toast.LENGTH_LONG).show();
}
}
}
}
问题就在这里:user.put("Avatar",bitmap);
这是错误代码...
2019-07-08 14:58:41.798 1734-27078/? E/OMXNodeInstance: getConfig(0xee426d80:google.vorbis.decoder, ConfigAndroidVendorExtension(0x6f100004)) ERROR: Undefined(0x80001001)
2019-07-08 14:58:41.988 30043-30043/com.example.mac.mycarapp E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.example.mac.mycarapp, PID: 30043
java.lang.RuntimeException: Failure delivering result ResultInfo{who=null, request=100, result=-1, data=Intent { act=inline-data (has extras) }} to activity {com.example.mac.mycarapp/com.example.mac.mycarapp.UI.DatosCompletosClienteOtro}: java.lang.IllegalArgumentException: invalid type for value: class android.graphics.Bitmap
at android.app.ActivityThread.deliverResults(ActivityThread.java:4360)
at android.app.ActivityThread.handleSendResult(ActivityThread.java:4402)
at android.app.servertransaction.ActivityResultItem.execute(ActivityResultItem.java:49)
at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:108)
at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:68)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1808)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loop(Looper.java:193)
at android.app.ActivityThread.main(ActivityThread.java:6669)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:858)
Caused by: java.lang.IllegalArgumentException: invalid type for value: class android.graphics.Bitmap
at com.parse.ParseObject.performPut(ParseObject.java:3034)
at com.parse.ParseObject.put(ParseObject.java:3013)
at com.parse.ParseUser.put(ParseUser.java:814)
at com.example.mac.mycarapp.UI.DatosCompletosClienteOtro.onActivityResult(DatosCompletosClienteOtro.java:564)
at android.app.Activity.dispatchActivityResult(Activity.java:7454)
at android.app.ActivityThread.deliverResults(ActivityThread.java:4353)
at android.app.ActivityThread.handleSendResult(ActivityThread.java:4402)
at android.app.servertransaction.ActivityResultItem.execute(ActivityResultItem.java:49)
at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:108)
at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:68)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1808)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loop(Looper.java:193)
at android.app.ActivityThread.main(ActivityThread.java:6669)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:858)
2019-07-08 14:58:42.209 1915-1999/system_process E/InputDispatcher: channel '53feb7f com.example.mac.mycarapp/com.example.mac.mycarapp.UI.DatosCompletosClienteOtro (server)' ~ Channel is unrecoverably broken and will be disposed!
那我该怎么办?请帮助我..
最佳答案
我发现了你的问题。首先非常感谢您添加更多代码!这样我就可以确定您正在使用 parseplatform
.我看过 ParseUser
的 javadoc类并找到以下内容(对于方法 put
):
Add a key-value pair to this object. It is recommended to name keys in camelCaseLikeThis.
Overrides: put in class ParseObject Parameters:
key - Keys must be alphanumerical plus underscore, and start with a letter.
value - Values may be numerical, String, JSONObject, JSONArray, JSONObject.NULL, or other ParseObjects. value may not be null.
所以你不能通过put存储位图。要解决此问题,请将头像存储在文件系统 ( this will help you ) 中。存储头像后,像这样保存它的路径:user.put("avatarPath", <pathToAvatar>);
.现在当你想显示图像时,只需获取它的路径并从存储中读取它。
关于android - java.lang.IllegalArgumentException : invalid type for value: class android. 图形.Bitmap,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56941498/
据我所知,有两种复制位图的方法。 Bitmap.Clone() Bitmap A = new Bitmap("somefile.png"); Bitmap B = (Bitmap)A.Clone();
我收到这个错误,我不知道为什么或不明白原因: vector fourier_descriptor(Gdiplus::Bitmap myBitmap) { vector res;
我试图了解位图原始数据是如何存储的。我读过很多关于位图存储的文章,但有一篇文章指出位图文件的原始位域数据将以相反的顺序 (ABGR) 存储。但是,我找到了另一个显示 ARGB 的图表。因此,我不确定如
Bitmap bmp = BitmapFactory.decodeStream(inputStream, null, op); bmp.getConfig() = null; 为什么bmp.getC
位图中有300帧图像,设置的帧率为30,但视频长度只有3秒;如果有600帧图像,则视频长度为6秒等;视频可以播放所有内容,但播放速度更快,速度是两倍或三倍;原因是什么?应该如何(encodeVideo
List url = new ArrayList(); public Bitmap[] thumbs = { }; 我从我的方法中获取图像fetchImage(String url) for (int
AFAIK 在 Android 上,建议将 Bitmap 对象引用为 WeakReferences 以避免内存泄漏。当不再保留位图对象的硬引用时,垃圾收集器将自动收集它。 现在,如果我理解正确,必须始
我必须从 XML 文件加载图像。 XML 文件中没有关于图像是否为 JPG/GIF/BMP 的信息。加载图像后,我需要将其转换为位图。 有人知道如何在不知道实际文件格式的情况下将图像转换为位图吗?我正
几天前,我们在 Play 商店发布了一个应用程序,它处理高质量的位图并且完全是关于编辑它们。 当我们意识到 20% 的设备出现内存不足错误时,一切进展顺利。所以我们检查了我们的代码,发现 Androi
您好,我已经加载了位图,我需要设置自己的高度和宽度, bitmap.height = 100; 但是这个声明不允许我因为它说 'System.Drawing.Image.Width' cannot b
这是我写的测试,目前会失败: var unusableColor = Color.FromArgb(13, 19, 20, 19); var retrievedColor = Color.Empty;
我是否还需要在 Bitmap.Recycle() 之后调用 Bitmap.Dispose()?或者只是 Bitmap.Dispose() 就足够了? 最佳答案 根据 Android 文档 Bitmap
我试图将所有小图像(如草、水和沥青等)放入一张位图中。 我有一个这样的数组: public int Array[]={3, 1, 3, 3, 1, 1, 3, 3, 3, 3,
开发人员 website简单地说 getHeight() 将返回位图的高度,但有人可以告诉我是像素单位还是 dp 单位? 最佳答案 这是像素。在 Java 代码中,您通常使用像素,例如 View 的宽
我正在 F# 中编写一个项目,该项目使用 System.Drawing、NET Standard 2.0 的位图功能,但无法构建该项目,因为类型“Bitmap”不是在“System.Drawing”中
我正在尝试在 Android 中扩展可缩放的图像查看器以并排使用两个图像。为此,我使用了 Bitmap.createBitmap(int, int, Bitmap.Config)。不幸的是,这似乎会使
我正在使用 Java 创建这款 Android 游戏。但是,我加载位图,然后调整它们的大小以适合屏幕等(dpi 不是很准确)。但我的想法也是为具有少量 ram 的设备加载 16b (mBitmapOp
API 26 adds new option Bitmap.Config.HARDWARE: Special configuration, when bitmap is stored only in
11-24 23:19:18.434: ERROR/AndroidRuntime(12660): Uncaught handler: thread main exiting due to uncaug
我有一组位图。它们在某种程度上都是透明的,我事先不知道哪些部分是透明的。我想从排除透明部分但在正方形中的原始位图中创建一个新位图。我认为这张图片解释了这一点: 我知道如何从现有位图中创建位图,但我不知
我是一名优秀的程序员,十分优秀!