2012-03-31 6 views
2

申し訳ありませんが、私は混乱しています。アクティビティは起動するたびにRAMを使用します。

私は常に稼働しているサービスとアクティビティを持っています。アクティビティが起動されて閉じられるたびに、AppメモリまたはRAMの使用が増加します。

私がアクティビティに持っているのは、画像とシークバーです。

非常に迅速に構築できるので、これをやめるために何が必要なのですか?

私はゲッターとセッターもたくさん持っています。 tv.getText()。toString();などのように。およびbg.setBackgroundResource(R.drawable.icon);


だから、私のonCreateそれはレイアウトのためのIDを起動し、などで...活動が使用するメモリまたはラムを作成されるすべての時間が大幅に上がります。それはリソースや何かを複製していますか?それは一定の割合で上昇する。

@Override 
public void onCreate(Bundle savedInstanceState) { 
    super.onCreate(savedInstanceState); 
    requestWindowFeature(android.view.Window.FEATURE_NO_TITLE); 
    setContentView(R.layout.lock_screen); 
    tm = (TelephonyManager)getSystemService(Context.TELEPHONY_SERVICE); 

    //DATE & TIME STATS 
    DateLayout = (LinearLayout) findViewById(R.id.DateLayout); 
    curhour = (TextView) findViewById(R.id.hourText); 
    curmin = (TextView) findViewById(R.id.minText); 
    curmonth = (TextView) findViewById(R.id.monthText); 
    curday = (TextView) findViewById(R.id.dayText); 
    curactualday = (TextView) findViewById(R.id.actualdayText); 
    batt = (TextView) findViewById(R.id.batt); 

    //updateClock(); 

    //PATHS & TARGETS 
    SliderUnlockPath = (ImageView) findViewById(R.id.slider_unlock_path); 
    SliderTextAnimation=(AnimationDrawable) SliderUnlockPath.getDrawable(); 

    //SLIDER 
    seekbar = (SeekBar) findViewById(R.id.seekbar); 
    seekbar.setOnSeekBarChangeListener(new OnSeekBarChangeListener() 
    { 
    public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser){ 
     // TODO Auto-generated method stub 
    } 

    public void onStartTrackingTouch(SeekBar seekBar) { 
     // TODO Auto-generated method stub 
     //SliderUnlockPath.setBackgroundResource(R.drawable.lockscreen_slider_path_light); 
     SliderUnlockPath.setVisibility(ImageView.INVISIBLE); 
    } 
     @Override 
     public void onStopTrackingTouch(SeekBar seekBar) { 
     // TODO Auto-generated method stub 
     //SliderUnlockPath.setBackgroundResource(R.drawable.lockscreen_slider_path); 

     //IF RIGHTMOST (UNLOCK ZONE) 
     int UnlockZone = seekbar.getProgress(); 
     if (UnlockZone > 86) UnlockZone = 100; { 
      seekbar.setProgress(UnlockZone); 
      SliderUnlockPath.setVisibility(ImageView.INVISIBLE);      
     } 
     if (UnlockZone == 100) { 
      mHandler.removeCallbacks(mUpdateTimeTask); 
      finish(); 

     } 

     //IF NOT RIGHTMOST 
     int ResetZone = seekbar.getProgress(); 
     if (ResetZone < 86) ResetZone = 0; { 
      seekbar.setProgress(ResetZone); 
      SliderUnlockPath.setVisibility(ImageView.INVISIBLE); 
      SliderUnlockPath.setVisibility(ImageView.VISIBLE); 
      //SliderUnlockPath.setBackgroundResource(R.drawable.lockscreen_slider_path); 
     } 
    } 
    }); 




    //WIDGETZONE VIEWFLIPPER 
    vf = (ViewFlipper) findViewById(R.id.layoutswitcher); 


    //MUSIC 
    //MusicLayout = (LinearLayout) findViewById(R.id.MusicLayout); 
    //MusicInfoLayout = (LinearLayout) findViewById(R.id.MusicInfoLayout); 
    //UpdateMusicOnStart(); 


    //WEATHER 
    WeatherTop = (ImageView) findViewById(R.id.WeatherTop); 
    WeatherTopAnimation(); 

    iconCurrent = (ImageView)findViewById(R.id.iconcurrent); 
    CurrentLocation = (TextView)findViewById(R.id.CurrentLocation); 
    CurrentHigh = (TextView)findViewById(R.id.CurrentHigh); 
    CurrentCondition = (TextView)findViewById(R.id.CurrentCondition); 
    //CurrentLow = (TextView)findViewById(R.id.CurrentLow); 

    //Get Location from Main Panel 
    CurrentLocation.setText(place); 

    //STRINGS FOR TEXT INFO 
    //String weatherString = QueryGoogleWeather(place); 
    //Document weatherDoc = convertStringToDocument(weatherString); 
    /*if(parseGoogleWeather(weatherDoc)){ 
     //Display Result 
     String c = currentConditions.condition 
       + currentConditions.temp_f 
       + currentConditions.temp_c;*/ 
       //+ currentConditions.humidity 
       //+ currentConditions.wind_condition; 

     //textCurrent.setText(c); 

     /*textInfo.setText("city: " + forecastInformation.city + "\n" 
     + "postal code: " + forecastInformation.postal_code + "\n" 
     + "forecast date: " + forecastInformation.forecast_date + "\n" 
     + "current date time: " + forecastInformation.current_date_time + "\n" 
     + "unit: " + forecastInformation.unit_system);*/ 

    //CurrentLocation.setText(forecastInformation.city); 

     //if (iLockerMain.TEMPSCALE.isChecked()) { 
      //CurrentHigh.setText(currentConditions.temp_f+"°"+"F"); 
     //} else { 
      //CurrentHigh.setText(currentConditions.temp_c+"°"+"C"); 
     //} 

     //CurrentCondition.setText(currentConditions.condition); 

     //Bitmap bm = LoadIcon(currentConditions.icon); 
     //iconCurrent.setImageBitmap(bm); 

    /*if (CurrentCondition.getText().toString().equals("Overcast")) { 
      iconCurrent.setBackgroundResource(R.drawable.cloudy3small); 
     } else if (CurrentCondition.getText().toString().equals("Light rain")) { 
      iconCurrent.setBackgroundResource(R.drawable.light_rainsmall); 
     } else if (CurrentCondition.getText().toString().equals("Light snow")) { 
      iconCurrent.setBackgroundResource(R.drawable.snow3small); 
     }*/ 



    mHandler = new Handler(); 
} 

@Override 
public void onResume(){ 
    //updateClock(); 
    mHandler.removeCallbacks(mUpdateTimeTask); 
    mHandler.postDelayed(mUpdateTimeTask, 100); 


    super.onResume(); 
} 
@Override 
public void onPause(){ 
    //unregisterReceiver(mReceiver); 
    mHandler.removeCallbacks(mUpdateTimeTask); 

    super.onPause(); 
} 
+0

おそらく画像や変数への未処理/未処理のハンドル - どのような言語ですか? –

+0

ハードコードを見ずに知るのは難しいです... – Phix

+0

ハングアップ... – user1190019

答えて

0

すべての割り当てをonDestroy()で解放していますか?

関連する問題