2012-02-28 2 views
0

헤더 항목에 setText를 가져 오는 데 문제가 있습니다. 오류없이 작동합니다. 나는 전화를 시도했다헤더 텍스트 뷰에서 텍스트를 설정할 수 없습니다

내 runnable에서 내 filldata()와 my create에서. 해당 코드의 두 번째 줄이 있으면 충돌합니다. 그렇지 않다면 실행되지만 필요한 결과를 얻지 못할 것입니다. 내가 뭔가를 놓치고있는 것처럼 느껴진다. 그러나 그것이 다른 모든 것을 위해 할 때 헤더가 왜 작동하지 않는지 이해하지 못한다.

public class output extends ListActivity { 
    private PopupWindow pw; 
    private dbadapter mydbhelper; 
    private int getCount = inputpage.editCount; 
    private Map<Integer, String> values = inputpage.inputValues; 
    private Cursor st; 
    @Override 
    public void onCreate(Bundle savedInstantState){ 
     super.onCreate(savedInstantState); 
     setContentView(R.layout.outview); 
     mydbhelper = new dbadapter(this); 
     mydbhelper.open(); 
     fillData(); 
     } 
     //Lots of long if statements to insure all text changed has the new color, for statement only colors last item in loop  
private final Runnable mTask = new Runnable(){ 
    public void run(){ 
     TextView head = (TextView) findViewById(R.id.storyTitle); 
     head.setText(st.getString(st.getColumnIndex("titledesc"))); 

     if (getCount == 1){ 
      TextView textView = (TextView)findViewById(R.id.outputText); 
      String story = textView.getText().toString(); 
      CharSequence modifitedText = Replacer.replace(story, 
       "0", Html.fromHtml("<font color=\"#FFA500\">"+ values.get(0) +"</font>")); 
    textView.setText(modifitedText); 
       } 
     if (getCount == 2){ 
      TextView textView = (TextView)findViewById(R.id.outputText); 
      String story = textView.getText().toString(); 
      CharSequence modifitedText = Replacer.replace(story, 
       "0", Html.fromHtml("<font color=\"#FFA500\">"+ values.get(0) +"</font>")); 
      CharSequence modifitedText1 = Replacer.replace(modifitedText, 
        "1", Html.fromHtml("<font color=\"#FFA500\">"+ values.get(1) +"</font>")); 
      textView.setText(modifitedText1); 
       } 
     if (getCount == 3){ 
      TextView textView = (TextView)findViewById(R.id.outputText); 
      String story = textView.getText().toString(); 
      CharSequence modifitedText = Replacer.replace(story, 
       "0", Html.fromHtml("<font color=\"#FFA500\">"+ values.get(0) +"</font>")); 
      CharSequence modifitedText1 = Replacer.replace(modifitedText, 
        "1", Html.fromHtml("<font color=\"#FFA500\">"+ values.get(1) +"</font>")); 
      CharSequence modifitedText2 = Replacer.replace(modifitedText1, 
        "2", Html.fromHtml("<font color=\"#FFA500\">"+ values.get(2) +"</font>")); 
      textView.setText(modifitedText2); 
       } 
     if (getCount == 4){ 
      TextView textView = (TextView)findViewById(R.id.outputText); 
      String story = textView.getText().toString(); 
      CharSequence modifitedText = Replacer.replace(story, 
       "0", Html.fromHtml("<font color=\"#FFA500\">"+ values.get(0) +"</font>")); 
      CharSequence modifitedText1 = Replacer.replace(modifitedText, 
        "1", Html.fromHtml("<font color=\"#FFA500\">"+ values.get(1) +"</font>")); 
      CharSequence modifitedText2 = Replacer.replace(modifitedText1, 
        "2", Html.fromHtml("<font color=\"#FFA500\">"+ values.get(2) +"</font>")); 
      CharSequence modifitedText3 = Replacer.replace(modifitedText2, 
        "3", Html.fromHtml("<font color=\"#FFA500\">"+ values.get(3) +"</font>")); 
      textView.setText(modifitedText3); 
       } 
     if (getCount == 5){ 
      TextView textView = (TextView)findViewById(R.id.outputText); 
      String story = textView.getText().toString(); 
      CharSequence modifitedText = Replacer.replace(story, 
       "0", Html.fromHtml("<font color=\"#FFA500\">"+ values.get(0) +"</font>")); 
      CharSequence modifitedText1 = Replacer.replace(modifitedText, 
        "1", Html.fromHtml("<font color=\"#FFA500\">"+ values.get(1) +"</font>")); 
      CharSequence modifitedText2 = Replacer.replace(modifitedText1, 
        "2", Html.fromHtml("<font color=\"#FFA500\">"+ values.get(2) +"</font>")); 
      CharSequence modifitedText3 = Replacer.replace(modifitedText2, 
        "3", Html.fromHtml("<font color=\"#FFA500\">"+ values.get(3) +"</font>")); 
      CharSequence modifitedText4 = Replacer.replace(modifitedText3, 
        "4", Html.fromHtml("<font color=\"#FFA500\">"+ values.get(4) +"</font>")); 
      textView.setText(modifitedText4); 
       } 
     if (getCount == 6){ 
      TextView textView = (TextView)findViewById(R.id.outputText); 
      String story = textView.getText().toString(); 
      CharSequence modifitedText = Replacer.replace(story, 
       "0", Html.fromHtml("<font color=\"#FFA500\">"+ values.get(0) +"</font>")); 
      CharSequence modifitedText1 = Replacer.replace(modifitedText, 
        "1", Html.fromHtml("<font color=\"#FFA500\">"+ values.get(1) +"</font>")); 
      CharSequence modifitedText2 = Replacer.replace(modifitedText1, 
        "2", Html.fromHtml("<font color=\"#FFA500\">"+ values.get(2) +"</font>")); 
      CharSequence modifitedText3 = Replacer.replace(modifitedText2, 
        "3", Html.fromHtml("<font color=\"#FFA500\">"+ values.get(3) +"</font>")); 
      CharSequence modifitedText4 = Replacer.replace(modifitedText3, 
        "4", Html.fromHtml("<font color=\"#FFA500\">"+ values.get(4) +"</font>")); 
      CharSequence modifitedText5 = Replacer.replace(modifitedText4, 
        "5", Html.fromHtml("<font color=\"#FFA500\">"+ values.get(5) +"</font>")); 
      textView.setText(modifitedText5); 
       } 
     if (getCount == 7){ 
      TextView textView = (TextView)findViewById(R.id.outputText); 
      String story = textView.getText().toString(); 
      CharSequence modifitedText = Replacer.replace(story, 
       "0", Html.fromHtml("<font color=\"#FFA500\">"+ values.get(0) +"</font>")); 
      CharSequence modifitedText1 = Replacer.replace(modifitedText, 
        "1", Html.fromHtml("<font color=\"#FFA500\">"+ values.get(1) +"</font>")); 
      CharSequence modifitedText2 = Replacer.replace(modifitedText1, 
        "2", Html.fromHtml("<font color=\"#FFA500\">"+ values.get(2) +"</font>")); 
      CharSequence modifitedText3 = Replacer.replace(modifitedText2, 
        "3", Html.fromHtml("<font color=\"#FFA500\">"+ values.get(3) +"</font>")); 
      CharSequence modifitedText4 = Replacer.replace(modifitedText3, 
        "4", Html.fromHtml("<font color=\"#FFA500\">"+ values.get(4) +"</font>")); 
      CharSequence modifitedText5 = Replacer.replace(modifitedText4, 
        "5", Html.fromHtml("<font color=\"#FFA500\">"+ values.get(5) +"</font>")); 
      CharSequence modifitedText6 = Replacer.replace(modifitedText5, 
        "6", Html.fromHtml("<font color=\"#FFA500\">"+ values.get(6) +"</font>")); 
      textView.setText(modifitedText6); 
       } 
     if (getCount == 8){ 
      TextView textView = (TextView)findViewById(R.id.outputText); 
      String story = textView.getText().toString(); 
      CharSequence modifitedText = Replacer.replace(story, 
       "0", Html.fromHtml("<font color=\"#FFA500\">"+ values.get(0) +"</font>")); 
      CharSequence modifitedText1 = Replacer.replace(modifitedText, 
        "1", Html.fromHtml("<font color=\"#FFA500\">"+ values.get(1) +"</font>")); 
      CharSequence modifitedText2 = Replacer.replace(modifitedText1, 
        "2", Html.fromHtml("<font color=\"#FFA500\">"+ values.get(2) +"</font>")); 
      CharSequence modifitedText3 = Replacer.replace(modifitedText2, 
        "3", Html.fromHtml("<font color=\"#FFA500\">"+ values.get(3) +"</font>")); 
      CharSequence modifitedText4 = Replacer.replace(modifitedText3, 
        "4", Html.fromHtml("<font color=\"#FFA500\">"+ values.get(4) +"</font>")); 
      CharSequence modifitedText5 = Replacer.replace(modifitedText4, 
        "5", Html.fromHtml("<font color=\"#FFA500\">"+ values.get(5) +"</font>")); 
      CharSequence modifitedText6 = Replacer.replace(modifitedText5, 
        "6", Html.fromHtml("<font color=\"#FFA500\">"+ values.get(6) +"</font>")); 
      CharSequence modifitedText7 = Replacer.replace(modifitedText6, 
        "7", Html.fromHtml("<font color=\"#FFA500\">"+ values.get(7) +"</font>")); 
      textView.setText(modifitedText7); 
       } 
     if (getCount == 9){ 
      TextView textView = (TextView)findViewById(R.id.outputText); 
      String story = textView.getText().toString(); 
      CharSequence modifitedText = Replacer.replace(story, 
       "0", Html.fromHtml("<font color=\"#FFA500\">"+ values.get(0) +"</font>")); 
      CharSequence modifitedText1 = Replacer.replace(modifitedText, 
        "1", Html.fromHtml("<font color=\"#FFA500\">"+ values.get(1) +"</font>")); 
      CharSequence modifitedText2 = Replacer.replace(modifitedText1, 
        "2", Html.fromHtml("<font color=\"#FFA500\">"+ values.get(2) +"</font>")); 
      CharSequence modifitedText3 = Replacer.replace(modifitedText2, 
        "3", Html.fromHtml("<font color=\"#FFA500\">"+ values.get(3) +"</font>")); 
      CharSequence modifitedText4 = Replacer.replace(modifitedText3, 
        "4", Html.fromHtml("<font color=\"#FFA500\">"+ values.get(4) +"</font>")); 
      CharSequence modifitedText5 = Replacer.replace(modifitedText4, 
        "5", Html.fromHtml("<font color=\"#FFA500\">"+ values.get(5) +"</font>")); 
      CharSequence modifitedText6 = Replacer.replace(modifitedText5, 
        "6", Html.fromHtml("<font color=\"#FFA500\">"+ values.get(6) +"</font>")); 
      CharSequence modifitedText7 = Replacer.replace(modifitedText6, 
        "7", Html.fromHtml("<font color=\"#FFA500\">"+ values.get(7) +"</font>")); 
      CharSequence modifitedText8 = Replacer.replace(modifitedText7, 
        "8", Html.fromHtml("<font color=\"#FFA500\">"+ values.get(8) +"</font>")); 
      textView.setText(modifitedText8); 
       } 
     if (getCount == 10){ 
      TextView textView = (TextView)findViewById(R.id.outputText); 
      String story = textView.getText().toString(); 
      CharSequence modifitedText = Replacer.replace(story, 
       "0", Html.fromHtml("<font color=\"#FFA500\">"+ values.get(0) +"</font>")); 
      CharSequence modifitedText1 = Replacer.replace(modifitedText, 
        "1", Html.fromHtml("<font color=\"#FFA500\">"+ values.get(1) +"</font>")); 
      CharSequence modifitedText2 = Replacer.replace(modifitedText1, 
        "2", Html.fromHtml("<font color=\"#FFA500\">"+ values.get(2) +"</font>")); 
      CharSequence modifitedText3 = Replacer.replace(modifitedText2, 
        "3", Html.fromHtml("<font color=\"#FFA500\">"+ values.get(3) +"</font>")); 
      CharSequence modifitedText4 = Replacer.replace(modifitedText3, 
        "4", Html.fromHtml("<font color=\"#FFA500\">"+ values.get(4) +"</font>")); 
      CharSequence modifitedText5 = Replacer.replace(modifitedText4, 
        "5", Html.fromHtml("<font color=\"#FFA500\">"+ values.get(5) +"</font>")); 
      CharSequence modifitedText6 = Replacer.replace(modifitedText5, 
        "6", Html.fromHtml("<font color=\"#FFA500\">"+ values.get(6) +"</font>")); 
      CharSequence modifitedText7 = Replacer.replace(modifitedText6, 
        "7", Html.fromHtml("<font color=\"#FFA500\">"+ values.get(7) +"</font>")); 
      CharSequence modifitedText8 = Replacer.replace(modifitedText7, 
        "8", Html.fromHtml("<font color=\"#FFA500\">"+ values.get(8) +"</font>")); 
      CharSequence modifitedText9 = Replacer.replace(modifitedText8, 
        "9", Html.fromHtml("<font color=\"#FFA500\">"+ values.get(9) +"</font>")); 
      textView.setText(modifitedText9); 
       } 
};}; 


private final Handler mHandler = new Handler(); 

