我试图通过在imageview中更改图像来逐帧动画显示.我尝试在xml中绘制动画,并在Handler中更改imageview的位图.我还试图在arraylist中存储三个位图(以避免内存不足)作为缓存机制,但实际上是很低的改进.我需要迭代36张图像以获得完整的动画效果.我面临的问题是,在我使用的所有方法中,我无法在50ms的给定时间范围内完成动画.图像范围从最小250 kb到最大540 kb.动画的fps非常低.随着应用程序的ios版本准备就绪,我被限制为显示与ios版本一致的动画.我是renderscript和opengl的菜鸟.有没有办法在50-60ms内显示大图像的平滑动画.任何提示或建议都非常感谢.下面是动画的快照:这是任何一个感兴趣的人的图像链接.

我是android编程的新手.我一直在尝试使用以下代码将多个图像从我的应用程序上传到服务器.这里image []数组与namevaluepair中的用户名,密码等其他数据一起发布到服务器.
Java代码:
public void post(String url, List<NameValuePair> nameValuePairs) {
HttpClient httpClient = new DefaultHttpClient();
HttpPost httpPost = new HttpPost(url);
try {
MultipartEntity entity = new MultipartEntity(
HttpMultipartMode.BROWSER_COMPATIBLE);
for (int index = 0; index < nameValuePairs.size(); index++) {
if (nameValuePairs.get(index).getName()
.equalsIgnoreCase("image[]")) {
// If the key equals to "image[]", we use FileBody to transfer
// the data
Log.d("key", "image");
Log.d("image path", nameValuePairs.get(index).getName());
entity.addPart(nameValuePairs.get(index).getName(),
new FileBody(new File(nameValuePairs.get(index)
.getValue())));
} else {
// Normal string data
Log.d("tag", nameValuePairs.get(index).getName());
// Log.d("tag", nameValuePairs.get(index).getValue());
entity.addPart( …Run Code Online (Sandbox Code Playgroud) 我收到了这个错误
java.lang.IllegalArgumentException: Wrong state class, expecting View State but received class android.widget.AbsListView$SavedState instead. This usually happens when two views of different type have the same id in the same hierarchy. This view's id is id/unique111123234. Make sure other views do not use the same id.
Run Code Online (Sandbox Code Playgroud)
当我在视图寻呼机中的选项卡之间切换时,会发生此错误.我正在使用下面的自定义复合视图
public class RefreshableListView extends SwipeRefreshLayout {
private ListView listView;
private boolean disabled = false;
private Context context = null;
private AttributeSet attributes = null;
private RelativeLayout layout;
public RefreshableListView(Context context) {
super(context);
this.context = …Run Code Online (Sandbox Code Playgroud) 我有一个HashMap<String, LinkedHashMap<String,String>相当长的时间(不是问题),我正在努力确保在我使用其中的数据之前看起来正确.要做到这一点,我试图尝试这样做,Log.v("productsFromDB",products.toString())但在LogCat它显示约1/3.有没有办法输出整个地图?
我们有一个Android,ios和web应用程序.该应用程序使用Facebook登录(使用easyfacebook.jar)作为授权用户的替代方式.它工作正常,但由于最近facebook sdk的变化,我无法获得实际的Facebook ID,因为facebook api返回特定于应用程序的用户ID.从Facebook页面:
从v1.0更改为v2.0
应用范围的用户ID:为了更好地保护用户的信息,当用户登录已升级为使用Graph API v2.0的应用版本时,Facebook现在将发布应用范围的ID而不是该用户的原始ID.但是,对于之前登录过您应用的用户,用户ID不会更改.
我得到的id对于ios,web和android是不同的.请看一下:
ios和web https://www.facebook.com/559709594 //返回实际的用户ID
Android https://www.facebook.com/10152580446094595 //不返回实际的userId
我试过官方的facebook sdk来获取实际的用户ID,但是没有成功.我试图使用以下方式获取用户ID:
user = graphApi.getMyAccountInfo();
facebookIdLogin = user.getId();
//returns app specific id not actual user id id = 10152580446094595
Log.d("username is : ", user.getName());//return actual value
Log.d("facebook id is this", facebookIdLogin);
Log.d("facebook user link", user.getLink());
//returns www.facebook.com/10152580446094595
Run Code Online (Sandbox Code Playgroud)
有没有办法让我获得实际的userId.由于平台之间的同步,我需要实际的userId.无论我做什么,我只获得应用程序特定的userId.这是我要求的许可:
String permissions[] = { "public_profile", "user_friends", "email" };
Run Code Online (Sandbox Code Playgroud)
任何帮助都非常感谢.
我已经在 xml 文件中定义了 imageview 大小。因此,当图像出现时,它将作为默认值。我根据某些条件显示不同的图像。所以,我需要改变图像的宽度和高度。
xml:
<ImageView
android:id="@+id/imageView1"
android:layout_width="100dp"
android:layout_height="100dp"
android:visibility="invisible" />
Run Code Online (Sandbox Code Playgroud)
爪哇:
if (text.equalsIgnoreCase("y")) {
image.setImageResource(R.drawable.y);
}
else if (text.equalsIgnoreCase("z")) {
image.setImageResource(R.drawable.z); // Here i need to change the width & height of the image
}
Run Code Online (Sandbox Code Playgroud) 我所取得的是将给定的图像从正方形转换为圆形,但我现在无法获得边框,一个简单的白色边框.
public class RoundedImageView extends ImageView {
public RoundedImageView(Context context) {
super(context);
// TODO Auto-generated constructor stub
}
public RoundedImageView(Context context, AttributeSet attrs) {
super(context, attrs);
}
public RoundedImageView(Context context, AttributeSet attrs, int defStyle) {
super(context, attrs, defStyle);
}
@Override
protected void onDraw(Canvas canvas) {
Drawable drawable = getDrawable();
if (drawable == null) {
return;
}
if (getWidth() == 0 || getHeight() == 0) {
return;
}
Bitmap b = ((BitmapDrawable) drawable).getBitmap();
Bitmap bitmap = b.copy(Bitmap.Config.ARGB_8888, true);
int w = …Run Code Online (Sandbox Code Playgroud) 我在开发我的应用程序时并没有太远,我得到了一个java.lang.OutOfMemoryError.这是logcat:
02-24 14:02:54.957: E/art(28628): Throwing OutOfMemoryError "Failed to allocate a 28 byte allocation with 8 free bytes and 8B until OOM" (recursive case)
02-24 14:02:54.965: E/art(28628): "FinalizerDaemon" daemon prio=5 tid=8 Runnable
02-24 14:02:54.965: E/art(28628): | group="system" sCount=0 dsCount=0 obj=0x12c260e0 self=0xac4a5400
02-24 14:02:54.965: E/art(28628): | sysTid=28641 nice=0 cgrp=apps sched=0/0 handle=0xac4b9b00
02-24 14:02:54.965: E/art(28628): | state=R schedstat=( 2442370612 111306164 635 ) utm=229 stm=15 core=1 HZ=100
02-24 14:02:54.965: E/art(28628): | stack=0xb40fe000-0xb4100000 stackSize=1036KB
02-24 14:02:54.965: E/art(28628): | held mutexes= "mutator lock"(shared held)
02-24 14:02:54.965: …Run Code Online (Sandbox Code Playgroud) android ×8
java ×2
cakephp ×1
facebook ×1
file-upload ×1
hashmap ×1
logcat ×1
performance ×1
php ×1