Created
September 2, 2014 16:32
-
-
Save deepakkarki/d84ac1829187c31dc475 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.example.nostalgia; | |
import java.io.File; | |
import java.io.FileOutputStream; | |
import java.io.OutputStreamWriter; | |
import android.app.Activity; | |
import android.content.Intent; | |
import android.os.Bundle; | |
import android.util.Log; | |
import android.view.View; | |
import android.widget.EditText; | |
import android.widget.TextView; | |
public class StartExperience extends Activity | |
{ | |
public static String exp_name; | |
public static String logPath = "/sdcard/nostalgia/log.txt"; | |
@Override | |
protected void onCreate(Bundle savedInstanceState) | |
{ | |
super.onCreate(savedInstanceState); | |
setContentView(R.layout.activity_startexp); | |
} | |
public void startExperience(View view) | |
{ | |
EditText txt_box = (EditText)findViewById(R.id.exp_name); | |
exp_name = txt_box.getText().toString(); | |
if(!exp_name.equals("")) | |
{ | |
//setContentView(R.layout.activity_recording); | |
try | |
{ | |
//this is to keep track that the activity has started and this file contains the path where the true data is being | |
OutputStreamWriter fwrite = new OutputStreamWriter(new FileOutputStream(new File(logPath))); | |
fwrite.write(exp_name); | |
fwrite.close(); | |
//create new directory for trip here. | |
File newTrip = new File("/sdcard/nostalgia/"+exp_name); | |
newTrip.mkdir(); | |
} | |
catch (Exception e ) | |
{ | |
} | |
finally | |
{ | |
TextView txt_view = (TextView)findViewById(R.id.messege); | |
txt_view.setVisibility(View.VISIBLE); | |
txt_box.setVisibility(View.INVISIBLE); | |
view.setVisibility(View.INVISIBLE); | |
View b = findViewById(R.id.stop_exp); | |
b.setVisibility(View.VISIBLE); | |
startService(new Intent(StartExperience.this, ExperienceLoggerService.class)); | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment