- android - 多次调用 OnPrimaryClipChangedListener
- android - 无法更新 RecyclerView 中的 TextView 字段
- android.database.CursorIndexOutOfBoundsException : Index 0 requested, 光标大小为 0
- android - 使用 AppCompat 时,我们是否需要明确指定其 UI 组件(Spinner、EditText)颜色
我正在尝试修改我的布局,但每当我使用图形布局时,它最终都会中断并给出如下所示的错误。我知道这不是问题,因为它在我撤消更改时有效。只有当我使用图形布局时。如果我使用 XML,它工作得很好。我知道它说它在我的 java 代码中,但切换 xml 布局不应导致此错误。第 294 行是 mEnergy = (ImageButton) view.findViewById(R.id.btnEnergy);
07-08 09:39:22.527: E/AndroidRuntime(22345): FATAL EXCEPTION: main
07-08 09:39:22.527: E/AndroidRuntime(22345): java.lang.ClassCastException: android.widget.ToggleButton cannot be cast to android.widget.ImageButton
07-08 09:39:22.527: E/AndroidRuntime(22345): at com.projectcaruso.naturalfamilyplaning.ChartingFragment.onCreateView(ChartingFragment.java:294)
07-08 09:39:22.527: E/AndroidRuntime(22345): at android.support.v4.app.Fragment.performCreateView(Fragment.java:1460)
07-08 09:39:22.527: E/AndroidRuntime(22345): at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:911)
07-08 09:39:22.527: E/AndroidRuntime(22345): at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1088)
07-08 09:39:22.527: E/AndroidRuntime(22345): at android.support.v4.app.BackStackRecord.run(BackStackRecord.java:682)
07-08 09:39:22.527: E/AndroidRuntime(22345): at android.support.v4.app.FragmentManagerImpl.execPendingActions(FragmentManager.java:1444)
07-08 09:39:22.527: E/AndroidRuntime(22345): at android.support.v4.app.FragmentManagerImpl$1.run(FragmentManager.java:429)
07-08 09:39:22.527: E/AndroidRuntime(22345): at android.os.Handler.handleCallback(Handler.java:615)
07-08 09:39:22.527: E/AndroidRuntime(22345): at android.os.Handler.dispatchMessage(Handler.java:92)
07-08 09:39:22.527: E/AndroidRuntime(22345): at android.os.Looper.loop(Looper.java:137)
07-08 09:39:22.527: E/AndroidRuntime(22345): at android.app.ActivityThread.main(ActivityThread.java:4950)
07-08 09:39:22.527: E/AndroidRuntime(22345): at java.lang.reflect.Method.invokeNative(Native Method)
07-08 09:39:22.527: E/AndroidRuntime(22345): at java.lang.reflect.Method.invoke(Method.java:511)
07-08 09:39:22.527: E/AndroidRuntime(22345): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1004)
07-08 09:39:22.527: E/AndroidRuntime(22345): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:771)
07-08 09:39:22.527: E/AndroidRuntime(22345): at dalvik.system.NativeStart.main(Native Method)
现在这里有一个在我使用图形布局来移动东西后不起作用的:
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="vertical" >
<RelativeLayout
android:id="@+id/charting"
android:layout_width="wrap_content"
android:layout_height="550dp" >
<TextView
android:id="@+id/header"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentRight="true"
android:layout_alignParentTop="true"
android:clickable="false"
android:gravity="center"
android:text="@string/charting_header"
android:textAppearance="?android:attr/textAppearanceLarge" />
<ImageButton
android:id="@+id/pickdate"
android:layout_width="50dp"
android:layout_height="50dp"
android:layout_alignBottom="@+id/dateselected"
android:layout_alignParentRight="true"
android:text="@string/date"
android:src="@drawable/calendar"
android:scaleType="centerInside"
android:background="#00000000" />
<EditText
android:id="@+id/dateselected"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_below="@+id/header"
android:layout_toLeftOf="@+id/pickdate"
android:clickable="false"
android:cursorVisible="false"
android:ems="10"
android:gravity="center"
android:inputType="date" />
<TextView
android:id="@+id/stamp"
android:layout_width="192dp"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_below="@+id/textView1"
android:layout_marginTop="14dp"
android:clickable="false"
android:ems="10"
android:textAppearance="?android:attr/textAppearanceMedium"
android:focusable="false"
android:focusableInTouchMode="false"
android:text="@string/stamp" />
<TextView
android:id="@+id/textView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentRight="true"
android:layout_below="@+id/pickdate"
android:layout_marginTop="17dp"
android:gravity="center"
android:text="@string/Methods"
android:textAppearance="?android:attr/textAppearanceLarge" />
<TextView
android:id="@+id/temp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_below="@+id/stamp"
android:clickable="false"
android:ems="10"
android:focusable="false"
android:textAppearance="?android:attr/textAppearanceMedium"
android:focusableInTouchMode="false"
android:text="@string/temp"
android:paddingTop="10sp" />
<ImageButton
android:id="@+id/btnstamp"
android:layout_width="50dp"
android:layout_height="50dp"
android:layout_alignParentRight="true"
android:layout_below="@+id/textView1"
android:adjustViewBounds="true"
android:scaleType="centerInside"
android:contentDescription="@string/stampval"
android:src="@drawable/observation"
android:background="#00000000" />
<TextView
android:id="@+id/textView2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentRight="true"
android:layout_below="@+id/EditText03"
android:layout_marginTop="14dp"
android:gravity="center"
android:text="@string/Body"
android:textAppearance="?android:attr/textAppearanceLarge" />
<CheckBox
android:id="@+id/chkFertile"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignLeft="@+id/tempvalue"
android:layout_below="@+id/tempvalue"
android:layout_alignBaseline="@+id/fertile"/>
<ToggleButton
android:id="@+id/btnIntercorse"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignTop="@+id/btnMood"
android:layout_alignParentLeft="true"
android:text="@string/Intercourse"
android:background="@drawable/intercorse_button"
android:paddingTop="25sp"
android:textOff=""
android:textOn="" />
<ToggleButton
android:id="@+id/btnHeadache"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignTop="@+id/btnMood"
android:layout_alignRight="@+id/measurecervix"
android:text="@string/headache"
android:background="@drawable/headache_button"
android:paddingTop="25sp"
android:textOff=""
android:textOn="" />
<ImageButton
android:id="@+id/btnEnergy"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/btnMood"
android:layout_centerHorizontal="true"
android:background="#00000000"
android:src="@drawable/energy"
android:text="@string/energy"
android:paddingTop="25sp" />
<ImageButton
android:id="@+id/btnMood"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_below="@+id/textView2"
android:layout_marginTop="27dp"
android:background="#00000000"
android:padding="7sp"
android:paddingTop="25sp"
android:src="@drawable/mood"
android:text="@string/mood" />
<ToggleButton
android:id="@+id/btnPeriod"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBottom="@+id/btnEnergy"
android:layout_alignLeft="@+id/btnIntercorse"
android:background="@drawable/period_button"
android:text="@string/period"
android:textOff=""
android:textOn="" />
<ToggleButton
android:id="@+id/btnTest"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBaseline="@+id/btnPeriod"
android:layout_alignBottom="@+id/btnPeriod"
android:layout_alignRight="@+id/measurecervix"
android:background="@drawable/pregnancy_button"
android:text="@string/pregnancytest"
android:textOff=""
android:textOn=""
android:paddingRight="50dp" />
<TextView
android:id="@+id/textView7"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignLeft="@+id/btnPeriod"
android:layout_alignRight="@+id/btnPeriod"
android:layout_below="@+id/btnPeriod"
android:gravity="center_horizontal"
android:text="@string/period"
android:textAppearance="?android:attr/textAppearanceSmall" />
<TextView
android:id="@+id/textView6"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBaseline="@+id/textView7"
android:layout_alignBottom="@+id/textView7"
android:layout_alignLeft="@+id/btnEnergy"
android:layout_alignRight="@+id/btnEnergy"
android:gravity="center_horizontal"
android:text="@string/energy"
android:textAppearance="?android:attr/textAppearanceSmall" />
<TextView
android:id="@+id/textView4"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/btnIntercorse"
android:layout_alignLeft="@+id/btnIntercorse"
android:gravity="center_horizontal"
android:text="@string/Intercourse"
android:textAppearance="?android:attr/textAppearanceSmall" />
<TextView
android:id="@+id/textView5"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBaseline="@+id/textView4"
android:layout_alignBottom="@+id/textView4"
android:layout_alignLeft="@+id/btnHeadache"
android:gravity="center_horizontal"
android:text="@string/headache"
android:textAppearance="?android:attr/textAppearanceSmall" />
<TextView
android:id="@+id/textView8"
android:layout_width="75dp"
android:layout_height="wrap_content"
android:layout_alignBaseline="@+id/textView7"
android:layout_alignBottom="@+id/textView7"
android:layout_alignParentRight="true"
android:gravity="center_horizontal"
android:text="@string/pregnancytest"
android:textAppearance="?android:attr/textAppearanceSmall" />
<TextView
android:id="@+id/fertile"
android:layout_width="160dp"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_below="@+id/temp"
android:clickable="false"
android:ems="10"
android:focusable="false"
android:focusableInTouchMode="false"
android:text="@string/fertile"
android:paddingTop="10sp"
android:textAppearance="?android:attr/textAppearanceMedium" />
<TextView
android:id="@+id/EditText03"
android:layout_width="75dp"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_below="@+id/fertile"
android:clickable="false"
android:ems="10"
android:focusable="false"
android:focusableInTouchMode="false"
android:text="@string/cervix"
android:paddingTop="10sp"
android:textAppearance="?android:attr/textAppearanceMedium" />
<EditText
android:id="@+id/measurecervix"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBaseline="@+id/EditText03"
android:layout_toRightOf="@+id/EditText03"
android:layout_alignLeft="@+id/tempvalue"
android:ems="10"
android:hint="@string/tempval"
android:inputType="number" >
</EditText>
<EditText
android:id="@+id/tempvalue"
android:layout_width="80dp"
android:layout_height="wrap_content"
android:layout_alignBaseline="@+id/temp"
android:layout_alignBottom="@+id/temp"
android:layout_alignRight="@+id/btnstamp"
android:ems="10"
android:hint="@string/tempval"
android:inputType="number" />
<TextView
android:id="@+id/textView3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignTop="@+id/textView4"
android:layout_centerHorizontal="true"
android:gravity="center_horizontal"
android:text="@string/mood"
android:textAppearance="?android:attr/textAppearanceSmall" />
</RelativeLayout>
<!-- Notes Field -->
<EditText
android:id="@+id/chartingnote"
android:layout_width="match_parent"
android:layout_height="150dip"
android:background="#C4C6CF"
android:ems="20"
android:gravity="top|center_horizontal"
android:hint="@string/hintNote"
android:inputType="textMultiLine" />
<!-- Update Button -->
<Button
android:id="@+id/chartingupdate"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="@string/charting_update" />
</LinearLayout>
</ScrollView>
Java:
public class ChartingFragment extends Fragment implements OnDateSetListener, OnClickListener {
SharedPreferences mPreferences;
Boolean symptothermal, mucus_stamps, fertile_infertile;
EditText sqlNotes, sqlDate, sqlTemperature, sqlmeasurecervix;
CheckBox sqlFertile;
int mood_selected, stamp_selected, energy_selected;
Button update;
ToggleButton mIntercorse, mPeriod, mHeadache, mTest;
ImageButton mMood, stamp, date, mEnergy;
private static final int ID_HAPPY = 1;
private static final int ID_SAD = 2;
private static final int ID_MAD = 3;
private static final int ID_CRY = 4;
private static final int ID_ARROUSED = 5;
private static final int ID_SLEEPY = 6;
private static final int _ID1 = 1;
private static final int _ID2 = 2;
private static final int _ID3 = 3;
private static final int _ID4 = 4;
private static final int _ID5 = 5;
private static final int _ID6 = 6;
private static final int _ID7 = 7;
private static final int _ID8 = 8;
private static final int _ID9 = 9;
private static final int _ID10 = 10;
private static final int _ID11 = 11;
private static final int _ID12 = 12;
private static final int _ID13 = 13;
private static final int _ID14 = 14;
private static final int _ID15 = 15;
URL SERVICE_URL;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
init();
}
private void init() {
mPreferences = PreferenceManager.getDefaultSharedPreferences(getActivity());
symptothermal = mPreferences.getBoolean("symptothermal", true);
mucus_stamps = mPreferences.getBoolean("mucus_stamps", true);
fertile_infertile = mPreferences.getBoolean("fertile_infertil", true);
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
View view;
view = setcontrolvisability(inflater);
update = (Button) view.findViewById(R.id.chartingupdate);
update.setOnClickListener(this);
date = (ImageButton) view.findViewById(R.id.pickdate);
date.setOnClickListener(this);
date.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
android.support.v4.app.FragmentTransaction ft = getFragmentManager().beginTransaction();
DialogFragment newFragment = new DatePickerDialogFragment(ChartingFragment.this);
newFragment.show(ft, "date_picker_dialog");
}
});
final QuickAction mQuickAction = new QuickAction(getActivity());
ActionItem happyItem = new ActionItem(ID_HAPPY, "Happy", getResources().getDrawable(R.drawable.emo_happy));
ActionItem sadtItem = new ActionItem(ID_SAD, "Sad", getResources().getDrawable(R.drawable.emo_sad));
ActionItem madItem = new ActionItem(ID_MAD, "Mad", getResources().getDrawable(R.drawable.emo_mad));
ActionItem cryItem = new ActionItem(ID_CRY, "Cry", getResources().getDrawable(R.drawable.emo_cry));
ActionItem arrousedItem = new ActionItem(ID_ARROUSED, "Arroused", getResources().getDrawable(R.drawable.emo_arroused));
ActionItem sleepyItem = new ActionItem(ID_SLEEPY, "Sleepy", getResources().getDrawable(R.drawable.emo_sleepy));
mQuickAction.addActionItem(happyItem);
mQuickAction.addActionItem(sadtItem);
mQuickAction.addActionItem(madItem);
mQuickAction.addActionItem(cryItem);
mQuickAction.addActionItem(arrousedItem);
mQuickAction.addActionItem(sleepyItem);
mMood = (ImageButton) view.findViewById(R.id.btnMood);
mMood.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
mQuickAction.show(v);
}
});
//setup the action item click listener
mQuickAction.setOnActionItemClickListener(new QuickAction.OnActionItemClickListener() {
@Override
public void onItemClick(QuickAction quickAction, int pos, int actionId) {
ActionItem actionItem = quickAction.getActionItem(pos);
mood_selected = actionItem.getActionId();
switch(mood_selected) {
case 1:
mMood.setImageResource(R.drawable.emo_happy);
break;
case 2:
mMood.setImageResource(R.drawable.emo_sad);
break;
case 3:
mMood.setImageResource(R.drawable.emo_mad);
break;
case 4:
mMood.setImageResource(R.drawable.emo_cry);
break;
case 5:
mMood.setImageResource(R.drawable.emo_arroused);
break;
case 6:
mMood.setImageResource(R.drawable.emo_sleepy);
break;
}
}
});
final QuickAction mQuickAction2 = new QuickAction(getActivity());
ActionItem observation1 = new ActionItem(_ID1, "", getResources().getDrawable(R.drawable.observation_1));
ActionItem observation2 = new ActionItem(_ID2, "", getResources().getDrawable(R.drawable.observation_2));
ActionItem observation3 = new ActionItem(_ID3, "", getResources().getDrawable(R.drawable.observation_3));
ActionItem observation4 = new ActionItem(_ID4, "", getResources().getDrawable(R.drawable.observation_4));
ActionItem observation5 = new ActionItem(_ID5, "", getResources().getDrawable(R.drawable.observation_5));
ActionItem observation6 = new ActionItem(_ID6, "", getResources().getDrawable(R.drawable.observation_6));
ActionItem observation7 = new ActionItem(_ID7, "", getResources().getDrawable(R.drawable.observation_7));
ActionItem observation8 = new ActionItem(_ID8, "", getResources().getDrawable(R.drawable.observation_8));
ActionItem observation9 = new ActionItem(_ID9, "", getResources().getDrawable(R.drawable.observation_9));
ActionItem observation10 = new ActionItem(_ID10, "", getResources().getDrawable(R.drawable.observation_10));
ActionItem observation11 = new ActionItem(_ID11, "", getResources().getDrawable(R.drawable.observation_11));
ActionItem observation12 = new ActionItem(_ID12, "", getResources().getDrawable(R.drawable.observation_12));
ActionItem observation13 = new ActionItem(_ID13, "", getResources().getDrawable(R.drawable.observation_13));
ActionItem observation14 = new ActionItem(_ID14, "", getResources().getDrawable(R.drawable.observation_14));
ActionItem observation15 = new ActionItem(_ID15, "", getResources().getDrawable(R.drawable.observation_15));
mQuickAction2.addActionItem(observation1);
mQuickAction2.addActionItem(observation2);
mQuickAction2.addActionItem(observation3);
mQuickAction2.addActionItem(observation4);
mQuickAction2.addActionItem(observation5);
mQuickAction2.addActionItem(observation6);
mQuickAction2.addActionItem(observation7);
mQuickAction2.addActionItem(observation8);
mQuickAction2.addActionItem(observation9);
mQuickAction2.addActionItem(observation10);
mQuickAction2.addActionItem(observation11);
mQuickAction2.addActionItem(observation12);
mQuickAction2.addActionItem(observation13);
mQuickAction2.addActionItem(observation14);
mQuickAction2.addActionItem(observation15);
stamp = (ImageButton) view.findViewById(R.id.btnstamp);
stamp.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
mQuickAction2.show(v);
}
});
//setup the action item click listener
mQuickAction2.setOnActionItemClickListener(new QuickAction.OnActionItemClickListener() {
@Override
public void onItemClick(QuickAction quickAction, int pos, int actionId) {
ActionItem actionItem = quickAction.getActionItem(pos);
stamp_selected = actionItem.getActionId();
switch(stamp_selected) {
case 1:
stamp.setImageResource(R.drawable.observation_1);
break;
case 2:
stamp.setImageResource(R.drawable.observation_2);
break;
case 3:
stamp.setImageResource(R.drawable.observation_3);
break;
case 4:
stamp.setImageResource(R.drawable.observation_4);
break;
case 5:
stamp.setImageResource(R.drawable.observation_5);
break;
case 6:
stamp.setImageResource(R.drawable.observation_6);
break;
case 7:
stamp.setImageResource(R.drawable.observation_7);
break;
case 8:
stamp.setImageResource(R.drawable.observation_8);
break;
case 9:
stamp.setImageResource(R.drawable.observation_9);
break;
case 10:
stamp.setImageResource(R.drawable.observation_10);
break;
case 11:
stamp.setImageResource(R.drawable.observation_11);
break;
case 12:
stamp.setImageResource(R.drawable.observation_12);
break;
case 13:
stamp.setImageResource(R.drawable.observation_13);
break;
case 14:
stamp.setImageResource(R.drawable.observation_14);
break;
case 15:
stamp.setImageResource(R.drawable.observation_15);
break;
}
}
});
final QuickAction mQuickAction3 = new QuickAction(getActivity());
ActionItem energy1 = new ActionItem(_ID1, "", getResources().getDrawable(R.drawable.energy_1));
ActionItem energy2 = new ActionItem(_ID2, "", getResources().getDrawable(R.drawable.energy_2));
ActionItem energy3 = new ActionItem(_ID3, "", getResources().getDrawable(R.drawable.energy_3));
ActionItem energy4 = new ActionItem(_ID4, "", getResources().getDrawable(R.drawable.energy_4));
ActionItem energy5 = new ActionItem(_ID5, "", getResources().getDrawable(R.drawable.energy_5));
mQuickAction3.addActionItem(energy1);
mQuickAction3.addActionItem(energy2);
mQuickAction3.addActionItem(energy3);
mQuickAction3.addActionItem(energy4);
mQuickAction3.addActionItem(energy5);
mEnergy = (ImageButton) view.findViewById(R.id.btnEnergy);
mEnergy.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
mQuickAction3.show(v);
}
});
//setup the action item click listener
mQuickAction3.setOnActionItemClickListener(new QuickAction.OnActionItemClickListener() {
@Override
public void onItemClick(QuickAction quickAction, int pos, int actionId) {
ActionItem actionItem = quickAction.getActionItem(pos);
energy_selected = actionItem.getActionId();
switch(energy_selected) {
case 1:
mEnergy.setImageResource(R.drawable.energy_1);
break;
case 2:
mEnergy.setImageResource(R.drawable.energy_2);
break;
case 3:
mEnergy.setImageResource(R.drawable.energy_3);
break;
case 4:
mEnergy.setImageResource(R.drawable.energy_4);
break;
case 5:
mEnergy.setImageResource(R.drawable.energy_5);
break;
}
}
});
mIntercorse = (ToggleButton) view.findViewById(R.id.btnIntercorse);
mPeriod = (ToggleButton) view.findViewById(R.id.btnPeriod);
mHeadache = (ToggleButton) view.findViewById(R.id.btnHeadache);
mTest = (ToggleButton) view.findViewById(R.id.btnTest);
return view;
}
最佳答案
清理你的项目。在 Eclipse 中,
Project -->Clean... choose your project
有时 Eclipse 不会立即获取 xml 更改,因此它会抛出这些类转换异常。简单地清理和重建项目通常可以解决此类错误。在拔掉你所有的头发试图弄清楚为什么你会得到这样的异常之前,这是一件快速而简单的事情。
此外,我建议尽可能使用 xml 选项卡。恕我直言,它更灵活,更容易获得你想要的结果。手动编码 xml 时仍然会遇到此问题,但我认为大多数时候用这种方式生成所需的布局会更容易。
关于android - 布局更改导致崩溃,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17529535/
我正在尝试使用 Spark 从 Cassandra 读取数据。 DataFrame rdf = sqlContext.read().option("keyspace", "readypulse
这是代码: void i_log_ (int error, const char * file, int line, const char * fmt, ...) { /* Get erro
我必须调试一个严重依赖 Gtk 的程序。问题是由于某些原因,在使用 GtkWindow 对象时开始出现许多运行时警告。问题是,即使 Gtk 提示严重错误,它也不会因这些错误而中止。我没有代码库的更改历
我正在尝试从已有效编译和链接的程序中检索二进制文件。我已经通过 GL_PROGRAM_BINARY_LENGTH 收到了它的长度。该文档说有两个实例可能会发生 GL_INVALID_OPERATION
我有一个托管在 Azure 环境中的服务。我正在使用控制台应用程序使用该服务。这样做时,我得到了异常: "The requested service, 'http://xxxx-d.yyyy.be/S
我有以下代码,它被 SEGV 信号杀死。使用调试器表明它被 main() 中的第一个 sem_init() 杀死。如果我注释掉第一个 sem_init() ,第二个会导致同样的问题。我试图弄清楚是什么
目前我正在编写一个应用程序(目标 iOS 6,启用 ARC),它使用 JSON 进行数据传输,使用核心数据进行持久存储。 JSON 数据由 PHP 脚本通过 json_encode 从 MySQL 数
我对 Xamarin.Forms 还是很陌生。我在出现的主页上有一个非常简单的功能 async public Task BaseAppearing() { if (UserID
这是我的代码的简化版本。 public class MainActivity extends ActionBarActivity { private ArrayList entry = new Arr
我想弄明白为什么我的两个 Java 库很难很好地协同工作。这是场景: 库 1 有一个类 A,其构造函数如下: public A(Object obj) { /* boilerplate */ } 在以
如果网站不需要身份验证,我的代码可以正常工作,如果需要,则在打印“已创建凭据”后会立即出现 EXC_BAD_ACCESS 错误。我不会发布任何内容,并且此代码是直接从文档中复制的 - 知道出了什么问题
我在使用 NSArray 填充 UITableView 时遇到问题。我确信我正在做一些愚蠢的事情,但我无法弄清楚。当我尝试进行简单的计数时,我得到了 EXC_BAD_ACCESS,我知道这是因为我试图
我在 UITableViewCell 上有一个 UITextField,在另一个单元格上有一个按钮。 我单击 UITextField(出现键盘)。 UITextField 调用了以下方法: - (BO
我有一个应用程序出现间歇性崩溃。崩溃日志显示了一个堆栈跟踪,这对我来说很难破译,因此希望其他人看到了这一点并能为我指出正确的方向。 基本上,应用程序在启动时执行反向地理编码请求,以在标签中显示用户的位
我开发了一个 CGImage,当程序使用以下命令将其显示在屏幕上时它工作正常: [output_view.layer performSelectorOnMainThread:@selector(set
我正在使用新的 EncryptedSharedPreferences以谷歌推荐的方式上课: private fun securePrefs(context: Context): SharedPrefe
我有一个中继器,里面有一些控件,其中一个是文本框。我正在尝试使用 jquery 获取文本框,我的代码如下所示: $("#").click(function (event) {}); 但我总是得到 nu
在以下场景中观察到 TTS 初始化错误,太随机了。 已安装 TTS 引擎,存在语音集,并且可以从辅助功能选项中播放示例 tts。 TTS 初始化在之前初始化和播放的同一设备上随机失败。 在不同的设备(
maven pom.xml org.openjdk.jol jol-core 0.10 Java 类: public class MyObjectData { pr
在不担心冲突的情况下,可以使用 MD5 作为哈希值,字符串长度最多为多少? 这可能是通过为特定字符集中的每个可能的字符串生成 MD5 哈希来计算的,长度不断增加,直到哈希第二次出现(冲突)。没有冲突的
我是一名优秀的程序员,十分优秀!