make android application performance better
my android application performance is low, it takes a long startup time. i have 5 buttons, one image开发者_StackOverflow社区view, 3 textView, 2 editText and one listView initialized in onCreate() method. Is large number of ui object the reason for slow startup?? Is there any fault in manifest.xml??
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.ars.application"
android:versionCode="1"
android:versionName="1.0">
<application android:icon="@drawable/lightvasicon" android:label="@string/app_name" android:debuggable="true">
<activity android:name=".LightVas"
android:label="@string/app_name"
android:screenOrientation="portrait"
android:configChanges="keyboardHidden|orientation" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
<uses-permission
android:name="android.permission.ACCESS_COARSE_LOCATION"></uses-permission>
<uses-permission
android:name="android.permission.ACCESS_FINE_LOCATION"></uses-permission>
<uses-permission
android:name="android.permission.ACCESS_LOCATION_EXTRA_COMMANDS"></uses-permission>
<uses-permission
android:name="android.permission.ACCESS_MOCK_LOCATION"></uses-permission>
<uses-permission
android:name="android.permission.CONTROL_LOCATION_UPDATES"></uses-permission>
<uses-permission android:name="android.permission.INTERNET"></uses-permission>
<uses-sdk android:minSdkVersion="7" />
</manifest>
Generic performance advice:
In most cases you shouldn't try to guess what is causing performance problems as intuition is often wrong. If you knew the cause of slow code, you wouldn't have written it slow in the first place!
- Use the profiler to work out where your performance problems are.
- Optimize just the slow parts. Keep a copy of your traces and compare them after making a change, so you know whether you're heading in the right direction or not.
- Make your own simple timing method to verify your results, this will make sure that trace recording itself is not causing performance issues in a different place.
精彩评论