有没有办法创造EditText
圆角?
有没有一种方法可以在我的bean中获取当前活动的配置文件?
谢谢
升级到appcompat后,25.1.0
我开始收到有线错误.
在我的代码中:
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
Run Code Online (Sandbox Code Playgroud)
我得到lint错误:
AppCompatActivity.onCreate can only be called from within the same library group (groupId=com.android.support)
如何防止这种行为?
目前我正在开始一个新的,Activity
并呼吁finish
当前的.
是否有任何可以传递给Intent
它的标志,可以在Activity
不需要finish
从代码中手动调用的情况下完成当前的操作?
我正在优化一个函数,我想摆脱缓慢的for循环.我正在寻找一种更快的方法来将矩阵的每一行乘以一个向量.
有任何想法吗?
编辑:
我不是在寻找'经典'乘法.
例如.我有一个有23列和25行的矩阵和一个长度为23的向量.结果我想要矩阵25x23,每行乘以向量.
我有两个申请.
一个是宣布许可和单身Activity
:
部分的AndroidManifest.xml
<application
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:permission="your.namespace.permission.TEST" >
<activity
android:name=".DeclaringPermissionActivity"
android:label="@string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data android:scheme="myapp"
android:host="myapp.mycompany.com" />
</intent-filter>
</activity>
</application>
Run Code Online (Sandbox Code Playgroud)
第二个声明是使用权限
部分的AndroidManifest.xml
<uses-sdk android:minSdkVersion="10" />
<uses-permission android:name="your.namespace.permission.TEST" />
<application
Run Code Online (Sandbox Code Playgroud)
部分Activity
:
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse("myapp://myapp.mycompany.com/index")));
}
Run Code Online (Sandbox Code Playgroud)
我正在安装应用程序声明权限,然后我运行第二个应用程序.
结果我得到安全异常:
01-11 09:46:55.249: E/AndroidRuntime(347): java.lang.RuntimeException: Unable to start activity ComponentInfo{your.namespace2/your.namespace2.UsingPErmissionActivity}: java.lang.SecurityException: Permission Denial: starting Intent …
Run Code Online (Sandbox Code Playgroud) 当我创建首选项活动时,我在xml文件中定义所有首选项.每个首选项都有一个在此xml中定义的键.但当我访问首选项时,我写道:
SharedPreferences appPreferences = PreferenceManager.getDefaultSharedPreferences(this);
boolean foo_value = appPreferences.getBoolean("foo_key_defined_in_xml", false);
Run Code Online (Sandbox Code Playgroud)
有没有办法避免以硬编码的方式引用"foo_key_defined_in_xml"?也许有可能以R风格的方式引用它(不是指字符串)?
我的问题是,当我启动应用程序并且用户没有打开我的PreferenceActivity
时候,当我检索它们时,不会获得我的preference.xml文件中定义的任何默认值.
preference.xml文件:
<?xml version="1.0" encoding="utf-8"?>
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android"
android:key="applicationPreference" android:title="@string/config"
>
<ListPreference
android:key="pref1"
android:defaultValue="default"
android:title="Title"
android:summary="Summary"
android:entries="@array/entry_names"
android:entryValues="@array/entry_values"
android:dialogTitle="@string/dialog_title"
/>
</PreferenceScreen>
Run Code Online (Sandbox Code Playgroud)
我的主要活动(onCreate
方法)的片段:
SharedPreferences appPreferences = PreferenceManager.getDefaultSharedPreferences(this);
String pref1 = appPreferences.getString("pref1", null);
Run Code Online (Sandbox Code Playgroud)
结果我得到了一个null
值.
当我使用Proguard编译我的Android应用程序时,我收到以下错误:
-dex:
[echo] Converting compiled files and external libraries into /home/ka/dev/workspace/ImPress/build/classes.dex...
[apply]
[apply] UNEXPECTED TOP-LEVEL EXCEPTION:
[apply] com.android.dx.cf.code.SimException: local variable type mismatch: attempt to set or access a value of type java.io.File using a local variable of type java.lang.Object[]. This is symptomatic of .class transformation tools that ignore local variable information.
[apply] at com.android.dx.cf.code.BaseMachine.throwLocalMismatch(BaseMachine.java:550)
[apply] at com.android.dx.cf.code.BaseMachine.getLocalTarget(BaseMachine.java:405)
[apply] at com.android.dx.cf.code.BaseMachine.storeResults(BaseMachine.java:532)
[apply] at com.android.dx.cf.code.ValueAwareMachine.run(ValueAwareMachine.java:197)
[apply] at com.android.dx.cf.code.RopperMachine.run(RopperMachine.java:291)
[apply] at com.android.dx.cf.code.Simulator$SimVisitor.visitLocal(Simulator.java:608)
[apply] at com.android.dx.cf.code.BytecodeArray.parseInstruction(BytecodeArray.java:526)
[apply] at com.android.dx.cf.code.Simulator.simulate(Simulator.java:99)
[apply] at com.android.dx.cf.code.Ropper.processBlock(Ropper.java:684)
[apply] at …
Run Code Online (Sandbox Code Playgroud) 我正在将 Spring Boot 版本从 升级2.1.x
到2.4.2
. 当我编译并运行代码时,我收到以下警告:
Unable to load io.netty.resolver.dns.macos.MacOSDnsServerAddressStreamProvider,fallback to system defaults. This may result in incorrect DNS resolutions on MacOS.
java.lang.ClassNotFoundException: io.netty.resolver.dns.macos.MacOSDnsServerAddressStreamProvider
Run Code Online (Sandbox Code Playgroud)
当我将项目部署到AWS和CentOS计算机中的DEV环境时,日志中没有此类警告消息。
谢谢,
android ×7
java ×3
spring-boot ×2
android-lint ×1
dns ×1
flags ×1
matrix ×1
permissions ×1
proguard ×1
r ×1
spring ×1
vector ×1
views ×1
xml ×1