    //fill listview with data if statement to get quickstart button to work 
    private void fillData() { 
     if(main.quickStart == "Cate"){ 
     Cursor st = mydbhelper.getStory(); 
      startManagingCursor(st); 
      String[] from = new String[] {dbadapter.KEY_TITLESTORY}; 
      int[] to = new int[] {R.id.outputText}; 
      SimpleCursorAdapter adapter = 
      new SimpleCursorAdapter(this, R.layout.out_row, st, from, to); 
      ListView list = getListView(); 
      View footer = getLayoutInflater().inflate(R.layout.outputbutton, list, false); 
      View header = getLayoutInflater().inflate(R.layout.outheader, list, false); 
      list.addHeaderView(header); 
      list.addFooterView(footer); 
     setListAdapter(adapter);} 
     if(main.quickStart == "Quick"){ 
      Cursor st = mydbhelper.getQuickStory(); 
      startManagingCursor(st); 
      String[] from = new String[] {dbadapter.KEY_TITLESTORY}; 
      int[] to = new int[] {R.id.outputText}; 
      SimpleCursorAdapter adapter = 
      new SimpleCursorAdapter(this, R.layout.out_row, st, from, to); 
      ListView list = getListView(); 
      View footer = getLayoutInflater().inflate(R.layout.outputbutton, list, false); 
      View header = getLayoutInflater().inflate(R.layout.outheader, list, false); 
      list.addHeaderView(header); 
      list.addFooterView(footer); 
     setListAdapter(adapter);} 
     } 

