很遗憾,应用已停止。我正在创建启动时的校友应用程序,该应用程序已停止。我已经研究了这个问题,并尝试更改清单文件中的代码。
MainActivity.java 包com.example.ashish.alumini.activities.pre_login;
import android.graphics.Color;
import android.os.Bundle;
import android.app.TabActivity;
import android.content.Intent;
import android.util.Log;
import android.util.TypedValue;
import android.view.View;
import android.widget.ProgressBar;
import android.widget.TabHost;
import android.widget.TextView;
import com.example.ashish.alumini.R;
import com.example.ashish.alumini.supporting_classes.GlobalBus;
import com.example.ashish.alumini.supporting_classes.ProgressBarVisibility;
import com.squareup.otto.Subscribe;
import butterknife.Bind;
import butterknife.ButterKnife;
import me.zhanghai.android.materialprogressbar.IndeterminateHorizontalProgressDrawable;
public class MainActivity extends TabActivity {
/** Called when the activity is first created. */
String TAG = getClass().getSimpleName();
@Bind(R.id.material_progressBar_activity_main)
ProgressBar mProgressBar;
GlobalBus mGlobalBus = GlobalBus.getInstance();
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
// butterknife bindings
ButterKnife.bind(this);
//event mGlobalBus registering
// mGlobalBus.register(this);
// setting progress bar
mProgressBar.setIndeterminateDrawable(new IndeterminateHorizontalProgressDrawable(this));
mProgressBar.setVisibility(View.INVISIBLE);
TabHost tabHost = getTabHost();
TabHost.TabSpec spec;
Intent intent;
intent = new Intent().setClass(this, Login.class);
spec = tabHost.newTabSpec("Login").setIndicator("Login")
.setContent(intent);
tabHost.addTab(spec);
intent = new Intent().setClass(this,SignUp.class);
spec = tabHost.newTabSpec("Sign Up").setIndicator("Sign Up")
.setContent(intent);
tabHost.addTab(spec);
for(int i=0;i<tabHost.getTabWidget().getChildCount();i++)
{
TextView tv = (TextView) tabHost.getTabWidget().getChildAt(i).findViewById(android.R.id.title);
tv.setTextColor(Color.parseColor("#ffffff"));
tv.setTextSize(TypedValue.COMPLEX_UNIT_SP,16);
}
}
@Override
protected void onPause() {
super.onPause();
mGlobalBus.unregister(this);
}
@Override
protected void onResume() {
super.onResume();
mGlobalBus.register(this);
}
@Subscribe
public void hidePtogressBar(ProgressBarVisibility barVisibility){
if (barVisibility.isVisibility()){
mProgressBar.setVisibility(View.VISIBLE);
}
else {
mProgressBar.setVisibility(View.INVISIBLE);
}
Log.d(TAG,"Bus Working");
}
}
AndroidManifest.xml
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.ashish.alumini">
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
<uses-permission android:name="android.permission.SEND_SMS" />
<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:largeHeap="true"
android:supportsRtl="true"
android:name=".application.MyApplication"
android:theme="@style/AppTheme">
<activity
android:name=".activities.pre_login.ActivitySplashScreen"
android:label="Alumni">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name=".activities.pre_login.Login"/>
<activity android:name=".activities.pre_login.SignUp"/>
<activity android:name=".activities.post_login.MainScreenActivity"
android:windowSoftInputMode="stateHidden|adjustResize" />
<activity android:name=".activities.post_login.PostLoginActivity"
android:configChanges="orientation|keyboardHidden"
android:windowSoftInputMode="stateHidden|adjustResize" />
<activity android:name=".activities.pre_login.MainActivity"/>
<meta-data android:name="AA_DB_NAME" android:value="alumni.db" />
<meta-data android:name="AA_DB_VERSION" android:value="3" />
<meta-data android:name="AA_MODELS" android:value="com.example.ashish.alumini.network.models.MemberInstanceModel,
com.example.ashish.alumini.network.models.JobInstanceModel" />
<meta-data
android:name="io.fabric.ApiKey"
android:value="ba6735ae3f3ef4ccc1dda75d84ceb6d3b06adbfe" />
</application>
Logcat:
09-15 23:08:07.219 17635-17635 / com.example.ashish.alumini E / dalvikvm: 找不到类“ android.graphics.drawable.RippleDrawable”, 从方法引用 android.support.v7.widget.AppCompatImageHelper.hasOverlappingRendering 09-15 23:08:12.089 17635-17635 / com.example.ashish.alumini E / AndroidRuntime:致命异常:main java.lang.RuntimeException:无法启动活动ComponentInfo {com.example.ashish.alumini / com.example.ashish.alumini.activities.pre_login.MainActivity}: java.lang.NullPointerException 在android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2308) 在android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2362) 在android.app.ActivityThread.access $ 700(ActivityThread.java:168) 在android.app.ActivityThread $ H.handleMessage(ActivityThread.java:1329) 在android.os.Handler.dispatchMessage(Handler.java:99) 在android.os.Looper.loop(Looper.java:176) 在android.app.ActivityThread.main(ActivityThread.java:5493) 在java.lang.reflect.Method.invokeNative(本机方法) 在java.lang.reflect.Method.invoke(Method.java:525) 在com.android.internal.os.ZygoteInit $ MethodAndArgsCaller.run(ZygoteInit.java:1225) 在com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1041) 在dalvik.system.NativeStart.main(本机方法) 造成原因:java.lang.NullPointerException 在com.example.ashish.alumini.activities.pre_login.MainActivity.onCreate(MainActivity.java:47) 在android.app.Activity.performCreate(Activity.java:5372) 在android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1104) 在android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2270) 在android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2362) 在android.app.ActivityThread.access $ 700(ActivityThread.java:168) 在android.app.ActivityThread $ H.handleMessage(ActivityThread.java:1329) 在android.os.Handler.dispatchMessage(Handler.java:99) 在android.os.Looper.loop(Looper.java:176) 在android.app.ActivityThread.main(ActivityThread.java:5493) 在java.lang.reflect.Method.invokeNative(本机方法) 在java.lang.reflect.Method.invoke(Method.java:525) 在com.android.internal.os.ZygoteInit $ MethodAndArgsCaller.run(ZygoteInit.java:12
enter code here
25) 在com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1041) 在dalvik.system.NativeStart.main(本机方法)