Android Open Source - power-consumption-android Main Activity






From Project

Back to project page power-consumption-android.

License

The source code is released under:

Apache License

If you think the Android project power-consumption-android listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

package com.wolfsoft.epower;
/* ww  w . j a  v  a 2s .  com*/


import java.util.Random;

import android.annotation.SuppressLint;
import android.app.ActionBar;
import android.app.Activity;
import android.app.ActivityOptions;
import android.content.Intent;
import android.content.res.Resources;
import android.os.Bundle;
import android.view.View;
import android.widget.TextView;


public class MainActivity extends Activity {

  @Override
  protected void onCreate(Bundle savedInstanceState) {
    
    String[] qoutes;
    String[] qoutes2;
    final Random rgenerator = new Random();
    final Random rgenetator2 = new Random();
    
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);
  
    // get action bar   
        ActionBar actionBar = getActionBar();
        // Enabling Up / Back navigation
        actionBar.setDisplayHomeAsUpEnabled(false);
      
        
        Resources res = getResources();

        qoutes = res.getStringArray(R.array.qoutes); 
        qoutes2 = res.getStringArray(R.array.qoutes2); 
        String headqoute = qoutes[rgenerator.nextInt(qoutes.length)];
        String headqoute1 = qoutes2[rgenetator2.nextInt(qoutes.length)];
    
    TextView tView = (TextView) findViewById(R.id.headline);
    tView.setSelected(true);
    tView.setText("\""+headqoute+"\"  \""+headqoute1+"\"");
    
    
  }
  

  public void estimate_cost(View V)
  {
  
    Intent intent2 = new Intent(MainActivity.this, EstimateCost.class);
    
        startActivity(intent2);
        overridePendingTransition(R.anim.anim_slide_in_left,
                R.anim.anim_slide_out_right);
  }
  
  public void takequiz(View V)
  {
  
    Intent intent2 = new Intent(MainActivity.this, Takequiz.class);
    
        startActivity(intent2);
        overridePendingTransition(R.anim.anim_slide_in_left,
                R.anim.anim_slide_out_right);
  }
  public void tips(View V)
  {
  
    Intent intent2 = new Intent(MainActivity.this, Tips.class);
    
        startActivity(intent2);
        overridePendingTransition(R.anim.anim_slide_in_left,
                R.anim.anim_slide_out_right);
  }

  public void links(View V)
  {
  
    Intent intent2 = new Intent(MainActivity.this, Links.class);
    
        startActivity(intent2);
        overridePendingTransition(R.anim.anim_slide_in_left,
                R.anim.anim_slide_out_right);
  }
  
}




Java Source Code List

com.wolfsoft.epower.Appliancetips.java
com.wolfsoft.epower.EstimateCost.java
com.wolfsoft.epower.Heatcold.java
com.wolfsoft.epower.Lighttips.java
com.wolfsoft.epower.Links.java
com.wolfsoft.epower.MainActivity.java
com.wolfsoft.epower.Question2.java
com.wolfsoft.epower.Question3.java
com.wolfsoft.epower.Question4.java
com.wolfsoft.epower.Question5.java
com.wolfsoft.epower.Takequiz.java
com.wolfsoft.epower.Tips.java
com.wolfsoft.epower.Total.java