我在Android中遇到了sqlite db的问题.但是当我在互联网上进行快速研究时,我怀疑这个问题与sqlite无关,而与系统用户无关.我的应用程序未被识别为访问数据库功能的授权用户.我尝试在堆栈溢出中应用可能的建议解决方案,但它们都没有区别.这是我每次尝试使用数据库功能时遇到的LogCat.
12-14 02:35:17.721 2953-3355/? E/DatabaseUtils? Writing exception to parcel
java.lang.SecurityException: Permission Denial: get/set setting for user asks to run as user -2 but is calling from user 0; this requires android.permission.INTERACT_ACROSS_USERS_FULL
at com.android.server.am.ActivityManagerService.handleIncomingUser(ActivityManagerService.java:13082)
at android.app.ActivityManager.handleIncomingUser(ActivityManager.java:2038)
at com.android.providers.settings.SettingsProvider.callFromPackage(SettingsProvider.java:577)
at android.content.ContentProvider$Transport.call(ContentProvider.java:279)
at android.content.ContentProviderNative.onTransact(ContentProviderNative.java:273)
at android.os.Binder.execTransact(Binder.java:388)
at dalvik.system.NativeStart.run(Native Method)
Run Code Online (Sandbox Code Playgroud)
我试图添加权限
android.permission.INTERACT_ACROSS_USERS_FULL
Run Code Online (Sandbox Code Playgroud)
但仍然没有声音.奇怪的是当我尝试添加INTERNET权限Android Studio 0.3(我使用的是ide)建议我可以选择的权限.但是当谈到INTERACT_ACROSS_USERS_FULL权限时,它的行为就像它不知道这个权限.我的测试设备是在4.3上运行的三星S4.
我假设我不是唯一一个尝试在android上使用db的人.所以有一个解决方案.
我怎样才能真正为我的应用程序添加INTERACT_ACROSS_USERS_FULL权限?
我在应用程序的菜单中添加了一个项目(带有图标和文本).
我有两个图像用于项目的正常(非压缩)状态和高亮(按下)状态.
这是我的菜单xml
<?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android="http://schemas.android.com/apk/res/android">
<item
android:showAsAction="ifRoom|withText"
android:title="New"
android:icon="@drawable/menu_selector"
android:id="@+id/add_channel"></item>-
</menu>
Run Code Online (Sandbox Code Playgroud)
这是选择器menu_selector.xml
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_selected="false"
android:state_pressed="false"
android:drawable="@drawable/new_channel" />
<item android:state_pressed="true"
android:drawable="@drawable/book"/>
<item android:state_selected="true"
android:state_pressed="false"
android:drawable="@drawable/book" />
</selector>
Run Code Online (Sandbox Code Playgroud)
但这对我来说还不够.当我按下该项目时,它会更改它包含的图像,但背景中也会突出显示绿色发光效果.
如何禁用或隐藏此发光效果?
我正在使用python在谷歌应用引擎中创建一个网站.不幸的是,我找不到任何关于我的问题.我必须根据其内容区分变量.
例如,我将发送这样的变量
content = {
'mail':session.get('user_mail',''),
'role':'Admin',
}
render_template(self, 'index.html', content)
Run Code Online (Sandbox Code Playgroud)
如果是"登录"用户或"管理员"用户,我需要这样的代码来理解用户的类型.
{% if role == 'Ordinary' %}
{{ role }}
{% elif role == 'Admin' %}
{{ role }}
{% endif %}
Run Code Online (Sandbox Code Playgroud)
我怎样才能做到这一点?
或者也许有更好的设计,你可以建议我.
谢谢...
我在android中的方向有问题.设备方向是我在AndroidManifest.xml文件中设置的横向.
android:screenOrientation="landscape"
Run Code Online (Sandbox Code Playgroud)
此外,我在横向上持有设备,所以一切(布局,视图等)都是横向模式,正如我想要的那样.但只有当我以纵向方式握住设备时,它才能为我提供所需的价值.
我修改了一些来自互联网的代码,它适用于HTC 3d EVO,Nexus 7和三星Galaxy S3,但不适用于Galaxy Tablet 10".
我找到了这篇文章. Android方向传感器对于不同设备有何不同? 接受的答案建议使用getRotation()和remapCoordinateSystem()方法,但不提及如何使用.
这就是我的结局.
SensorManager.getRotationMatrix(Rmat, Imat, gData, mData);
SensorManager.remapCoordinateSystem(Rmat, SensorManager.AXIS_Y, SensorManager.AXIS_MINUS_X, R2);
// Orientation isn't as useful as a rotation matrix, but
// we'll show it here anyway.
SensorManager.getOrientation(R2, orientation);
float incl = SensorManager.getInclination(Imat);
FontTextView pitchText = (FontTextView)findViewById(R.id.pitch_text);
if((int)(orientation[1]*90) <= -110 && !newQuestionIsActive) {
newQuestionIsActive = true;
pitchText.setText("Bring new question");
}
else if(Math.abs((int)(orientation[2]*90)) <= 200 && (int)(orientation[1]*90) >= -30 && newQuestionIsActive) {
newQuestionIsActive = false;
pitchText.setText("Not Correct!");
}
else if(Math.abs((int)(orientation[2]*90)) …
Run Code Online (Sandbox Code Playgroud) 我正在尝试将admob功能添加到我的应用程序中.我做了一切,但我错过了一些关键点.
这是我的评价:
apply plugin: 'android'
android {
compileSdkVersion 19
buildToolsVersion '19.0.1'
defaultConfig {
minSdkVersion 13
targetSdkVersion 19
versionCode 1
versionName "1.0"
}
buildTypes {
release {
runProguard false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard- rules.txt'
}
}
}
dependencies {
compile 'com.android.support:appcompat-v7:+'
compile 'com.google.android.gms:play-services:+'
compile fileTree(dir: 'libs', include: ['*.jar', '*.aar'])
}
Run Code Online (Sandbox Code Playgroud)
这是广告视图的XML布局部分
`<com.google.ads.AdView
xmlns:ads="http://schemas.android.com/apk/lib/com.google.ads"
android:id="@+id/adView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
ads:adUnitId="ca-app-pub-8644867804576560/1489221139"
ads:adSize="SMART_BANNER"
ads:testDevices="*******50664**2"
ads:loadAdOnCreate="true"/>`
Run Code Online (Sandbox Code Playgroud)
这些元标记和必要的权限将添加到Manifest.xml中
<meta-data android:name="com.google.android.gms.version"
android:value="@integer/google_play_services_version"/>
<activity android:name="com.google.android.gms.ads.AdActivity"
android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|uiMode|screenSize|smallestScreenSize"/>
Run Code Online (Sandbox Code Playgroud)
最后这是崩溃时刻的logcat.
02-16 12:50:31.941 8898-8898/com.exampl.deneme E/AndroidRuntime? FATAL EXCEPTION: main
java.lang.RuntimeException: Unable to start activity ComponentInfo{com.exampl.deneme/com.exampl.deneme.MainActivity}: android.view.InflateException: …
Run Code Online (Sandbox Code Playgroud) 我刚开始使用Eclipse Mars作为开发环境.我曾经在旧的eclipse版本中安装了jd-eclipse反编译器.当我尝试为这个插件安装相同的插件时,我做不到.
我需要在eclipse中使用反编译器,希望有人提出解决方案.
谢谢.
android ×4
admob ×1
background ×1
decompiler ×1
eclipse-mars ×1
html ×1
java ×1
menuitem ×1
orientation ×1
permissions ×1
python ×1
selector ×1
sqlite ×1