    public void onClickMenu(View footer){ 
     final MediaPlayer editClickSound = MediaPlayer.create(this, R.raw.button50); 
     editClickSound.start(); 
     Intent intent = new Intent(this, main.class); 
     intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); 
     startActivity(intent); 
     } 

    @Override 
    protected void onResume() { 
     mydbhelper.open(); 
     mHandler.postDelayed(mTask, 10); 
     super.onResume(); 
    } 

    @Override 
    protected void onPause() { 
     mydbhelper.close(); 
     super.onPause(); 
    } 
    //Menu Items 
    @Override 
    public boolean onCreateOptionsMenu(Menu menu) { 
     MenuInflater inflater = getMenuInflater(); 
     inflater.inflate(R.layout.menu, menu); 
     return true; 
    } 

    public boolean onOptionsItemSelected(MenuItem item) { 
     // Handle item selection 
     switch (item.getItemId()) { 
      case R.id.help: 
       showHelp(); 
       return true; 
      } 
     return false; 
    } 

     private void showHelp() { 
      LayoutInflater inflater = (LayoutInflater) 
         this.getSystemService(Context.LAYOUT_INFLATER_SERVICE); 
        pw = new PopupWindow(
         inflater.inflate(R.layout.help, null, false), 
         LayoutParams.FILL_PARENT, LayoutParams.WRAP_CONTENT, 
         true); 
        pw.showAtLocation(this.findViewById(R.id.outputText), Gravity.CENTER, 0, 0); 
     } 
     public void onClickHelp(View helper){pw.dismiss(); 

     } 
} 

