我有以下代码显示一个图像与字母,
public class MainActivity extends Activity { private String[] capital_letters,small_letters; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); this.requestWindowFeature(Window.FEATURE_NO_TITLE); this.getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,WindowManager.LayoutParams.FLAG_FULLSCREEN); setContentView(R.layout.activity_main); } @Override protected void onStart() { super.onStart(); try { capital_letters = getApplicationContext().getResources().getStringArray( R.array.capital_letters ); small_letters = getApplicationContext().getResources().getStringArray( R.array.small_letters ); MyAdapter adapter = new MyAdapter ( MainActivity.this,capital_letters,small_letters ); ListView list = ( ListView ) findViewById( R.id.list ); list.setAdapter( adapter ); list.setOnItemClickListener( new AdapterView.OnItemClickListener() { @Override public void onItemClick(AdapterView<?> arg0,View arg1,int position,long id ) { Intent intent = new Intent ( MainActivity.this,LetterActivity.class ); intent.putExtra( "position",position ); intent.setFlags(Intent.FLAG_ACTIVITY_NO_ANIMATION); startActivity(intent); overridePendingTransition( 0,0 ); } }); } catch ( Exception e ){e.printStackTrace();} } }
我如何使我的代码如此轻巧的工作非常顺利.平滑的表现意义,适当声明变量,循环,垃圾收集使用等?
@H_404_6@解决方法
看看
this question and all its answers,谈到Android上的性能优化很多.
@H_404_6@
@H_404_6@ 原文链接:https://www.f2er.com/android/311298.html