Android Open Source - android-xlog Main Activity






From Project

Back to project page android-xlog.

License

The source code is released under:

Apache License

If you think the Android project android-xlog 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.github.curioustechizen.xlog.sample;
//ww w  .ja v a  2 s.  c o  m
import java.io.File;
import java.io.FileWriter;
import java.io.IOException;

import android.app.Activity;
import android.os.Bundle;
import android.view.View;

import com.github.curioustechizen.xlog.Log;

public class MainActivity extends Activity {

  private static final String LOG_TAG = "MainActivity";
    @Override
    protected void onCreate(Bundle savedInstanceState) {
      
        super.onCreate(savedInstanceState);
        Log.d(LOG_TAG, "In onCreate, savedInstanceState = " + savedInstanceState);
        setContentView(R.layout.activity_main);
        
    }
    
    public void onBtnClick(View v){
      if(v.getId() == R.id.button1){
        triggerLog();
      }
    }


  private void triggerLog() {
    try {
      FileWriter filewriter = new FileWriter(new File("/nonexistent/path/dummy.file"));
    } catch (IOException e) {
      Log.e(LOG_TAG, "Could not open file for writing", e);
    }
    
  }
    
    
    
}




Java Source Code List

com.github.curioustechizen.xlog.Log.java
com.github.curioustechizen.xlog.sample.MainActivity.java
com.github.curioustechizen.xlog.sample.XlogSampleApplication.java