我正在尝试让我的应用程序为Android 6做好准备,现在我已经停留在需要请求和检查权限的位置.
我从文档中尝试了以下内容:
int permissionCheck = ContextCompat.checkSelfPermission(thisActivity,
Manifest.permission.WRITE_CALENDAR);
问题是Android Studio说Cannot resolve method 'checkSelfPermission'.
我已经包含了appcompat和支持lib.ContextCompatAS已知但该方法本身尚不清楚.我不知道我做错了什么 - 在另一个项目中我可以编写这个方法并且它得到了认可.
TargetAPI是23.
有谁知道解决方案?
Notepad++ 的“Convert to UTF-8 without BOM”功能真的很不错。但是我有 200 个文件,所有文件都需要隐藏。因此我找到了这个小python脚本:
import os;
import sys;
filePathSrc="C:\\Temp\\UTF8"
for root, dirs, files in os.walk(filePathSrc):
for fn in files:
if fn[-4:] != '.jar' and fn[-5:] != '.ear' and fn[-4:] != '.gif' and fn[-4:] != '.jpg' and fn[-5:] != '.jpeg' and fn[-4:] != '.xls' and fn[-4:] != '.GIF' and fn[-4:] != '.JPG' and fn[-5:] != '.JPEG' and fn[-4:] != '.XLS' and fn[-4:] != '.PNG' and fn[-4:] != '.png' and fn[-4:] != '.cab' and fn[-4:] != '.CAB' and …Run Code Online (Sandbox Code Playgroud) 我从普通的ActionBar更改为新的工具栏.我的问题是我的旧菜单不起作用.当我点击溢出图标时没有任何反应.我正在使用appcompat v7,但我找不到任何解决方案.有人能帮我吗?
Menufunctions:
@Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu
getMenuInflater().inflate(R.menu.chatmenu, menu);
return super.onCreateOptionsMenu(menu);
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
switch (item.getItemId()) {
case R.id.onlineliste:
getOnlineList();
return true;
case R.id.settings:
showSettings();
return true;
case R.id.logout:
logout();
return true;
default:
return super.onOptionsItemSelected(item);
}
}
Run Code Online (Sandbox Code Playgroud)
Chatmenu:
<?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto" >
<item
android:id="@+id/onlineliste"
android:title="@string/userliste"
app:showAsAction="always">
</item>
<item
android:id="@+id/settings"
android:title="@string/settings"
app:showAsAction="never">
</item>
<item
android:id="@+id/logout"
android:title="@string/logout"
app:showAsAction="never">
</item>
</menu>
Run Code Online (Sandbox Code Playgroud)
主题
<style name="AppTheme.Base" parent="Theme.AppCompat.Light">
<item name="colorPrimary">#428bca</item>
<item name="colorPrimaryDark">#428bca</item>
<item …Run Code Online (Sandbox Code Playgroud)