我添加了一个选项,为我的Android手机应用不同的主题.申请时,我正在启动异步任务.如果我在应用它时改变方向,我会得到一个错误,如下所示.
01-01 00:19:25.140: ERROR/AndroidRuntime(3553): FATAL EXCEPTION: main
01-01 00:19:25.140: ERROR/AndroidRuntime(3553): java.lang.RuntimeException: Unable to resume activity {com.android.settings/com.android.settings.ThemeSettingsActivity}: java.lang.RuntimeException: Failure delivering result ResultInfo{who=null, request=1, result=-1, data=null} to activity {com.android.settings/com.android.settings.ThemeSettingsActivity}: java.lang.NullPointerException
01-01 00:19:25.140: ERROR/AndroidRuntime(3553): at android.app.ActivityThread.performResumeActivity(ActivityThread.java:2471)
01-01 00:19:25.140: ERROR/AndroidRuntime(3553): at android.app.ActivityThread.handleResumeActivity(ActivityThread.java:2499)
01-01 00:19:25.140: ERROR/AndroidRuntime(3553): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1994)
01-01 00:19:25.140: ERROR/AndroidRuntime(3553): at android.app.ActivityThread.handleRelaunchActivity(ActivityThread.java:3375)
01-01 00:19:25.140: ERROR/AndroidRuntime(3553): at android.app.ActivityThread.access$700(ActivityThread.java:125)
01-01 00:19:25.140: ERROR/AndroidRuntime(3553): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1153)
01-01 00:19:25.140: ERROR/AndroidRuntime(3553): at android.os.Handler.dispatchMessage(Handler.java:99)
01-01 00:19:25.140: ERROR/AndroidRuntime(3553): at android.os.Looper.loop(Looper.java:137)
01-01 00:19:25.140: ERROR/AndroidRuntime(3553): at android.app.ActivityThread.main(ActivityThread.java:4368)
01-01 00:19:25.140: ERROR/AndroidRuntime(3553): at java.lang.reflect.Method.invokeNative(Native Method)
01-01 …Run Code Online (Sandbox Code Playgroud) 这是在一次采访中向我提出的问题.
如果Vtable是在编译时创建的,并且vptr在运行时被分配给对象,那么如果我们的类中有虚拟构造函数,那么为什么编译器会给出编译时错误?
我解释了整个机制.但是他对' 为什么编译时错误而不是运行时错误 ' 更感兴趣
我告诉他,C++指南是用来编写的,因此编译器会在编译时发送错误.
能否请你告诉我同样的原因
当我点击时,我在*行之间的行处不断获得空指针异常.我一直在看它大约一个小时,似乎无法找出原因.任何帮助将不胜感激.谢谢.
private Color currentColor;
private char currentChar;
private Letter letter;
private JComboBox comboBox;
private JPanel controlPanel;
private Color[] colorArray = {Color.black,Color.blue,Color.cyan,Color.orange,Color.white,Color.yellow};
private String[] colorStringArray = {"black","blue","cyan","orange","white","yellow"};
private ArrayList<Letter> letterList;
private JButton button1;
private Canvas canvas;
public WholePanel()
{
comboBox = new JComboBox(colorStringArray);
// here we use black to draw a letter
currentColor = colorArray[Color.black];
// set the default character to 'A'
currentChar = 'A';
button1 = new JButton("Undo");
controlPanel = new JPanel();
controlPanel.add(button1);
controlPanel.add(comboBox);
canvas = new Canvas();
JSplitPane sp …Run Code Online (Sandbox Code Playgroud) 我正在使用StreamGobbler来消耗进程的输出.
InputStreamReader isr = new InputStreamReader(is);
BufferedReader br = new BufferedReader(isr);
String line = null;
int count = 0;
while ( (line = br.readLine()) != null);
{
if(line == null){
System.out.println("This shouldn't print out.");
}
}
Run Code Online (Sandbox Code Playgroud)
我认为字符串"这不应该打印出来"很明显.不应该打印出来,但确实如此.我不知道提供什么进一步的数据.
我有以下两个矩阵:
fuzzySet
255 7 7
255 7 7
255 7 7
Run Code Online (Sandbox Code Playgroud)
membershipMatrix
2.881749158360024e-04 0.999999819474077 0.904200609951489
0.0336048930092375 0.517034652401936 0.847219463816453
2.881749158360024e-04 0.999999819474077 0.904200609951489
Run Code Online (Sandbox Code Playgroud)
当我尝试运行此代码部分时:
tolerance = 0.01;
core = double(fuzzySet.*(abs(membershipMatrix-1) <= tolerance)) + membershipMatrix.*(membershipMatrix.*(abs(membershipMatrix-1) > tolerance););
Run Code Online (Sandbox Code Playgroud)
我收到以下错误:
??? Error using ==> times
Integers can only be combined with integers of the same class, or scalar doubles.
Error in ==> fs at 36
core = fuzzySet.*(abs(membershipMatrix-1) <= tolerance) +
membershipMatrix.*(membershipMatrix > tolerance);
Run Code Online (Sandbox Code Playgroud)
我该如何解决这个错误?
谢谢.
#include <stack>
#include <functional>
int main()
{
std::stack<std::function<int()>> s;
s.push(main);
return s.top()();
}
Run Code Online (Sandbox Code Playgroud)
我得到以下诊断:
result: runtime error time: 0.04s memory: 39704 kB signal: 11 (SIGSEGV)
Run Code Online (Sandbox Code Playgroud)
这里发生了什么?
我正在开发一个基于OSGI(Equinox)的系统,我遇到了JavaFX,我正在尝试e(fx)clipse {OSGI包项目},我写了一个简单的测试项目,但它给了我一些编译错误.我有一个主要课程:
import java.io.IOException;
import javafx.application.Application;
import javafx.fxml.FXMLLoader;
import javafx.scene.Scene;
import javafx.stage.Stage;
public class main extends Application {
private static main _main ;
public main () {
_main = this;
}
public static main Get_Main(){
return _main;
}
@Override
public void start(Stage primaryStage)
{
try
{
FXMLLoader loader = new FXMLLoader();
loader.setLocation(main.class.getResource("fxml.fxml"));
primaryStage.setScene(new Scene(loader.load()));
}
catch (IOException e)
{
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}
Run Code Online (Sandbox Code Playgroud)
我有一个FXML控制器
import javafx.event.EventHandler;
import javafx.fxml.FXML;
import javafx.scene.control.Button;
import javafx.scene.input.MouseEvent;
import javafx.scene.layout.AnchorPane;
public …Run Code Online (Sandbox Code Playgroud) 我知道其他问题也被提出同样的错误,但它并没有接近我所拥有的.我试图通过循环(实验室值更改)找到可以在B列中多次找到变量lab的值的行,它第一次工作但第二次出现此错误.
For Each lab In arr
NFD = el & " " & Sheets("Sheet1").Cells(1, 3).value
If SheetExists(NFD) Then
Worksheets(NFD).Activate
Dim FindRow As Range
Dim FindRowNumber As Long
Set FindRow = Sheets(NFD).Range("B:B").Find(What:=lab, LookIn:=xlValues)
FindRowNumber = FindRow.Row 'error on this line
MsgBox FindRowNumber
End If
Next
Run Code Online (Sandbox Code Playgroud)
EDIT1:如果有人有兴趣,这是工作代码:
For Each lab In arr
If lab <> "" Then
lab = Trim(lab)
'Find element Sheet
NFD = el & " " & Sheets("Sheet1").Cells(1, 3).value
If SheetExists(NFD) Then
'Find lab number row in colunm B …Run Code Online (Sandbox Code Playgroud) 我没有找到该程序的正确输出.它给出了运行时错误.
#include <stdio.h>
int main()
{
int c = 5, no = 10;
do {
no /= c;
} while(c--);
printf ("%d\n", no);
return 0;
}
Run Code Online (Sandbox Code Playgroud) 我正在尝试获取数组中某些字符的位置.我在下面使用此代码,但在我输入两个字符后,我遇到了运行时错误.
#include <stdio.h>
#include <stdlib.h>
#include <conio.h>
int main()
{
char board [8][8]={{0}};
char kr,kc,qr,qc,nr,nc;
unsigned char i,j;
for (i = 0; i < 8 ;i++)
{
for (j = 'A'; j <= 'H'; j++)
{
board[i][j] = getche();
}
}
for (i = 0; i < 8 ;i++)
{
for (j = 0; j < 9; j++)
{
if (board[i][j] == 'K')
{
kr = i;
kc = j;
}
else if (board[i][j] == 'Q')
{
qr = i; …Run Code Online (Sandbox Code Playgroud)