在我的应用中,一切似乎都按预期工作。我试图实现所有生命周期调用。问题是当我按下开/关按钮以获取锁定屏幕时,又回到了应用程序。这是当它崩溃时。
日志是:
10-26 08:33:23.440: D/OleIPtv_TvChannels_Tv(10331): In the onRestart() event
10-26 08:33:23.475: D/OleIPtv_TvChannels_Tv(10331): In the onStart() event
10-26 08:33:23.600: W/ResourceType(10331): Failure getting entry for 0x7f030019 (t=2 e=25) in package 0 (error -75)
10-26 08:33:23.610: D/AndroidRuntime(10331): Shutting down VM
10-26 08:33:23.610: W/dalvikvm(10331): threadid=1: thread exiting with uncaught exception (group=0x412ed2a0)
10-26 08:33:23.700: E/AndroidRuntime(10331): FATAL EXCEPTION: main
10-26 08:33:23.700: E/AndroidRuntime(10331): android.content.res.Resources$NotFoundException: Resource ID #0x7f030019
10-26 08:33:23.700: E/AndroidRuntime(10331): at android.content.res.Resources.getValue(Resources.java:1026)
10-26 08:33:23.700: E/AndroidRuntime(10331): at android.content.res.Resources.loadXmlResourceParser(Resources.java:2131)
10-26 08:33:23.700: E/AndroidRuntime(10331): at android.content.res.Resources.getLayout(Resources.java:865)
10-26 08:33:23.700: E/AndroidRuntime(10331): at android.view.LayoutInflater.inflate(LayoutInflater.java:394)
10-26 08:33:23.700: E/AndroidRuntime(10331): at android.widget.SimpleAdapter.createViewFromResource(SimpleAdapter.java:121)
10-26 08:33:23.700: E/AndroidRuntime(10331): at android.widget.SimpleAdapter.getView(SimpleAdapter.java:114)
10-26 08:33:23.700: E/AndroidRuntime(10331): at android.widget.AbsListView.obtainView(AbsListView.java:2461)
10-26 08:33:23.700: E/AndroidRuntime(10331): at android.widget.ListView.makeAndAddView(ListView.java:1775)
10-26 08:33:23.700: E/AndroidRuntime(10331): at android.widget.ListView.fillDown(ListView.java:678)
10-26 08:33:23.700: E/AndroidRuntime(10331): at android.widget.ListView.fillSpecific(ListView.java:1336)
10-26 08:33:23.700: E/AndroidRuntime(10331): at android.widget.ListView.layoutChildren(ListView.java:1606)
10-26 08:33:23.700: E/AndroidRuntime(10331): at android.widget.AbsListView.onLayout(AbsListView.java:2296)
10-26 08:33:23.700: E/AndroidRuntime(10331): at android.view.View.layout(View.java:14055)
10-26 08:33:23.700: E/AndroidRuntime(10331): at android.view.ViewGroup.layout(ViewGroup.java:4604)
10-26 08:33:23.700: E/AndroidRuntime(10331): at android.widget.RelativeLayout.onLayout(RelativeLayout.java:948)
10-26 08:33:23.700: E/AndroidRuntime(10331): at android.view.View.layout(View.java:14055)
10-26 08:33:23.700: E/AndroidRuntime(10331): at android.view.ViewGroup.layout(ViewGroup.java:4604)
10-26 08:33:23.700: E/AndroidRuntime(10331): at android.widget.LinearLayout.setChildFrame(LinearLayout.java:1655)
10-26 08:33:23.700: E/AndroidRuntime(10331): at android.widget.LinearLayout.layoutHorizontal(LinearLayout.java:1644)
10-26 08:33:23.700: E/AndroidRuntime(10331): at android.widget.LinearLayout.onLayout(LinearLayout.java:1428)
10-26 08:33:23.700: E/AndroidRuntime(10331): at android.view.View.layout(View.java:14055)
10-26 08:33:23.700: E/AndroidRuntime(10331): at android.view.ViewGroup.layout(ViewGroup.java:4604)
10-26 08:33:23.700: E/AndroidRuntime(10331): at android.widget.RelativeLayout.onLayout(RelativeLayout.java:948)
10-26 08:33:23.700: E/AndroidRuntime(10331): at android.view.View.layout(View.java:14055)
10-26 08:33:23.700: E/AndroidRuntime(10331): at android.view.ViewGroup.layout(ViewGroup.java:4604)
10-26 08:33:23.700: E/AndroidRuntime(10331): at android.widget.FrameLayout.onLayout(FrameLayout.java:448)
10-26 08:33:23.700: E/AndroidRuntime(10331): at android.view.View.layout(View.java:14055)
10-26 08:33:23.700: E/AndroidRuntime(10331): at android.view.ViewGroup.layout(ViewGroup.java:4604)
10-26 08:33:23.700: E/AndroidRuntime(10331): at android.widget.LinearLayout.setChildFrame(LinearLayout.java:1655)
10-26 08:33:23.700: E/AndroidRuntime(10331): at android.widget.LinearLayout.layoutVertical(LinearLayout.java:1513)
10-26 08:33:23.700: E/AndroidRuntime(10331): at android.widget.LinearLayout.onLayout(LinearLayout.java:1426)
10-26 08:33:23.700: E/AndroidRuntime(10331): at android.view.View.layout(View.java:14055)
10-26 08:33:23.700: E/AndroidRuntime(10331): at android.view.ViewGroup.layout(ViewGroup.java:4604)
10-26 08:33:23.700: E/AndroidRuntime(10331): at android.widget.FrameLayout.onLayout(FrameLayout.java:448)
10-26 08:33:23.700: E/AndroidRuntime(10331): at android.view.View.layout(View.java:14055)
10-26 08:33:23.700: E/AndroidRuntime(10331): at android.view.ViewGroup.layout(ViewGroup.java:4604)
10-26 08:33:23.700: E/AndroidRuntime(10331): at android.view.ViewRootImpl.performLayout(ViewRootImpl.java:1992)
10-26 08:33:23.700: E/AndroidRuntime(10331): at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:1813)
10-26 08:33:23.700: E/AndroidRuntime(10331): at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:1112)
10-26 08:33:23.700: E/AndroidRuntime(10331): at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:4472)
10-26 08:33:23.700: E/AndroidRuntime(10331): at android.view.Choreographer$CallbackRecord.run(Choreographer.java:725)
10-26 08:33:23.700: E/AndroidRuntime(10331): at android.view.Choreographer.doCallbacks(Choreographer.java:555)
10-26 08:33:23.700: E/AndroidRuntime(10331): at android.view.Choreographer.doFrame(Choreographer.java:525)
10-26 08:33:23.700: E/AndroidRuntime(10331): at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:711)
10-26 08:33:23.700: E/AndroidRuntime(10331): at android.os.Handler.handleCallback(Handler.java:615)
10-26 08:33:23.700: E/AndroidRuntime(10331): at android.os.Handler.dispatchMessage(Handler.java:92)
10-26 08:33:23.700: E/AndroidRuntime(10331): at android.os.Looper.loop(Looper.java:137)
10-26 08:33:23.700: E/AndroidRuntime(10331): at android.app.ActivityThread.main(ActivityThread.java:4898)
10-26 08:33:23.700: E/AndroidRuntime(10331): at java.lang.reflect.Method.invokeNative(Native Method)
10-26 08:33:23.700: E/AndroidRuntime(10331): at java.lang.reflect.Method.invoke(Method.java:511)
10-26 08:33:23.700: E/AndroidRuntime(10331): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1006)
10-26 08:33:23.700: E/AndroidRuntime(10331): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:773)
10-26 08:33:23.700: E/AndroidRuntime(10331): at dalvik.system.NativeStart.main(Native Method)
10-26 08:33:33.295: I/Process(10331): Sending signal. PID: 10331 SIG: 9
它似乎是由ListView引起的。
我的代码是:
public class Tv extends Activity implements OnErrorListener, OnPreparedListener, OnCompletionListener, OnVideoSizeChangedListener, OnBufferingUpdateListener, OnInfoListener, SurfaceTextureListener
{
public static String MY_PREFS = "OLEIPTV_PREFS";
public static String videoindex;
public static final String TAG = "OleIPtv_TvChannels_Tv";
public static final int MEDIA_INFO_NETWORK_BANDWIDTH = 703;
private BroadcastReceiver _broadcastReceiver;
private final SimpleDateFormat _sdfWatchTime = new SimpleDateFormat("HH:mm");
// Alerts, ProgressDialogs & Dialogs
private AlertDialog.Builder builder;
private AlertDialog alerta;
private ProgressDialog dialog = null;
private ProgressDialog PD;
// Containers
private RelativeLayout moviecontainer;
private ImageView myImage;
private ListView videoList;
// Views:
private View mContentView;
private VideoView myVideoView;
// Tasks
private syncChannels myTask = null;
// TextViews
private TextView textclock;
private TextView textBatteryInfo;
private TextView textInfo;
private TextView textInfoStreamName;
private String kindofvideo;
// Strings
private String strStatus;
private String deviceId;
private String addressDB2;
private String readJson = "";
private String successCause;
// Contexts
private static Tv context;
// Buttons
private Button batteryButton;
// Booleans
private boolean showingvideo;
private boolean playingvideo;
private boolean playingminimized;
private boolean batteryNotificationReceiverStarted;
private static boolean DEBUG = true;
// Integers
private int streamindex;
private int mode;
private int success;
private int maxstreamcount;
// Stuff
private SharedPreferences prefs;
private ReadJsonFeed readfeed;
private JSONObject jObject;
// Handlers
private Handler handler;
private Handler myHandler;
// Interface Animations
private Animation fadeIn;
private Animation fadeOut;
// Utils
private Vibrate vibrate;
// Arrays, Hash & Lists
private List<String> urlImage;
private List<String> urlKind;
private List<String> urlStream;
private List<String> urlName;
private ArrayList<String> listMenuNames;
private ArrayList<Integer> listMenuPics;
private JSONArray jArrayChannels = null;
private JSONArray jArrayChannelsNames = null;
private String[] from = { "refchan", "channel", "kind" };
private int[] to = { R.id.refnum, R.id.channelName, R.id.channelKind };
private List<HashMap<String, String>> ChannelsLista;
// Stuff
private Typeface myTypeface;
private Typeface myTypeface2;
private ChannelsList ChannelsList;
@SuppressLint("NewApi")
@Override
public void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
Log.i(TAG, "onCreate()");
try
{
if(android.os.Build.VERSION.SDK_INT > 20) // Case it's a Lolipop or greater, let's try the imersive mode...
{
mContentView = getWindow().getDecorView().findViewById(android.R.id.content);
fullscreen();
}
else
{
requestWindowFeature(Window.FEATURE_NO_TITLE);
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);
}
}
catch (Exception e1)
{
e1.printStackTrace();
}
// Set the content xml
setContentView(R.layout.main_tvs);
// Get the device id number
deviceId = Secure.getString(getBaseContext().getContentResolver(), Secure.ANDROID_ID);
// Get Saved Shared Preferences
videoindex = getString(R.string.shared_video_index);
mode = Activity.MODE_PRIVATE;
prefs = getSharedPreferences(MY_PREFS, mode);
streamindex = prefs.getInt(videoindex, -1);
// TextViews
textInfo = (TextView) findViewById(R.id.textInfo);
textclock = (TextView) findViewById(R.id.textClock);
textBatteryInfo = (TextView) findViewById(R.id.textBatteryInfo);
textInfoStreamName = (TextView) findViewById(R.id.textInfoStreamName);
// Views & buttons
videoList = (ListView) findViewById(R.id.channelslist);
batteryButton = (Button) findViewById(R.id.batterybutton);
// Containers
myVideoView = (VideoView) this.findViewById(R.id.myVideoView);
moviecontainer = (RelativeLayout) findViewById(R.id.mainContainerCenter);
myImage = (ImageView) this.findViewById(R.id.myVideoImage);
// Context
context = this;
vibrate = (Vibrate) new Vibrate();
ChannelsList = (ChannelsList) new ChannelsList();
// Init Animations
fadeIn = AnimationUtils.loadAnimation(Tv.this, android.R.anim.fade_in);
fadeOut = AnimationUtils.loadAnimation(Tv.this, android.R.anim.fade_out);
// Init Arrays
ChannelsLista = new ArrayList<HashMap<String, String>>();
urlKind = new ArrayList<String>();
urlStream = new ArrayList<String>();
urlName = new ArrayList<String>();
// Json Server address:
addressDB2 = ConfigCommon.channelsListAddress + ":" + ConfigCommon.serverport + "/"
+ ConfigCommon.channelListFolder + "/" + ConfigCommon.tvchannelsFile;
myTypeface = Typeface.createFromAsset(getAssets(), "fonts/digital7.ttf");
myTypeface2 = Typeface.createFromAsset(getAssets(), "fonts/Comic Book Bold Italic.otf");
textInfoStreamName.setTypeface(myTypeface2);
textInfo.setTypeface(myTypeface2);
textclock.setTypeface(myTypeface);
textInfo.setText("");
textInfoStreamName.setText("");
// Check if we are connected to Internet...
checkInternetConnection();
// Sync channels names / addresses...
syncTVChannels(); // Sync channels names / addresses...
// Set the click listner of the channel's ListView
videoList.setOnItemClickListener(new AdapterView.OnItemClickListener()
{
public void onItemClick(AdapterView<?> myAdapter, View myView, int myItemInt, long mylng)
{
if (checkInternetConnection())
{
myVideoView.stopPlayback();
moviecontainer.removeView(myVideoView);
moviecontainer.removeView(myImage);
moviecontainer.addView(myImage);
streamindex = myItemInt;
myVideoView.stopPlayback();
textInfoStreamName.setText(urlName.get(streamindex).toString());
showVideoContainer();
kindofvideo = urlKind.get(streamindex);
new PlayVideoStream().execute(urlStream.get(streamindex).toString());
SharedPreferences.Editor editor = prefs.edit();
editor.putInt(videoindex, streamindex);
editor.commit();
}
}
});
}
public void onStart()
{
super.onStart();
}
public void onResume()
{
super.onResume();
_broadcastReceiver = new BroadcastReceiver()
{
@Override
public void onReceive(Context ctx, Intent intent)
{
if (intent.getAction().compareTo(Intent.ACTION_TIME_TICK) == 0)
{
textclock.setText(_sdfWatchTime.format(new Date()));
}
}
};
if (registerReceiver(_broadcastReceiver, new IntentFilter(Intent.ACTION_TIME_TICK)) != null)
{
}
if (registerReceiver(mBatInfoReceiver, new IntentFilter(Intent.ACTION_BATTERY_CHANGED)) != null)
{
batteryNotificationReceiverStarted = true;
}
if (myVideoView.isPlaying() == false)
{
try
{
myVideoView.resume();
}
catch (Exception e)
{
e.printStackTrace();
}
}
textclock.setText(_sdfWatchTime.format(new Date()));
}
public void onPause()
{
super.onPause();
try
{
if (batteryNotificationReceiverStarted)
{
unregisterReceiver(mBatInfoReceiver);
batteryNotificationReceiverStarted = false;
}
if (_broadcastReceiver != null)
{
unregisterReceiver(_broadcastReceiver);
_broadcastReceiver = null;
}
if (myVideoView.isPlaying())
{
myVideoView.pause();
}
}
catch (Exception e)
{
e.printStackTrace();
}
}
public void onStop()
{
super.onStop();
try
{
if (batteryNotificationReceiverStarted)
{
unregisterReceiver(mBatInfoReceiver);
batteryNotificationReceiverStarted = false;
}
if (_broadcastReceiver != null)
{
unregisterReceiver(_broadcastReceiver);
_broadcastReceiver = null;
}
if (myVideoView.isPlaying())
{
myVideoView.pause();
}
}
catch (Exception e)
{
e.printStackTrace();
}
}
public void onDestroy()
{
super.onDestroy();
try
{
if (batteryNotificationReceiverStarted)
{
unregisterReceiver(mBatInfoReceiver);
batteryNotificationReceiverStarted = false;
}
if (_broadcastReceiver != null)
{
unregisterReceiver(_broadcastReceiver);
_broadcastReceiver = null;
}
if (myVideoView.isPlaying())
{
myVideoView.stopPlayback();
}
}
catch (Exception e)
{
e.printStackTrace();
}
}
public void onRestart()
{
super.onRestart();
}
@Override
public void onBackPressed()
{
finish();
super.onBackPressed();
}
@Override
public void onSurfaceTextureAvailable(SurfaceTexture surface, int width, int height)
{
}
@Override
public void onSurfaceTextureSizeChanged(SurfaceTexture surface, int width, int height)
{
}
@Override
public boolean onSurfaceTextureDestroyed(SurfaceTexture surface)
{
return false;
}
@Override
public void onSurfaceTextureUpdated(SurfaceTexture surface)
{
}
@Override
public boolean onInfo(MediaPlayer mp, int what, int extra)
{
switch (what)
{
}
return true;
}
@Override
public void onBufferingUpdate(MediaPlayer mp, int percent)
{
}
@Override
public void onVideoSizeChanged(MediaPlayer mp, int width, int height)
{
}
@Override
public void onCompletion(MediaPlayer mp)
{
}
@Override
public void onPrepared(MediaPlayer mp)
{
}
@Override
public boolean onError(MediaPlayer mp, int what, int extra)
{
return false;
}
public boolean checkInternetConnection()
{
if ((Network.getConnectivityStatus(context) == Config.TYPE_NOT_CONNECTED))
{
}
else
{
return true;
}
return false; // Default return
}
private void syncTVChannels()
{
PD = new ProgressDialog(Tv.this, ProgressDialog.THEME_HOLO_LIGHT);
PD.setTitle("Aguarde...");
PD.setMessage("Sincronizando canais...");
PD.setCancelable(false);
PD.show();
if (DEBUG)
{
Log.d(TAG, "Sincronizando os canais...");
}
if (myTask != null && myTask.getStatus() != syncChannels.Status.FINISHED)
{
myTask.cancel(true);
}
String netAddress = addressDB2;
String parameters[] =
{ netAddress };
myTask = (syncChannels) new syncChannels().execute(parameters);
}
private class syncChannels extends AsyncTask<String, Integer, String>
{
@Override
protected void onPreExecute()
{
urlKind.clear();
urlStream.clear();
urlName.clear();
if (DEBUG)
{
Log.d(TAG, "syncChannels -> onPreExecute()...");
}
}
@Override
protected void onProgressUpdate(Integer... values)
{
super.onProgressUpdate(values);
}
@Override
protected String doInBackground(String... urls)
{
if (DEBUG)
{
Log.d(TAG, "syncChannels -> doInBackground(" + urls[0] + "...");
}
try
{
readfeed = new ReadJsonFeed();
readfeed.setAddress(urls[0]);
readJson = readfeed.readJsonFeed();
}
catch (final Exception e1)
{
return ("Erro na leitura dos dados Json.\n" + readJson);
}
try
{
jObject = new JSONObject(readJson.toString());
success = jObject.getInt("success");
successCause = jObject.getString("message");
jArrayChannels = jObject.getJSONArray("channels");
}
catch (final Exception e1)
{
return ("Erro nos dados Json recebidos.\n" + e1.toString());
}
if (success == 1)
{
int JsonSize = jArrayChannels.length();
for (int i = 0; i < JsonSize; i++)
{
try
{
JSONObject channelObject = jArrayChannels.getJSONObject(i);
urlKind.add(channelObject.getString("kind"));
urlStream.add(channelObject.getString("address"));
urlName.add(channelObject.getString("name"));
System.out.println("Kind: " + urlKind.get(i) + "Address: " + urlStream.get(i) + " Name: " + urlName.get(i));
}
catch (JSONException e)
{
Log.d(TAG, "Error in parsing JSon: " + e.toString());
}
}
// Get the number of channels
maxstreamcount = urlStream.size() - 1; // Array index starts in 0.
// Populate the channel's listview
for (int i = 0; i < urlName.size(); i++)
{
String channel = urlName.get(i).toString();
String kind = urlKind.get(i).toString();
//String s = channel.substring(0, 1).toUpperCase();
HashMap<String, String> hm = new HashMap<String, String>();
hm.clear();
hm.put("refchan", "" + (i + 1));
hm.put("channel", channel);
hm.put("kind", kind);
ChannelsLista.add(hm);
}
}
return null;
}
@Override
protected void onPostExecute(String result)
{
try
{
PD.dismiss();
}
catch (Exception e)
{
e.printStackTrace();
}
try
{
SimpleAdapter adapter = new SimpleAdapter(getBaseContext(), ChannelsLista, R.layout.childrow, from, to);
adapter.notifyDataSetChanged();
adapter.setViewBinder(new SimpleAdapter.ViewBinder()
{
@Override
public boolean setViewValue(View view, Object data, String textRepresentation)
{
if (view.getId() == R.id.refnum)
{
((TextView) view).setText(data.toString());
return true;
}
if (view.getId() == R.id.channelName)
{
((TextView) view).setText(data.toString());
((TextView) view).setTypeface(myTypeface2);
return true;
}
return false;
}
});
videoList.setAdapter(adapter);
videoList.setChoiceMode(ListView.CHOICE_MODE_SINGLE);
}
catch (Exception e)
{
}
}
@Override
protected void onCancelled()
{
}
}
@Override
protected void onRestoreInstanceState(Bundle savedInstanceState)
{
super.onRestoreInstanceState(savedInstanceState);
}
@Override
protected void onSaveInstanceState(Bundle outState)
{
super.onSaveInstanceState(outState);
}
// Start video play, using a background task so the device is not blocked
public void startVideoPlay(int index)//String videoToPlay, String videoName)
{
myVideoView.stopPlayback();
textInfoStreamName.setText(urlName.get(streamindex).toString());
showVideoContainer();
kindofvideo = urlKind.get(streamindex);
new PlayVideoStream().execute(urlStream.get(streamindex).toString());
SharedPreferences.Editor editor = prefs.edit();
editor.putInt(videoindex, streamindex);
editor.commit();
}
public class PlayVideoStream extends AsyncTask<String, Uri, Void>
{
Integer track = 0;
protected void onPreExecute()
{
dialog = new ProgressDialog(Tv.this);
dialog.setMessage("Carregando, Por favor aguarde...");
dialog.setCancelable(true);
dialog.show();
showingvideo = true;
}
protected void onProgressUpdate(final Uri... uri)
{
try
{
myVideoView.setVideoURI(uri[0]);
myVideoView.requestFocus();
// Play...
}
catch (IllegalArgumentException e)
{
e.printStackTrace();
}
catch (IllegalStateException e)
{
e.printStackTrace();
}
catch (SecurityException e)
{
e.printStackTrace();
}
}
protected void onPostExecute(String result)
{
System.out.println("onPostExecute");
}
protected void onCancelled()
{
System.out.println("onCancelled");
}
@Override
protected Void doInBackground(String... params)
{
try
{
Uri uri = Uri.parse(params[0]);
publishProgress(uri);
}
catch (Exception e)
{
e.printStackTrace();
}
return null;
}
}
这是布局:
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/mainContainer"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="#ff000000" >
<LinearLayout
android:id="@+id/mainbodycontainer"
android:layout_width="wrap_content"
android:layout_height="fill_parent"
android:layout_centerVertical="true"
android:layout_marginBottom="4dp"
android:layout_marginTop="4dp"
android:background="#ff000000"
android:baselineAligned="false"
android:padding="10dp"
android:weightSum="2" >
<RelativeLayout
android:id="@+id/list_frame"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:background="@drawable/contentpanel"
android:paddingBottom="20dp"
android:paddingTop="20dp" >
<ListView
android:id="@+id/channelslist"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_gravity="center"
android:layout_margin="10dp"
android:divider="#ff000000"
android:dividerHeight="1dp"
android:scrollbars="none" />
</RelativeLayout>
</LinearLayout>
</RelativeLayout>
谢谢你的帮助
最佳答案
我刚刚找到了答案:
我仅使用layout-land,layout-large-land和layout-xlarge-land布局,因为我的应用程序仅使用横向 View 。
造成该问题的原因是,系统在返回到应用程序时,希望首先以纵向模式为ListView的子代充气,并且没有ListView的子代的肖像实例。
我只是将上述布局文件夹重命名为layout,layout-large和layout-xlarge,一切正常。
关于android - 当按下开/关按钮后手机返回到应用程序时,ListView中出现致命异常,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33349635/