로그인 고양이

02-28 01:20:09.750: D/dalvikvm(224): GC freed 519 objects/47136 bytes in 104ms 
02-28 01:20:10.360: W/MediaPlayer(224): info/warning (1, 44) 
02-28 01:20:10.440: V/DB Exists(224): db exists 
02-28 01:20:10.730: I/MediaPlayer(224): Info (1,44) 
02-28 01:20:13.260: W/MediaPlayer(224): info/warning (1, 44) 
02-28 01:20:13.330: I/MediaPlayer(224): Info (1,44) 
02-28 01:20:14.600: W/KeyCharacterMap(224): No keyboard for id 0 
02-28 01:20:14.610: W/KeyCharacterMap(224): Using default keymap: /system/usr/keychars/qwerty.kcm.bin 
02-28 01:20:18.851: W/MediaPlayer(224): info/warning (1, 44) 
02-28 01:20:18.910: I/MediaPlayer(224): Info (1,44) 
02-28 01:20:19.220: D/AndroidRuntime(224): Shutting down VM 
02-28 01:20:19.220: W/dalvikvm(224): threadid=3: thread exiting with uncaught exception (group=0x4001b188) 
02-28 01:20:19.220: E/AndroidRuntime(224): Uncaught handler: thread main exiting due to uncaught exception 
02-28 01:20:19.240: E/AndroidRuntime(224): java.lang.NullPointerException 
02-28 01:20:19.240: E/AndroidRuntime(224): at wanted.pro.madlibs.output$1.run(output.java:45) 
02-28 01:20:19.240: E/AndroidRuntime(224): at android.os.Handler.handleCallback(Handler.java:587) 
02-28 01:20:19.240: E/AndroidRuntime(224): at android.os.Handler.dispatchMessage(Handler.java:92) 
02-28 01:20:19.240: E/AndroidRuntime(224): at android.os.Looper.loop(Looper.java:123) 
02-28 01:20:19.240: E/AndroidRuntime(224): at android.app.ActivityThread.main(ActivityThread.java:4363) 
02-28 01:20:19.240: E/AndroidRuntime(224): at java.lang.reflect.Method.invokeNative(Native Method) 
02-28 01:20:19.240: E/AndroidRuntime(224): at java.lang.reflect.Method.invoke(Method.java:521) 
02-28 01:20:19.240: E/AndroidRuntime(224): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:860) 
02-28 01:20:19.240: E/AndroidRuntime(224): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:618) 
02-28 01:20:19.240: E/AndroidRuntime(224): at dalvik.system.NativeStart.main(Native Method) 
02-28 01:20:19.260: I/dalvikvm(224): threadid=7: reacting to signal 3 
02-28 01:20:19.300: I/dalvikvm(224): Wrote stack trace to '/data/anr/traces.txt' 
02-28 01:20:21.020: I/Process(224): Sending signal. PID: 224 SIG: 9 
02-28 01:20:21.980: D/AndroidRuntime(242): Shutting down VM 
02-28 01:20:21.980: W/dalvikvm(242): threadid=3: thread exiting with uncaught exception (group=0x4001b188) 
02-28 01:20:21.980: E/AndroidRuntime(242): Uncaught handler: thread main exiting due to uncaught exception 
02-28 01:20:22.000: E/AndroidRuntime(242): java.lang.RuntimeException: Unable to start activity ComponentInfo{wanted.pro.madlibs/wanted.pro.madlibs.inputpage}: java.lang.NullPointerException 
02-28 01:20:22.000: E/AndroidRuntime(242): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2496) 
02-28 01:20:22.000: E/AndroidRuntime(242): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2512) 
02-28 01:20:22.000: E/AndroidRuntime(242): at android.app.ActivityThread.access$2200(ActivityThread.java:119) 
02-28 01:20:22.000: E/AndroidRuntime(242): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1863) 
02-28 01:20:22.000: E/AndroidRuntime(242): at android.os.Handler.dispatchMessage(Handler.java:99) 
02-28 01:20:22.000: E/AndroidRuntime(242): at android.os.Looper.loop(Looper.java:123) 
02-28 01:20:22.000: E/AndroidRuntime(242): at android.app.ActivityThread.main(ActivityThread.java:4363) 
02-28 01:20:22.000: E/AndroidRuntime(242): at java.lang.reflect.Method.invokeNative(Native Method) 
02-28 01:20:22.000: E/AndroidRuntime(242): at java.lang.reflect.Method.invoke(Method.java:521) 
02-28 01:20:22.000: E/AndroidRuntime(242): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:860) 
02-28 01:20:22.000: E/AndroidRuntime(242): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:618) 
02-28 01:20:22.000: E/AndroidRuntime(242): at dalvik.system.NativeStart.main(Native Method) 
02-28 01:20:22.000: E/AndroidRuntime(242): Caused by: java.lang.NullPointerException 
02-28 01:20:22.000: E/AndroidRuntime(242): at wanted.pro.madlibs.inputpage.onCreate(inputpage.java:51) 
02-28 01:20:22.000: E/AndroidRuntime(242): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047) 
02-28 01:20:22.000: E/AndroidRuntime(242): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2459) 
02-28 01:20:22.000: E/AndroidRuntime(242): ... 11 more 
02-28 01:20:22.020: I/dalvikvm(242): threadid=7: reacting to signal 3 
02-28 01:20:22.070: I/dalvikvm(242): Wrote stack trace to '/data/anr/traces.txt' 
02-28 01:20:24.530: D/dalvikvm(250): GC freed 563 objects/48816 bytes in 78ms 
02-28 01:20:24.842: W/MediaPlayer(250): info/warning (1, 44) 
02-28 01:20:24.940: V/DB Exists(250): db exists 
02-28 01:20:25.022: I/MediaPlayer(250): Info (1,44) 

