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

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);
    }
});

最佳答案

像这样在清单文件中添加ComponentInfo

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


我想这会帮你...

09-05 00:08