我正在尝试访问ACCESS_FINE_LOCATION,如果找不到访问权限ACCESS_COARSE_LOCATION.所以我要求获得这2个权限,但是他们给了我相同的对话框,要求获得位置许可.我知道这些都属于同一组,但谷歌说:
注意:即使用户已在同一组中授予了其他权限,您的应用仍需要明确请求其所需的每个权限.此外,将权限分组到组中可能会在将来的Android版本中发生变化.您的代码不应该依赖于特定权限属于或不属于同一组的假设.
这意味着我要求在一秒内获得这2个权限,这会导致连续2个对话框.这对我来说似乎不太友好.有没有更好的办法?
我在android中使用Facebook sdk 4.4.0,我希望使用图形请求获取用户的当前个人资料图片.怎么做?
我见过人们用
https://graph.facebook.com/me/picture?access_token=ACCESS_TOKEN
用于提取个人资料图片的API,但我无法想象如何从中提取个人资料图片.
对于文档Fragment.getContext()说,
返回Fragment当前与之关联的上下文.
它是在api 23中引入的 http://developer.android.com/reference/android/app/Fragment.html#getContext()
这是Application或Activity Context?
我使用以下许可从我的应用程序拨打电话
< uses-permission android:name="android.permission.CALL_PHONE" />
Run Code Online (Sandbox Code Playgroud)
这是我打电话的代码.
Intent iniCall=new Intent(Intent.ACTION_CALL);
iniCall.setData(Uri.parse("tel:9849199291");
startActivity(iniCall);
Run Code Online (Sandbox Code Playgroud)
但它启动Skype应用程序而不是启动默认呼叫应用程序.
如何从默认调用应用程序调用?
我正面临一个与SQLiteDatabase申请有关的问题.应用程序没有崩溃.这是我在Logcat中收到的日志.
D/SQLiteDatabase:dispose database false
java.lang.Throwable: stacktrace
at android.database.sqlite.SQLiteDatabase.dispose(SQLiteDatabase.java:286)
at android.database.sqlite.SQLiteDatabase.onAllReferencesReleased(SQLiteDatabase.java:280)
at android.database.sqlite.SQLiteClosable.releaseReference(SQLiteClosable.java:74)
at android.database.sqlite.SQLiteClosable.close(SQLiteClosable.java:106)
at com.demo.model.SQLiteManager.close(SQLiteManager.java:74)
at com.demo.ui.ContactFragment$ContactListAdapter.fetchContactData(ContactFragment.java:295)
at com.demo.ui.ContactFragment$ContactListAdapter.<init>(ContactFragment.java:336)
at com.demo.ui.ContactFragment$4.onQueryTextChange(ContactFragment.java:224)
at android.support.v7.widget.SearchView.onTextChanged(SearchView.java:1150)
at android.support.v7.widget.SearchView.access$2000(SearchView.java:103)
at android.support.v7.widget.SearchView$12.onTextChanged(SearchView.java:1680)
at android.widget.TextView.sendOnTextChanged(TextView.java:8340)
at android.widget.TextView.setText(TextView.java:4413)
at android.widget.TextView.setText(TextView.java:4252)
at android.widget.EditText.setText(EditText.java:90)
at android.widget.TextView.setText(TextView.java:4227)
at android.support.v7.widget.SearchView.setQuery(SearchView.java:585)
at com.demo.ui.ContactFragment.onPause(ContactFragment.java:153)
at android.support.v4.app.Fragment.performPause(Fragment.java:2139)
at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1117)
at android.support.v4.app.FragmentManagerImpl.detachFragment(FragmentManager.java:1408)
at android.support.v4.app.BackStackRecord.run(BackStackRecord.java:727)
at android.support.v4.app.FragmentManagerImpl.execPendingActions(FragmentManager.java:1617)
at android.support.v4.app.FragmentManagerImpl.executePendingTransactions(FragmentManager.java:570)
at android.support.v4.app.FragmentPagerAdapter.finishUpdate(FragmentPagerAdapter.java:141)
at android.support.v4.view.ViewPager.populate(ViewPager.java:1177)
at android.support.v4.view.ViewPager.populate(ViewPager.java:1025)
at android.support.v4.view.ViewPager$3.run(ViewPager.java:254)
at android.view.Choreographer$CallbackRecord.run(Choreographer.java:912)
at android.view.Choreographer.doCallbacks(Choreographer.java:714)
at android.view.Choreographer.doFrame(Choreographer.java:646)
at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:898)
at android.os.Handler.handleCallback(Handler.java:815)
at android.os.Handler.dispatchMessage(Handler.java:104)
at android.os.Looper.loop(Looper.java:207)
at android.app.ActivityThread.main(ActivityThread.java:5769) …Run Code Online (Sandbox Code Playgroud) 你怎么知道是否使用
android.text.InputType.TYPE_TEXT_VARIATION_WEB_PASSWORD或android.text.InputType.TYPE_TEXT_VARIATION_PASSWORD?
文件TYPE_TEXT_VARIATION_WEB_PASSWORD:
TYPE_CLASS_TEXT的变化:在Web表单内输入密码.这是在HONEYCOMB中添加的.IME必须以此API版本或更高版本为目标才能看到此输入类型; 如果没有,当通过EditorInfo.makeCompatible(int)传递时,对此类型的请求将被视为TYPE_TEXT_VARIATION_PASSWORD.
文件TYPE_TEXT_VARIATION_PASSWORD:
TYPE_CLASS_TEXT的变化:输入密码.
在哪种情况下,表格被视为"网络表格"?两者之间的行为有什么不同吗?(视觉上和/或逻辑上)
目前我已经在Play商店和我正在使用的项目中发布了我的应用程序
compile 'com.google.android.gms:play-services:7.0.0'
Run Code Online (Sandbox Code Playgroud)
Google Play服务库版本,7.0用于在我的项目中使用Google云消息传递实施推送通知.
Google Play服务库版本7.0使用旧的注册程序使用register()方法
GoogleCloudMessaging.register(SENDER_ID);
Run Code Online (Sandbox Code Playgroud)
但Googel文档说.
GCM register()自2015年5月28日起不再使用.新的应用开发应使用Instance ID API来处理注册令牌的创建,轮换和更新
InstanceID API包含在Google Play服务版本中,7.5因此我必须迁移7.0到7.5或更多.但是应用程序已经在使用GCM register()方法的游戏商店.
我是指这个链接,解释如何使用InstanceID,但我找不到任何迁移向导从迁移GCM register()到InstanceID
那么如何从GCM register()方法迁移到InstanceID API?
任何帮助将不胜感激.
目前我有用于收听呼叫状态事件的广播接收器.我已经注册了Broadcast Receiver,AndroidManifest.xml如下所示.
<receiver android:name=".api.PhoneCallReceiver">
<intent-filter>
<action android:name="android.intent.action.PHONE_STATE" />
</intent-filter>
</receiver>
Run Code Online (Sandbox Code Playgroud)
当应用程序启动时,此广播接收器已注册为侦听状态事件,并且根据CALL_STATE我正在管理我的应用程序.
手机重启后工作正常.手机重启后,此广播接收器停止工作.我知道我必须为BOOT_COMPLETED系统的监听事件注册接收器.
我所做的如下所示:
<receiver android:name=".api.PhoneCallReceiver">
<intent-filter>
<action android:name="android.intent.action.PHONE_STATE" />
</intent-filter>
<intent-filter>
<action android:name="android.intent.action.BOOT_COMPLETED" />
</intent-filter>
</receiver>
Run Code Online (Sandbox Code Playgroud)
我还给出了获取BOOT_COMPLETED系统事件的权限.
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
Run Code Online (Sandbox Code Playgroud)
但不知怎的,它不起作用.我正在考虑制作只听BOOT_COMPLETED事件的新广播接收器,但问题就在于此
所以我的问题是,当有来电时我怎么能启动这个电话呼叫监听器广播接收器?
如何从另一个广播接收器注册广播接收器
我是否必须将现有的广播接收器代码移至服务中,以便我可以从Boot Receiver启动服务?
任何帮助将不胜感激.
我将数据传递给捆绑中的某个片段,并在接收时抛出异常。恢复 Fragment 状态时会发生此错误。
调用createFromParcel时,Intrinsics.checkParameterIsNotNull中发生错误。模型中所有不可为空的字段都会发生这种情况。
Caused by java.lang.IllegalArgumentException: Parameter specified as non-null is null: method kotlin.jvm.b.h.b, parameter realtorImageUrl
at com.android.app.ui.common.model.Property.(Unknown Source:16)
at com.android.app.ui.common.model.Property$Creator.createFromParcel(Unknown Source:637)
at android.os.Parcel.readParcelable(Parcel.java:2797)
at android.os.Parcel.readValue(Parcel.java:2691)
at android.os.Parcel.readArrayMapInternal(Parcel.java:3058)
at android.os.BaseBundle.unparcel(BaseBundle.java:257)
at android.os.BaseBundle.getInt(BaseBundle.java:961)
at me.yokeyword.fragmentation.SupportFragmentDelegate.onCreate(SourceFile:93)
at me.yokeyword.fragmentation.SupportFragment.onCreate(SourceFile:48)
at android.support.v4.app.Fragment.performCreate(SourceFile:2331)
at android.support.v4.app.FragmentManagerImpl.moveToState(SourceFile:1386)
at android.support.v4.app.FragmentManagerImpl.moveFragmentToExpectedState(SourceFile:1759)
at android.support.v4.app.FragmentManagerImpl.moveToState(SourceFile:1827)
at android.support.v4.app.FragmentManagerImpl.dispatchStateChange(SourceFile:3244)
at android.support.v4.app.FragmentManagerImpl.dispatchCreate(SourceFile:3194)
at android.support.v4.app.Fragment.restoreChildFragmentState(SourceFile:1444)
at android.support.v4.app.Fragment.onCreate(SourceFile:1415)
at me.yokeyword.fragmentation.SupportFragment.onCreate(SourceFile:47)
at android.support.v4.app.Fragment.performCreate(SourceFile:2331)
at android.support.v4.app.FragmentManagerImpl.moveToState(SourceFile:1386)
at android.support.v4.app.FragmentManagerImpl.moveFragmentToExpectedState(SourceFile:1759)
at android.support.v4.app.FragmentManagerImpl.moveToState(SourceFile:1827)
at android.support.v4.app.FragmentManagerImpl.dispatchStateChange(SourceFile:3244)
at android.support.v4.app.FragmentManagerImpl.dispatchCreate(SourceFile:3194)
at android.support.v4.app.FragmentController.dispatchCreate(SourceFile:184)
at android.support.v4.app.FragmentActivity.onCreate(SourceFile:355)
at android.support.v7.app.AppCompatActivity.onCreate(SourceFile:84)
at me.yokeyword.fragmentation.SupportActivity.onCreate(SourceFile:38)
at …Run Code Online (Sandbox Code Playgroud) 我在Lollipop之前的设备上有错误的按钮样式.
使用appcompat库进行编译.
编译'com.android.support:appcompat-v7:23.0.1'
价值观/ styles.xml
<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
<item name="colorPrimary">@android:color/holo_orange_light</item>
<item name="colorPrimaryDark">@android:color/holo_orange_dark</item>
<item name="colorAccent">@android:color/holo_green_light</item>
<item name="colorControlNormal">@android:color/holo_purple</item>
<item name="colorControlHighlight">@android:color/holo_red_light</item>
<item name="colorButtonNormal">@android:color/holo_green_light</item>
<item name="android:buttonStyle">@style/ButtonTheme</item>
</style>
<style name="ButtonTheme" parent="android:Widget.Button">
<item name="android:textColor">@android:color/white</item>
<item name="android:textAllCaps">true</item>
<item name="android:drawablePadding">10dp</item>
<item name="android:padding">10dp</item>
</style>
Run Code Online (Sandbox Code Playgroud)
V21/styles.xml
<?xml version="1.0" encoding="utf-8"?>
<resources>
<style name="ButtonTheme" parent="android:Widget.Material.Button">
<item name="android:textColor">@android:color/white</item>
<item name="android:textAllCaps">true</item>
<item name="android:drawablePadding">10dp</item>
<item name="android:padding">10dp</item>
</style>
</resources>
Run Code Online (Sandbox Code Playgroud)
在ISC上添加xml的"新按钮"没有样式textColor和drawablePadding.你有什么想法来改正吗?