음 많은 시행 착오 후에 나는 그것이 작동시킬 수 있었다.

public class output extends ListActivity { 
    private PopupWindow pw; 
    private dbadapter mydbhelper; 
    private int getCount = inputpage.editCount; 
    private Map<Integer, String> values = inputpage.inputValues; 
    public Cursor st; 
    @Override 
    public void onCreate(Bundle savedInstantState){ 
     super.onCreate(savedInstantState); 
     setContentView(R.layout.outview); 
     mydbhelper = new dbadapter(this); 
     mydbhelper.open(); 
     fillData(); 
     TextView head = (TextView) findViewById(R.id.storyTitle); 
     st.moveToFirst(); 
     head.setText(st.getString(st.getColumnIndex(dbadapter.KEY_TITLEDESC))); 


    } 

키가 변경되었다고 생각하고 올바른 위치/순서로 호출한다고 생각하십시오. 타이 모든 도움.

if(main.quickStart.equals("Cate")) 

if(main.quickStart.equals("Quick")) 
+0

로그 고양이 – Nitin

+0

atextview.setText (somestring)가 정확한지 확인하십시오. 그건 잘 작동하고, 우리가 그것에 대해 당신에게 말할 수있는 것은 아무것도 없습니다. 예기치 않은 동작이나 오류가있는 경우 해당 문제에 대해 이야기 해보십시오. –

+0

inputpage.java에서 NullPointerException이 발생했습니다. u가 도움을 줄 수 있도록 해당 파일 코드를 제공하십시오. –

답변

1

, onResume(), Runnable 객체를 사용한다. runnable에서 Cursor c를 사용하여 헤더 제목의 텍스트를 설정한다. 그러나 fillData()를 호출하지 않기 때문에 onResume에서 커서가 초기화되지 않는다. 실행 가능한 객체가 커서 c에 액세스하려고하면 예외가 발생합니다.

그래서 당신처럼 onResume()을 변경해야

@Override 
    protected void onResume() { 

     super.onResume(); 
     mydbhelper.open(); 
     fillData(); 

     mHandler.postDelayed(mTask, 10); 
    } 

는 문제를 해결할 것입니다, 이걸 희망을 사용해보십시오!

+0

.equals로 변경되었지만 여전히 충돌합니다. head.setText (st.getString (st.getColumnIndex ("titledesc")));를 포함하지 않으면 모든 것이 잘 작동합니다. – maebe

+0

커서 문제라고 생각합니다. 이 두 줄을 제거하면 TextView head = (TextView) findViewById (R.id.storyTitle); head.setText (st.getString (st.getColumnIndex ("titledesc"))); 그리고 System.out.println 만 넣으십시오 (st.getString (st.getColumnIndex ("titledesc")))); 이 또한 예외를 일으키는 경우 그냥 System.out.println (st.getCount()); 그리고 커서의 크기를 확인하십시오. 간단한 :-) – user370305

+0

나는 커서에 문제가 있다고 생각한다. st.moveToFirst(); 에 문제를 일으키고있다. Bot에 의해 system.out.println이 충돌을 일으켰습니다. – maebe

0

여기에

if(main.quickStart == "Cate")if(main.quickStart == "Quick")이 있어야 할 수 있습니다 경우 조건 다음private void fillData() 당신이 비교하는 경우 문자열에서

Cursor st = mydbhelper.getQuickStory(); 
to 
st = mydbhelper.getStory(); 
+0

나는 그것을 시험해 볼 것이다. 설정된 텍스트는 filldata와 in에서 처음 생성되었습니다. runnable에서 내가 여기에 게시하기 전에 시도한 마지막 장소였습니다. 나는 그것을 쏜다. – maebe

+0

@maebe : 좋습니다. 또한 열 색인을 가져 오는 데 사용하는 열의 철자를 확인하고 액세스중인 테이블에 열을 만들었는지 확인하십시오. 실수 일 수 있습니다. 또한 값이 비어 있지 않을 수도 있습니다 어떤 경우에도. – Hiral

관련 문제