android


there is any way to save my shared preferences data into sqlite database in android


problem : i wanted to save my shared preferences data into sqLite database permanently.i here provides my code which store my data into shared preferences folder but when i am trying to store new data the previous one destroy .............is there is any solution to save the data permanently into table .........thanks in advance
public class CustomerWorkOrder extends Activity implements OnClickListener {
EditText etname ,etphone,etvname,etvno,etsdate,etldate,etremarks,etamount;
Button save,Load;
SharedPreferences SomeData;
TextView tv;
public static String filename="MySharedString";
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_customer_work_order);
save=(Button) findViewById(R.id.button1);
Load=(Button) findViewById(R.id.button2);
etname=(EditText) findViewById(R.id.editText1name);
etphone=(EditText) findViewById(R.id.editText2pnum);
etvno=(EditText) findViewById(R.id.editText3vvno);
etvname=(EditText) findViewById(R.id.editText4vvname);
etsdate=(EditText) findViewById(R.id.editText6sdate);
etldate=(EditText) findViewById(R.id.editText5ldts);
etamount=(EditText) findViewById(R.id.editText7amnt);
etremarks=(EditText) findViewById(R.id.editText8remk);
save.setOnClickListener(this);
Load.setOnClickListener(this);
SomeData=getSharedPreferences(filename, 0);
}
#Override
public void onClick(View arg0) {
// TODO Auto-generated method stub
switch(arg0.getId()){
case R.id.button1:
String stringData=etname.getText().toString();
String stringData1=etphone.getText().toString();
String stringData2=etvno.getText().toString();
String stringData3=etvname.getText().toString();
String stringData4=etsdate.getText().toString();
String stringData5=etldate.getText().toString();
String stringData6=etamount.getText().toString();
String stringData7=etremarks.getText().toString();
SharedPreferences.Editor editor=SomeData.edit();
editor.putString("SharedString", stringData);
editor.putString("SharedString1", stringData1);
editor.putString("SharedString2", stringData2);
editor.putString("SharedString3", stringData3);
editor.putString("SharedString4", stringData4);
editor.putString("SharedString5", stringData5);
editor.putString("SharedString6", stringData6);
editor.putString("SharedString7", stringData7);
editor.commit();
etname.setText("");
etphone.setText("");
etvno.setText("");
etvname.setText("");
etsdate.setText("");
etldate.setText("");
etamount.setText("");
etremarks.setText("");
break;
case R.id.button2:
SomeData=getSharedPreferences(filename, 0);
String dataReturned=SomeData.getString("SharedString", "could not load the data");
String dataReturned1=SomeData.getString("SharedString1", "could not load the data");
String dataReturned2=SomeData.getString("SharedString2", "could not load the data");
String dataReturned3=SomeData.getString("SharedString3", "could not load the data");
String dataReturned4=SomeData.getString("SharedString4", "could not load the data");
String dataReturned5=SomeData.getString("SharedString5", "could not load the data");
String dataReturned6=SomeData.getString("SharedString6", "could not load the data");
String dataReturned7=SomeData.getString("SharedString7", "could not load the data");
etname.setText(dataReturned);
etphone.setText(dataReturned1);
etvno.setText(dataReturned2);
etvname.setText(dataReturned3);
etsdate.setText(dataReturned4);
etldate.setText(dataReturned5);
etamount.setText(dataReturned6);
etremarks.setText(dataReturned7);
break;
}
}}
Perhaps this excellent tutorial will get you started quick with SQLite.

Related Links

Interfacing with Html And Android
Shadow only on the outside curve
Android XML Embedding Multiple XML Files into 1
opengl ES OES vs EXT?
OnClick button event triggered during loading after onResume
After Installation of apk “Open” and “Done” button shows, onclick of Open button it's not adding categor as launcher
“Native typeface cannot be made” only for some people
how to dump call stack in syscall(android kernel) ?
Starting BlackBerry application development
Enable BroadcastReceiver of other application using PackageManager.setComponentEnabledSetting()
text entered in EditText does not change into password immediately
How to implement floating context panel like Gmaps 6
Updating UI from broadcastreceiver
How to implement accelerometer with duty cycle in Android application
how to treat internet connection issue in android
TextView stops updating after bringing activity back to the front

Categories

HOME
xml
fuelux
developer-tools
amp-html
nunit
angular-formly
apiblueprint
grafana
opendj
nsbundle
mql5
jquery-ui-sortable
heat
package.json
lilypond
squashfs
dpdk
tosca
flask-sqlalchemy
dynamically-generated
siri
jasmine-node
oculus
firebase-analytics
sqlpackage
nsurl
weather
processwire
roblox
engine.io
bc
skylink
attributeerror
show-hide
fwrite
proget
payara-micro
backbone-collections
skin
er-diagram
reshape
seq
jtree
omxplayer
actor-platform
watch-os-2
riot
kiosk
nullable
blitline
piracy-prevention
java-money
jdi
baasbox
apache-commons-daemon
omnifaces
snackbar
delayed-execution
cosine-similarity
beatsmusic
mruby
ghcjs
rickshaw
winginx
jquery-slider
maven-scm
multiautocompletetextview
high-resolution
eclipse-kepler
windows-phone-8-sdk
intersect
subproject
pinch
jquery-tools
winmain
update-statement
cuteeditor
photolibrary
uideviceorientation
django-piston
wcf-instancing

Resources

Database Users
RDBMS discuss
Database Dev&Adm
javascript
java
csharp
php
android
javascript
java
csharp
php
python
android
jquery
ruby
ios
html
Mobile App
Mobile App
Mobile App