in my application I have 3 edit boxes where the user enters in text.
After the text is entered into the three boxes, I want to press the save button and have the data saved. I am trying to figure out how to do that and all the reading that I am doing I am not finding it. Can someone give me some guidance??
Here is my code so far from the java file:
package com.example.gasfillup;
import android.app.Activity;
import android.app.TabActivity;
import android.os.Bundle;
import android.widget.TabHost;
import android.widget.TextView;
public class GasFillup extends TabActivity {
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
TabHost mTabHost = getTabHost();
mTabHost.addTab(mTabHost.newTabSpec("tab_test1").setIndicator("Car Info").setContent(R.id.panel1));
mTabHost.addTab(mTabHost.newTabSpec("tab_test2").setIndicator("Fillup Info").setContent(R.id.textview2));
mTabHost.addTab(mTabHost.newTabSpec("tab_test3").setIndicator("Gas Milage").setContent(R.id.textview3));
mTabHost.addTab(mTabHost.newTabSpec("tab_test4").setIndicator("Stats").setContent(R.id.textview4));
mTabHost.setCurrentTab(0);
TextView tv = (TextView)findViewById(R.id.panel1);
String txt = tv.getText().toString();
}
}
Please help me understand what I am doing wrong … I want to be able to understand what I don’t know …
ironmantis7x
You don’t appear to have a
Buttondeclared. You will also need to set anonClickListeneron theButtonthat actually performs the data save. You also haven’t said where you want the data to be saved to,SharedPreferences, aFile, database etc.