通常,如果我们想要初始化通用的非原始ArrayList,我们就这样做
ArrayList<?> arrayList = new ArrayList<MyClass.class>();
Run Code Online (Sandbox Code Playgroud)
但是无论我传递哪个类对象,我想做类似的事情,即
private void getModel(Class responseType){
//Something similar, because this does not work..
ArrayList<?> arrayList = new ArrayList<responseType>();
}
Run Code Online (Sandbox Code Playgroud)
任何帮助将不胜感激.
很久以后,在Android Gradle插件0.7.3中添加了在Android项目中添加预先构建的.so文件的支持.但与我不同的是,很多人仍在使用hack/workaround添加预先构建的.so文件,即使用特定层次结构压缩文件,然后重命名为.jar.以下是如何正确添加.so文件的分步指南.
我有一个复杂的xml文件,我真的需要一个ScrollView.因为我改变了它们,请不要介意它.ScrollView在这里不起作用.
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:fillViewport="true">
<LinearLayout
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:id="@+id/f_summary_LL">
<LinearLayout
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="wrap_content">
<LinearLayout
android:orientation="horizontal"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:background="@color/black">
<LinearLayout
android:orientation="horizontal"
android:layout_width="fill_parent"
android:layout_height="wrap_content" android:layout_weight="1">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text=""
android:id="@+id/BT1"
android:textColor="@color/white"
android:textStyle="bold"
android:gravity="center_vertical|left"
android:paddingLeft="2dp"
android:textSize="13sp"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text=""
android:id="@+id/BTS1"
android:textColor="@color/white"
android:paddingLeft="4dp"
android:textSize="13sp"/>
</LinearLayout>
<LinearLayout
android:orientation="horizontal"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:gravity="center_vertical|right"
android:layout_weight="1">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text=""
android:id="@+id/textView7"
android:textSize="13sp"
android:textColor="@color/white"
android:textStyle="bold" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text=""
android:id="@+id/BT1CRR" android:textColor="@color/white"
android:paddingRight="8dp" android:textSize="13sp"
android:paddingLeft="2dp"/>
</LinearLayout>
</LinearLayout>
<LinearLayout
android:orientation="horizontal"
android:layout_width="fill_parent"
android:layout_height="wrap_content">
<TextView
android:layout_width="0dp"
android:layout_height="wrap_content"
android:text=""
android:id="@+id/textView" android:textColor="@color/white" …Run Code Online (Sandbox Code Playgroud) 配置Android注释非常令人厌烦.但我终于想出了一个解决方案,并希望与大家分享.
android android-annotations android-studio android-gradle-plugin
我想使用默认的MediaPlayer库在Android上玩wowza .mp3流.但是我尝试使用android本身提供的API演示来播放流,但它不起作用.虽然android文档说它确实如此.
http://developer.android.com/guide/appendix/media-formats.html
我检查了wowza文档,发现.mp3 rtsp流无法在任何Android设备上播放. http://www.wowza.com/forums/content.php?62
我很困惑,这里的真正问题是什么,因为一个文档说它确实存在,而另一个说它不存在?有人可以告诉我吗?
如果图像已经缓存,我不想下载图像.我正在使用NOSTRA的ImageLoader库.请告诉我是否有办法做到这一点.以下是代码: -
DisplayImageOptions options = new DisplayImageOptions.Builder()
.showStubImage(R.drawable.ic_stub)
.showImageForEmptyUri(R.drawable.ic_sample)
.resetViewBeforeLoading()
.cacheInMemory()
.cacheOnDisc()
.imageScaleType(ImageScaleType.EXACTLY_STRETCHED)
.bitmapConfig(Bitmap.Config.ARGB_8888)
.build();
imageLoader.displayImage(url2.toString()
,thumbnail,options, new
ImageLoadingListener() {
@Override
public void onLoadingStarted() {
// progressBar.setVisibility(grid.VISIBLE);
// grid.notify();
}
@Override
public void onLoadingFailed(FailReason failReason) {
//progressBar.setVisibility(grid.GONE);
// grid.notify();
}
@Override
public void onLoadingComplete(Bitmap bitmap) {
// progressBar.setVisibility(grid.GONE);
// grid.notify();
}
@Override
public void onLoadingCancelled() {
// progressBar.setVisibility(grid.GONE);
//grid.notify();
}
});
Run Code Online (Sandbox Code Playgroud)