1)lam.java
public class lam extends Activity {
//MediaPlayer ourSong;
Button button;
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.end);
//View title = getWindow().findViewById(android.R.id.title);
// View titleBar = (View) title.getParent();
// titleBar.setBackgroundColor(Color.BLACK);
overridePendingTransition(R.anim.a1,R.anim.a2);
//ourSong=MediaPlayer.create(lam.this, R.raw.rollver);
addListenerOnButton();
}
@Override
public void onBackPressed() {
super.onBackPressed();
overridePendingTransition(R.anim.activity_open_translate,R.anim.activity_close_translate);
}
public void addListenerOnButton() {
final Context context = this;
Button tut1 = (Button) findViewById(R.id.button1);
Button tut2= (Button) findViewById(R.id.button2);
Button tut3 = (Button) findViewById(R.id.button3);
//Button tut4 = (Button) findViewById(R.id.button4);
Button tut6 = (Button) findViewById(R.id.button4);
Button tut5 = (Button) findViewById(R.id.button5);
tut1.setOnClickListener(new OnClickListener() {
public void onClick(View arg0) {
// ourSong.start();
Vibrator v = (Vibrator) context.getSystemService(Context.VIBRATOR_SERVICE);
v.vibrate(60);
//marks
Intent i = new Intent(lam.this, MarksTask.class);
startActivity(i);
}
});
tut2.setOnClickListener(new OnClickListener() {
public void onClick(View arg0) {
// ourSong.start();
Vibrator v = (Vibrator) context.getSystemService(Context.VIBRATOR_SERVICE);
v.vibrate(60);
Intent intent = new Intent(lam.this, timetable.class);
startActivity(intent);
}
});
tut3.setOnClickListener(new OnClickListener() {
public void onClick(View arg0) {
// ourSong.start();
Vibrator v = (Vibrator) context.getSystemService(Context.VIBRATOR_SERVICE);
v.vibrate(60);
Intent intent = new Intent(context,further.class);
startActivity(intent);
overridePendingTransition(R.anim.a1,R.anim.a2);
}
});
/*tut4.setOnClickListener(new OnClickListener() {
public void onClick(View arg0) {
ourSong.start();
Vibrator v = (Vibrator) context.getSystemService(Context.VIBRATOR_SERVICE);
v.vibrate(60);
Intent intent = new Intent(context,bus.class);
startActivity(intent);
overridePendingTransition(R.anim.a1,R.anim.a2);
}
}); */
tut6.setOnClickListener(new OnClickListener() {
public void onClick(View arg0) {
// ourSong.start();
Vibrator v = (Vibrator) context.getSystemService(Context.VIBRATOR_SERVICE);
v.vibrate(60);
Intent intent = new Intent(context,P_menu.class);
startActivity(intent);
overridePendingTransition(R.anim.a1,R.anim.a2);
}
});
tut5.setOnClickListener(new OnClickListener() {
public void onClick(View arg0) {
// ourSong.start();
Vibrator v = (Vibrator) context.getSystemService(Context.VIBRATOR_SERVICE);
v.vibrate(60);
Intent intent = new Intent(context,S_lib.class);
startActivity(intent);
overridePendingTransition(R.anim.a1,R.anim.a2);
}
});
}
}
2)end.xml
<?xml version="1.0" encoding="utf-8"?>
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent" >
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:background="#FDF3E7"
android:orientation="vertical" >
<Button
android:id="@+id/button1"
android:layout_width="250dp"
android:layout_height="100dp"
android:layout_marginBottom="50dp"
android:layout_marginLeft="30dp"
android:layout_marginRight="200dp"
android:layout_marginTop="10dp"
android:background="@drawable/wd" />
<View
android:layout_width="fill_parent"
android:layout_height="2dp"
android:layout_marginBottom="10dp"
android:background="#3B3738" />
<Button
android:id="@+id/button2"
android:layout_width="250dp"
android:layout_height="100dp"
android:layout_marginBottom="50dp"
android:layout_marginLeft="30dp"
android:layout_marginRight="0dp"
android:layout_marginTop="0dp"
android:background="@drawable/ef" />
<View
android:layout_width="fill_parent"
android:layout_height="2dp"
android:layout_marginBottom="10dp"
android:background="#3B3738" />
<Button
android:id="@+id/button3"
android:layout_width="250dp"
android:layout_height="100dp"
android:layout_marginBottom="50dp"
android:layout_marginLeft="30dp"
android:layout_marginRight="0dp"
android:layout_marginTop="0dp"
android:background="@drawable/qs" />
<View
android:layout_width="fill_parent"
android:layout_height="2dp"
android:layout_marginBottom="10dp"
android:background="#3B3738" />
<Button
android:id="@+id/button5"
android:layout_width="250dp"
android:layout_height="100dp"
android:layout_marginBottom="50dp"
android:layout_marginLeft="30dp"
android:layout_marginRight="0dp"
android:layout_marginTop="0dp"
android:background="@drawable/library" />
<View
android:layout_width="fill_parent"
android:layout_height="2dp"
android:layout_marginBottom="10dp"
android:background="#3B3738" />
<Button
android:id="@+id/button4"
android:layout_width="250dp"
android:layout_height="100dp"
android:layout_marginBottom="50dp"
android:layout_marginLeft="30dp"
android:layout_marginRight="0dp"
android:layout_marginTop="0dp"
android:background="@drawable/buss" />
</LinearLayout>
</ScrollView>
我在日志中遇到以下错误
A / libc(25871):致命信号11(SIGSEGV)位于0x0019c12c(代码= 1),线程25918(1234.xyz) A / libc(25871):致命信号11(SIGSEGV)位于0x00001160(代码= 1),线程25871(1234.xyz)
,我的google play store错误控制台显示以下错误 -
java.lang.RuntimeException: Unable to start activity ComponentInfo{com.xyz.xyz/com.xyz.xyz.lam}: android.view.InflateException: Binary XML file line #49: Error inflating class <unknown>
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2190)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2239)
at android.app.ActivityThread.access$800(ActivityThread.java:141)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1202)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:136)
at android.app.ActivityThread.main(ActivityThread.java:5047)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:793)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:609)
at dalvik.system.NativeStart.main(Native Method)
Caused by: android.view.InflateException: Binary XML file line #49: Error inflating class <unknown>
at android.view.LayoutInflater.createView(LayoutInflater.java:623)
at com.android.internal.policy.impl.PhoneLayoutInflater.onCreateView(PhoneLayoutInflater.java:56)
at android.view.LayoutInflater.onCreateView(LayoutInflater.java:672)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:697)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:758)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:761)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:761)
at android.view.LayoutInflater.inflate(LayoutInflater.java:495)
at android.view.LayoutInflater.inflate(LayoutInflater.java:400)
at android.view.LayoutInflater.inflate(LayoutInflater.java:353)
at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:290)
at android.app.Activity.setContentView(Activity.java:1947)
at com.xyz.xyz.lam.onCreate(lam.java:21)
at android.app.Activity.performCreate(Activity.java:5249)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1087)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2154)
... 11 more
Caused by: java.lang.reflect.InvocationTargetException
at java.lang.reflect.Constructor.constructNative(Native Method)
at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
at android.view.LayoutInflater.createView(LayoutInflater.java:597)
... 26 more
Caused by: java.lang.OutOfMemoryError
at android.graphics.BitmapFactory.nativeDecodeAsset(Native Method)
at android.graphics.BitmapFactory.decodeStream(BitmapFactory.java:597)
at android.graphics.BitmapFactory.decodeResourceStream(BitmapFactory.java:432)
at android.graphics.drawable.Drawable.createFromResourceStream(Drawable.java:840)
at android.content.res.Resources.createFromResourceStream(Resources.java:2477)
at android.content.res.Resources.loadDrawable(Resources.java:2136)
at android.content.res.MiuiResources.loadDrawable(MiuiResources.java:319)
at android.content.res.Resources.getDrawable(Resources.java:710)
at android.graphics.drawable.StateListDrawable.inflate(StateListDrawable.java:176)
at android.graphics.drawable.Drawable.createFromXmlInner(Drawable.java:937)
at android.graphics.drawable.Drawable.createFromXml(Drawable.java:877)
at android.content.res.Resources.loadDrawable(Resources.java:2116)
at android.content.res.MiuiResources.loadDrawable(MiuiResources.java:319)
at android.content.res.TypedArray.getDrawable(TypedArray.java:602)
at android.view.View.<init>(View.java:3558)
at android.widget.TextView.<init>(TextView.java:623)
at android.widget.Button.<init>(Button.java:107)
at android.widget.Button.<init>(Button.java:103)