我遇到了麻烦,findViewByid但我找不到问题所在.
这是我的FirstFragment班级代码:
import android.app.Fragment;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.webkit.WebSettings;
import android.webkit.WebView;
import android.widget.ArrayAdapter;
import android.widget.ListView;
import android.widget.ProgressBar;
import java.util.ArrayList;
import java.util.List;
public class FirstFragment extends Fragment {
public static final String TAG = "first";
private WebView mWebView;
ProgressBar progressBar;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
mWebView = (WebView) findViewById(R.id.activity_main_webview);
progressBar = (ProgressBar) findViewById(R.id.progressBar1);
WebSettings webSettings = mWebView.getSettings();
webSettings.setJavaScriptEnabled(true);
mWebView.loadUrl("http://www.google.com");
}
@Nullable
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, …Run Code Online (Sandbox Code Playgroud) 正确代码:
class MainActHandler(val weakActivity: WeakReference<Activity>): Handler() {
override fun handleMessage(msg: Message?) {
val trueAct = weakActivity.get() ?: return
if (msg?.what == ConversationMgr.MSG_WHAT_NEW_SENTENCE){
val sentence = msg.obj as String?
trueAct.conversation.text = sentence
}
super.handleMessage(msg)
}
}
Run Code Online (Sandbox Code Playgroud)
无法解析代码:
class MainActHandler(weakActivity: WeakReference<Activity>): Handler() {
override fun handleMessage(msg: Message?) {
val trueAct = weakActivity.get() ?: return
if (msg?.what == ConversationMgr.MSG_WHAT_NEW_SENTENCE){
val sentence = msg.obj as String?
trueAct.conversation.text = sentence
}
super.handleMessage(msg)
}
}
Run Code Online (Sandbox Code Playgroud)
唯一的区别是"val"已被删除,无法解决.
这可能很重要,因为它是一个内在阶级.
但
构造函数参数中没有"val/var"的这一个类正在工作:
class BookInfo(convrMgr: ConversationMgr, id: String, queue: …Run Code Online (Sandbox Code Playgroud) 应用程序运行正常,直到1小时后.突然它开始卡在开头,并在logcat中显示1行错误消息
08-31 15:57:54.924 31700-31700/? E/com.facebook.internal.AttributionIdentifiers: getAttributionIdentifiers should not be called from the main thread
Run Code Online (Sandbox Code Playgroud)
这是唯一显示的日志.应用程序没有发生任何变化
在Gradle中运行时显示错误错误:
错误:任务':app:transformClassesWithInstantRunForDebug'的执行失败.
意外输入:ImmutableJarInput {name = com.google.android.gms:play-services-basement:9.0.0,file =/home/nawaf/AndroidStudioProjects/YugiohDeckBuilder/app/build/intermediates/transforms/profilers-transform/debug/43.jar,contentTypes = CLASSES,scopes = EXTERNAL_LIBRARIES,status = REMOVED},ImmutableJarInput {name = com.google.firebase:firebase-analytics:9.0.0,file =/home/nawaf/AndroidStudioProjects/YugiohDeckBuilder/app/build/intermediates/transforms/profilers-transform/debug/37.jar,contentTypes = CLASSES,scopes = EXTERNAL_LIBRARIES,status = REMOVED},ImmutableJarInput {name = com.google.android.gms:play-services-base:9.0.0,file =/home/nawaf/AndroidStudioProjects/YugiohDeckBuilder/app/build/intermediates/transforms/profilers-transform/debug/39.jar,contentTypes = CLASSES,scopes = EXTERNAL_LIBRARIES,status = REMOVED},ImmutableJarInput {name = com.google.firebase :firebase-common:9.0.0,file =/home/nawaf/AndroidStudioProjects/YugiohDeckBuilder/app/build/intermediates/transforms/profilers-transform/debug/41.j ar,contentTypes = CLASSES,scopes = EXTERNAL_LIBRARIES,status = REMOVED},ImmutableJarInput {name = com.google.firebase:firebase-core:9.0.0,file =/home/nawaf/AndroidStudioProjects/YugiohDeckBuilder/app/build/intermediates/transforms/profilers-transform/debug/36.jar,contentTypes = CLASSES,scopes = EXTERNAL_LIBRARIES,status = REMOVED},ImmutableJarInput {name = com.google.android.gms:play-services-tasks:9.0.0,file =/home/nawaf/AndroidStudioProjects/YugiohDeckBuilder/app/build/intermediates/transforms/profilers-transform/debug/42.jar,contentTypes = CLASSES,scopes = EXTERNAL_LIBRARIES,status = REMOVED},ImmutableJarInput {name = com.google.firebase:firebase -analytics-impl:9.0.0,file =/home/nawaf/AndroidStudioProjects/YugiohDeckBuilder/app/build/intermediates/transforms/profilers-transform/debug/38.jar,contentTypes = CLASSES,scopes = EXTERNAL_LIBRARIES,status = REMOVED} ,ImmutableJarInput {name = com.google.firebase:firebase-iid:9.0.0,file …
如何配置flutter sdk?如何定位扑动sdk?我不知道sdk文件的位置

我正在尝试实现类似于真正的来电者的应用程序,当电话响铃使用广播接收器并打开MyCustomDialog活动时,我能够获取电话号码
这是我的接收器类,通过它我可以获得呼叫开始或结束的呼叫状态.在这里,我制作了一些我在CallReceiver.java中使用的 方法
PhonecallReceiver.java
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.telephony.TelephonyManager;
import java.util.Date;
public abstract class PhonecallReceiver extends BroadcastReceiver
{
private static int lastState = TelephonyManager.CALL_STATE_IDLE;
private static Date callStartTime;
private static boolean isIncoming;
private static String savedNumber;
@Override
public void onReceive(Context context, Intent intent)
{
try
{
if (intent.getAction().equals("android.intent.action.NEW_OUTGOING_CALL"))
{
savedNumber = intent.getExtras().getString("android.intent.extra.PHONE_NUMBER");
}
else
{
String stateStr = intent.getExtras().getString(TelephonyManager.EXTRA_STATE);
String number = intent.getExtras().getString(TelephonyManager.EXTRA_INCOMING_NUMBER);
int state = 0;
if(stateStr.equals(TelephonyManager.EXTRA_STATE_IDLE))
{
state = TelephonyManager.CALL_STATE_IDLE;
}
else if(stateStr.equals(TelephonyManager.EXTRA_STATE_OFFHOOK)) …Run Code Online (Sandbox Code Playgroud) 我有一个类实体如下
@Entity
public class Task {
private String name;
private Integer ParentId;
private Integer userId;
@Ignore
private int noOfSubTask;
}
Run Code Online (Sandbox Code Playgroud)
在DAO类中有一个方法getTaskList()
@Dao
public interface TaskDao extends Dao<Task> {
@Query("SELECT *,(SELECT count(*) FROM Task b WHERE a._id = b.ParentId ) AS noOfSubTask FROM Task a ")
LiveData<List<Task>> getTaskList();
}
Run Code Online (Sandbox Code Playgroud)
我想用noOfSubTask填充由(SELECT count(*)FROM Task b WHERE a._id = b.ParentId)部分查询给出的数字,但问题是它不是一列,所以房间库不会映射它getTaskList方法in dao实现(自动生成)类.
有没有办法用dao类房间库的任何方法来填充实体的非列字段(比如我的情况下的noOfSubTask)?
java sqlite android android-room android-architecture-components
我已经按照迁移到android studio 3.0升级的步骤进行了操作.
的build.gradle
flavorDimensions 'dimensionless'
Run Code Online (Sandbox Code Playgroud)
D:\ R\merchant\projapp\popuplibrary\build\intermediates\bundles\debug\res\values\values.xml错误:(28,5)错误:未找到样式属性'@android:attr/windowEnterAnimation'.
C:\ Users\user.gradle\caches\transforms-1\files-1.1\appcompat-v7-25.3.1.aar\f7bb6db2aa55d14683d1c9ddd8d49e03\res\values\values.xml错误:java.util.concurrent.ExecutionException:com. android.tools.aapt2.Aapt2Exception:AAPT2错误:检查日志以获取详细信息
错误:任务执行失败':popuplibrary:processDebugAndroidTestResources'.无法执行aapt
面对同样的问题,但是apccompat库也在我的案例中创建问题.
找不到样式属性'@android:attr/windowEnterAnimation'
gradlewrapper:
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-4.1-all.zip
Run Code Online (Sandbox Code Playgroud)
build.gradle app:
productFlavors {
dev {
applicationIdSuffix '.dev'
versionName "1.0"
versionNameSuffix '-dev'
}
qa {
applicationIdSuffix '.qa'
versionName "1.0"
versionNameSuffix '-qa'
}
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
compile 'com.android.support:appcompat-v7:25.3.1'
compile 'com.android.support:design:25.3.1'
compile 'com.android.support:cardview-v7:25.3.1'
compile 'com.android.support.constraint:constraint-layout:1.0.2'
testCompile 'junit:junit:4.12'
//Butter Knife
compile 'com.jakewharton:butterknife:8.7.0'
annotationProcessor 'com.jakewharton:butterknife-compiler:8.7.0'
compile project(':popuplibrary')
}
Run Code Online (Sandbox Code Playgroud) 我有我的应用程序的Android版本,并将FAN集成到我的应用程序中.它工作了几个月,但现在它显示" 没有填充 "
Error Domain=com.facebook.ads.sdk Code=**1001 "No fill"**
UserInfo={NSLocalizedDescription=**No fill**,
FBAdErrorDetailKey={ msg = "**No fill**"}}
Run Code Online (Sandbox Code Playgroud)
并且没有显示FAN广告.如果我输入了测试ID,那么它就会显示,但仅限于我的设备,而不是其他设备.
如何解决这个问题"No Fill"?
compile 'com.facebook.android:audience-network-sdk:4.+'
Run Code Online (Sandbox Code Playgroud)
在build.gradle中提到我已经看到很多关于此的问题,但无法找到答案.
我已经在下面看到了链接:
我试图改变ListPreference的弹出对话框的样式,就像我在这个答案中看到的那样.例如,我想要对话框使用不同的背景颜色.
到目前为止,我尝试将自定义样式应用于:
<item name="android:dialogTheme">@style/AlertDialogStyle</item>
<item name="android:alertDialogTheme">@style/AlertDialogStyle</item>
<item name="android:alertDialogStyle">@style/AlertDialogStyle</item>
<item name="android:dialogPreferenceStyle">@style/AlertDialogStyle</item>
<style name="AlertDialogStyle" parent="AlertDialog.AppCompat">
<item name="colorPrimary">@color/colorPrimary</item>
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
<item name="colorAccent">@color/colorAccent</item>
<item name="android:textColor">@color/lightGrey</item>
<item name="android:background">@color/cardBackground</item>
<item name="android:popupBackground">@color/cardBackground</item>
<item name="android:windowBackground">@color/cardBackground</item>
<item name="android:itemBackground">@color/cardBackground</item>
</style>
Run Code Online (Sandbox Code Playgroud)
但我的风格仍未应用/背景颜色不变.
这就是我的ListPreference的弹出对话框当前的样子:
这是我想要存档的颜色主题(基本上我用于其他对话框的主题相同):
要快速重现我的问题 - >我的项目是在github上
android ×9
facebook ×2
android-architecture-components ×1
android-room ×1
dart ×1
findviewbyid ×1
flutter ×1
java ×1
kotlin ×1
sqlite ×1