1

这是我的代码。按下 item 时出现强制关闭错误。卡在这个程序中。没有找到合适的解决方案

myList = (ListView)findViewById(R.id.myList);
Adapter = new MobileArrayAdapter(FileShare.this, MOBILE_OS);
myList.setAdapter(Adapter);
myList.setOnItemClickListener(new OnItemClickListener()
{        
    public void onItemClick(AdapterView<?> parent, View view, int position, long id)
    {           
        // Toast.makeText(getApplicationContext(), "Your message here", Toast.LENGTH_SHORT).show();             
        Intent i = new Intent(FileShare.this, sharedView.class);
        Intent pickFileIntent = new Intent();
        pickFileIntent.setAction(Intent.ACTION_GET_CONTENT);
        pickFileIntent.addCategory(Intent.CATEGORY_OPENABLE);
        pickFileIntent.setType("*/*");
        Intent chooserIntent = Intent.createChooser(pickFileIntent, getText(R.string.choosefile_title));
        startActivityForResult(chooserIntent, PICK_FILE_REQUEST);
        startActivity(i);       
    }
});
4

1 回答 1

0

像这样添加ComponentInfo你的清单文件

<activity android:name="ComponentInfo" android:screenOrientation="portrait"
                    android:configChanges="orientation"></activity>

我想这会帮助你...

于 2012-10-25T10:44:25.163 回答