Momo1199 2013-01-04 03:19 采纳率: 0%
浏览 1536
已结题

在android中Unreachable问题

我卡了好长时间了,在return的Unreachable:

return; Recipe093.path[1] = localCursor.getString(1);

如果删除return,继续运行就会获取unreachable,不知道该怎么解决了啊,请帮忙:

代码如下:

public void onCreate(Bundle paramBundle)
  {
    super.onCreate(paramBundle);
    setContentView(R.layout.musiclist);
    final Cursor localCursor = managedQuery(MediaStore.Audio.Media.EXTERNAL_CONTENT_URI, (String[])null, null, (String[])null, null);
    String[] arrayOfString1 = localCursor.getColumnNames();
    int i = arrayOfString1.length;
    for (int j = 0; ; j++)
    {
      if (j >= i)
      {
        String[] arrayOfString2 = { "title", "artist", "duration" };
        int[] arrayOfInt = { 2131099668, 2131099669, 2131099670 };
        SimpleCursorAdapter localSimpleCursorAdapter = new SimpleCursorAdapter(getApplicationContext(), 2130903044, localCursor, arrayOfString2, arrayOfInt);
        localSimpleCursorAdapter.setViewBinder(new AudioListViewBinder());
        ListView localListView = (ListView)findViewById(2131099667);
        localListView.setAdapter(localSimpleCursorAdapter);
        Log.d("test", "start list()");
        localListView.setOnItemClickListener(new AdapterView.OnItemClickListener()
        {
          public void onItemClick(AdapterView<?> paramAnonymousAdapterView, View paramAnonymousView, int paramAnonymousInt, long paramAnonymousLong)
          {
            switch (Recipe093.this.getIntent().getIntExtra("case1", 0))
            {
            default:
            case 1:
            case 2:
            case 3:
            case 4:
            case 5:
            case 6:
            case 7:
            case 8:
            case 9:
            case 10:
            case 11:
            case 12:
            case 13:
            case 14:
            case 15:
            case 16:
            }
            while (true)
            {
              Intent localIntent = new Intent(Recipe093.this.getApplicationContext(), MainActivity.class);
              Recipe093.this.startActivity(localIntent);
              return;
              Recipe093.path[1] = localCursor.getString(1);
              SharedPreferences.Editor localEditor10 = Recipe093.this.getSharedPreferences("FileName", 3).edit();
              localEditor10.putString("userChoice", Recipe093.path[1]);
              localEditor10.commit();
              continue;
              Recipe093.path[2] = localCursor.getString(1);
              SharedPreferences.Editor localEditor9 = Recipe093.this.getSharedPreferences("FileName", 3).edit();
              localEditor9.putString("userChoice1", Recipe093.path[2]);
              localEditor9.commit();
            } 
          }
        });
        return;
      }
      Log.d("Recipe093", arrayOfString1[j]);
    }
  }

  private class AudioListViewBinder
    implements SimpleCursorAdapter.ViewBinder
  {
    private AudioListViewBinder()
    {
    }

    public boolean setViewValue(View paramView, Cursor paramCursor, int paramInt) {
        // TODO Auto-generated method stub
          int i = paramCursor.getColumnIndex("title");
          int j = paramCursor.getColumnIndex("artist");
          int k = paramCursor.getColumnIndex("duration");
          if ((paramInt == i) || (paramInt == j))
            ((TextView)paramView).setText(paramCursor.getString(paramInt));
        return false;
    }

  }
  }
  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥15 socket通信实现多人聊天室疑惑
    • ¥15 DEV-C++编译缺失
    • ¥33 找熟练码农写段Pyhthon程序
    • ¥100 怎么让数据库字段自动更新
    • ¥15 antv g6 力导向图布局
    • ¥15 quartz框架,No record found for selection of Trigger with key
    • ¥15 锅炉建模+优化算法,遗传算法优化锅炉燃烧模型,ls-svm会搞,后面的智能算法不会
    • ¥20 MATLAB多目标优化问题求解
    • ¥15 windows2003服务器按你VPN教程设置后,本地win10如何连接?
    • ¥15 求一阶微分方程的幂级数