我有一个实现Parcelable接口的类:
class A implements Parcelable {
}
Run Code Online (Sandbox Code Playgroud)
我有另一个类B包含一个A对象作为实例变量.在writeToPacel内部类B,我想写对象B为Parcel:
class B implements Parcelable{
public void writeToParcel(Parcel dest, int flags) {
dest.write ???
}
}
Run Code Online (Sandbox Code Playgroud)
我怎么写和读它?
你好我有一个DialogFragment,显示用户的选项列表,其中一个选项是"删除"选项,当用户按下删除选项我想显示另一个DialogFragment作为确认,遗憾的是确认对话框不显示.
这是我的代码
第一个片段代码
public class ContactDialogOption extends SherlockDialogFragment {
public static final String TAG = ContactDialogOption.class.getSimpleName();
public ContactDialogOption() {
super();
// TODO Auto-generated constructor stub
}
@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
builder.setIcon(R.drawable.ic_launcher);
builder.setTitle(R.string.options);
builder.setItems(new String[] {
getString(R.string.call), getString(R.string.send_message),
getString(R.string.copy), getString(R.string.edit),
getString(R.string.delete)
}, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
if(which == 4) //delete
{
FragmentManager mgr = getActivity().getSupportFragmentManager();
FragmentTransaction ft = mgr.beginTransaction();
Fragment old = mgr.findFragmentByTag("SecondFragment");
if (old != null) …Run Code Online (Sandbox Code Playgroud) 我在我的项目中使用趋势毕加索,但我已经倾倒了堆,它看起来像这样.现在昨天它给了我48M LruCache用于毕加索.
我怎么能指定它的大小?
注意:我加载的图像显然很大.
如果有人提出fit()或者centerCrop(),我已经知道这些功能会减少图像尺寸,对吗?但有时我必须ListView在全视图中显示小图像.
现在,这些功能是否缓存缩小的图像?

我有一个应用程序显示来自服务器的图像.现在我懒得加载我的图像.所以最初我在图像完成加载时显示一个进度条我通过设置它visibility来删除进度条View.INVISIBLE并显示图像.这是我用于图像的布局文件
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_gravity="center" >
<ImageView
android:id="@+id/imageView1"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_gravity="center"
android:contentDescription="@string/app_name"
android:scaleType="centerInside"
android:src="@drawable/ic_launcher" />
<RelativeLayout
android:id="@+id/loading_layout"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="@android:color/white" >
<ProgressBar
android:id="@+id/progressBar1"
style="?android:attr/progressBarStyleSmall"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_centerVertical="true"
android:background="@android:color/white" />
</RelativeLayout>
</FrameLayout>
Run Code Online (Sandbox Code Playgroud)
问题 当进度条消失时,屏幕上显示的图像却已损坏.喜欢这个图像
当我刷新列表从缓存目录加载的图像,当它们在屏幕上显示时,它们正确显示没有任何损坏.

ImageLoader类我用来延迟加载图片
public class ImageLoader {
// @@ JUST FOR THIS PROJECT
BaseAdapter mAdapter;
// @@
MemoryCache memoryCache = new MemoryCache();
FileCache fileCache;
private Map<ImageView, String> imageViews = Collections
.synchronizedMap(new WeakHashMap<ImageView, String>());
ExecutorService executorService;
boolean addRoundCournerAndStroke = false; …Run Code Online (Sandbox Code Playgroud) 我正在转向Gradle构建.但我有很多9补丁图像的这个错误.
请注意,drawable是自动生成的,http://android-holo-colors.com
但它们是旧的.
我正在使用android studio 0.5.1
而我的构建工具版本就是19.0.3
这个错误
Error:Execution failed for task ':app:mergeDebugResources'.
> Error: Failed to run command:
/Applications/Android Studio.app/sdk/build-tools/19.0.3/aapt s -i /Users/Ed/Desktop/TestAndroid/app/src/main/res/drawable-mdpi/spinner_default_holo_dark.9.png -o /Users/Ed/Desktop/TestAndroid/app/build/res/all/debug/drawable-mdpi/spinner_default_holo_dark.9.png
Error Code:
42
Output:
ERROR: 9-patch image /Users/Ed/Desktop/TestAndroid/app/src/main/res/drawable-mdpi/spinner_default_holo_dark.9.png malformed.
Frame pixels must be either solid or transparent (not intermediate alphas).
Found at pixel #3 along top edge.
/Users/Ed/Desktop/TestAndroid/app/src/main/res/drawable-hdpi/cab_background_bottom_test.9.png
Error:Ticks in transparent frame must be black or red. - ERROR: 9-patch image /Users/Ed/Desktop/TestAndroid/app/src/main/res/drawable-mdpi/spinner_default_holo_dark.9.png malformed.
Run Code Online (Sandbox Code Playgroud)
任何人都面临同样的问题.
我想懒惰加载类但没有成功
<?php
class Employee{
function __autoload($class){
require_once($class);
}
function display(){
$obj = new employeeModel();
$obj->printSomthing();
}
}
Run Code Online (Sandbox Code Playgroud)
现在当我做这个
function display(){
require_once('emplpyeeModel.php');
$obj = new employeeModel();
$obj->printSomthing();
}
Run Code Online (Sandbox Code Playgroud)
它的工作原理,但我想懒得加载这个类.
我有一个FrameLayout,我想通过选择器应用前景drawable,我试图实现"drawSelectorOnTop",但为一个简单的布局
现在,当用户按"state_pressed"时,选择器不适用
这是我的代码:
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:foreground="@drawable/cell_background_selector" >
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#282828"
android:paddingBottom="5dp" >
..
......
........
</RelativeLayout>
</FrameLayout>
Run Code Online (Sandbox Code Playgroud)
这是我的选择码:
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:drawable="@drawable/video_blank" android:state_pressed="true"/>
<item android:drawable="@drawable/fav_show"/>
</selector>
Run Code Online (Sandbox Code Playgroud)
两个图像都存在,但FrameLayout始终将普通状态drawable应用为前景
我在文件中重置了一个数据库assets文件.
如何SQLCipher在android中加密数据库?
我想为商场构建一个Android应用程序,因此用户可以在代表商场中每个楼层的地图中导航并计算他的位置和所选地点之间的最短路径,位于中东的商场,我听说过谷歌室内地图,但我想我不能使用它,我需要为该商场制作一个,我可以让它3-D吗?任何建议或有关此的文章都可以提供帮助.
我有一个Cursor返回从SQLiteDataBase对象,我可以使用getXXX()从光标获取列的内容,在我的情况下我想修改游标中的"更新"数据使用setXXX()方法,我知道没有setXXX()方法,但是有CursorWindow对象具有此功能,但我无法使用它