我有像Android一样在Android中播放视频的应用程序
https://play.google.com/store/apps/details?id=com.vlcforandroid.vlcdirectprofree&hl=en
我想在我的应用中集成此应用.我有视频流的Url,我想在这个应用程序(Vlc Direct)中打开这个视频,不知道吗?
我使用以下命令打开此应用
Intent i = new Intent(Intent.ACTION_MAIN);
PackageManager manager = getPackageManager();
i = manager.getLaunchIntentForPackage("com.vlcdirect.vlcdirect");
i.addCategory(Intent.CATEGORY_LAUNCHER);
startActivity(i);
Run Code Online (Sandbox Code Playgroud)
但它是如何从视频流或任何其他视频流播放器开始的?
我想将我的java项目转换为Kotlin,有超过500个java文件.如何轻松将其转换为Kotlin?
我知道我们可以将一个java文件转换为Kotlin,但是有很多文件.
我可以一次转换吗?
我在我的应用程序中需要字体字体Helvetica并适用于所有活动.有什么来源吗?
我在资产文件夹中有Helvetica.ttf文件但是当我尝试时
TextView text2 =(TextView)findViewById(R.id.textView2);
Typeface font = Typeface.createFromAsset(getAssets(), "helvetica.ttf");
text2.setTypeface(font);
Run Code Online (Sandbox Code Playgroud)
但错误是::
10-22 17:48:43.883: ERROR/AndroidRuntime(951): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.logistics.typeface/com.logistics.typeface.MainActivity}: java.lang.RuntimeException: native typeface cannot be made
10-22 17:48:43.883: ERROR/AndroidRuntime(951): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2663)
10-22 17:48:43.883: ERROR/AndroidRuntime(951): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2679)
10-22 17:48:43.883: ERROR/AndroidRuntime(951): at android.app.ActivityThread.access$2300(ActivityThread.java:125)
10-22 17:48:43.883: ERROR/AndroidRuntime(951): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2033)
10-22 17:48:43.883: ERROR/AndroidRuntime(951): at android.os.Handler.dispatchMessage(Handler.java:99)
10-22 17:48:43.883: ERROR/AndroidRuntime(951): at android.os.Looper.loop(Looper.java:123)
10-22 17:48:43.883: ERROR/AndroidRuntime(951): at android.app.ActivityThread.main(ActivityThread.java:4627)
10-22 17:48:43.883: ERROR/AndroidRuntime(951): at java.lang.reflect.Method.invokeNative(Native Method)
10-22 17:48:43.883: ERROR/AndroidRuntime(951): at java.lang.reflect.Method.invoke(Method.java:521)
10-22 17:48:43.883: ERROR/AndroidRuntime(951): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868) …Run Code Online (Sandbox Code Playgroud) 我有xml文件,并创建视图,我在下一个活动中传递该屏幕截图.还有主要布局的图像.
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical" android:layout_width="match_parent" android:id="@+id/mainLayout"
android:layout_height="match_parent">
<ImageView android:layout_height="wrap_content" android:id="@+id/imageSelected"
android:src="@drawable/icon" android:layout_width="wrap_content"
android:layout_centerVertical="true" android:layout_alignParentLeft="true"
android:layout_marginLeft="79dp"></ImageView>
<RelativeLayout android:layout_width="fill_parent"
android:id="@+id/relativelayoutfinal" android:layout_height="fill_parent">
</RelativeLayout>
<RelativeLayout android:id="@+id/RelativeLayoutbutton"
android:layout_width="wrap_content" android:layout_height="wrap_content"
android:layout_alignParentBottom="true">
<include layout="@layout/bottombutton" />
</RelativeLayout>
<Button android:layout_width="wrap_content" android:background="@drawable/b_brightness_contrast"
android:id="@+id/btnbrightcont" android:layout_height="wrap_content"
android:layout_marginBottom="40dip" android:layout_alignParentBottom="true"
android:layout_alignParentRight="true" android:layout_marginRight="103dp"></Button>
<Button android:background="@drawable/b_adjust_and_scale"
android:layout_width="wrap_content" android:id="@+id/btnadjustscale"
android:layout_above="@+id/btnbrightcont" android:layout_alignLeft="@+id/btnbrightcont"
android:layout_height="wrap_content"></Button>
<SeekBar android:layout_height="wrap_content" android:progress="50"
android:layout_marginTop="50dip" android:layout_marginRight="30dip"
android:layout_width="160dip" android:id="@+id/sbbrightness"
android:visibility="gone" android:layout_alignParentTop="true"
android:layout_alignParentRight="true"></SeekBar>
<SeekBar android:layout_height="wrap_content" android:progress="50"
android:visibility="gone" android:layout_width="160dip" android:id="@+id/sbcontrast"
android:layout_below="@+id/sbbrightness" android:layout_alignLeft="@+id/sbbrightness"></SeekBar>
</RelativeLayout>
Run Code Online (Sandbox Code Playgroud)
并将图像作为drawable或bitmap发送到下一个活动......它可能??
当我在eclipse中从工作区导入项目时,它会在@Override注释中出错.如果项目有任何具有注释的方法,它会显示为错误,当我删除它时工作正常,但是当我有一个包含大量注释的主要项目时,我该怎么办呢?
我刚刚阅读了Java7中的增强功能( http://docs.oracle.com/javase/7/docs/technotes/guides/language/underscores-literals.html).在那里,我看到了Underscores Numeric Literals并尝试了Like ....
int i=9_000; 没关系.
但我看到规则,它也允许...
int i=9____________________________________________________________________________________000;
Run Code Online (Sandbox Code Playgroud)
有没有结束Underscores?
我有时间作为"2011-12-03 12:00:19"如何在"2011年12月2日星期五"转换它,我知道这个http://docs.oracle.com/javase/6/docs/api/ java/text/SimpleDateFormat.html,但是给了我错误:
Exception in thread "main" java.lang.IllegalArgumentException: Cannot format given Object as a Date
at java.text.DateFormat.format(Unknown Source)
at java.text.Format.format(Unknown Source)
at com.timestamp.NewTimeStamp.<init>(NewTimeStamp.java:21)
at com.timestamp.NewTimeStamp.main(NewTimeStamp.java:35)
Run Code Online (Sandbox Code Playgroud)
我的代码是::
String mytime ="2011-12-03 12:00:19";
String pattern = "EEE d MMMMM yyyy";
SimpleDateFormat dateFormat = new SimpleDateFormat(pattern);
Date date = new Date(mytime);
String time = dateFormat.format(date);
System.out.println("=== > " + time);
Run Code Online (Sandbox Code Playgroud) Integer i1= new Integer(9);
Integer i2= new Integer(9);
if(i1==i2){
System.out.println("true");
}else{
System.out.println("false");
}
int i3=9;
int i4=9;
if(i3==i4){
System.out.println("true");
}else{
System.out.println("false");
}
if(i3==i2){
System.out.println("true");
}else{
System.out.println("false");
}
Run Code Online (Sandbox Code Playgroud)
在上面的代码中首先if-else打印为false,为什么?.但是当第二次返回true而第三次有true时.我认为包装类(如double,boolean,char)不能比较True?
我有一个字节数组,即从byte [0]到byte [2].我想先将byte [0]分成8位.然后是bytes [1],最后是bytes [2].通过分裂我的意思是如果byte [0] = 12345678然后我想分裂为变量A = 8,变量B = 7,变量C = 6,变量D = 5,........变量H = 0 .如何拆分字节并将位存储到变量中?我想在JAVA中这样做
Kotlin中的数据和对象类之间的区别是什么?
data class User(val name: String, val age: Int)
Run Code Online (Sandbox Code Playgroud)
和
object user {
val name = ""
fun printName(name: String) = "Hello, $name!"
}
Run Code Online (Sandbox Code Playgroud)