Programing android i am trying to delete data from database at the onCreate activity stage?
-
import java.io.File; import android.app.Activity; import android.content.Intent; import android.os.Bundle; import android.view.View; import android.view.View.OnClickListener; import android.widget.Button; public class DicemanActivity extends Activity { /** Called when the activity is first created. */ private static final String DB_PATH = "Data/data/<diceman>databases<GameData>"… @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); doDBCheck(); Button button1 = (Button)findViewById(R.id.button1); button1.setOnClickListener(new OnClickListener() { public void onClick(View v){ Intent intent = new Intent(v.getContext(),play.class); startActivityForResult(intent, 0); } }); } private void doDBCheck(){ try{ File file = new File(DB_PATH); }catch (Exception ex){ } } }
-
Answer:
Have you modified the manifest file to give the app read/write permissions? If not, add <uses-permission android:name="android.permission. WRITE_EXTERNAL_STORAGE" /> to AndroidManifest.xml (without the new line, for some reason it wasn't displaying properly...)
Thomas at Yahoo! Answers Visit the source
Related Q & A:
- How to add bulk virtual data in database?Best solution by msdn.microsoft.com
- How to display HTML data from database?Best solution by Stack Overflow
- How to listview my data from database SQLite?Best solution by Stack Overflow
- How to show data in database with a JTable?Best solution by java-tips.org
- How to insert data into database in electron?Best solution by Stack Overflow
Just Added Q & A:
- How many active mobile subscribers are there in China?Best solution by Quora
- How to find the right vacation?Best solution by bookit.com
- How To Make Your Own Primer?Best solution by thekrazycouponlady.com
- How do you get the domain & range?Best solution by ChaCha
- How do you open pop up blockers?Best solution by Yahoo! Answers
For every problem there is a solution! Proved by Solucija.
-
Got an issue and looking for advice?
-
Ask Solucija to search every corner of the Web for help.
-
Get workable solutions and helpful tips in a moment.
Just ask Solucija about an issue you face and immediately get a list of ready solutions, answers and tips from other Internet users. We always provide the most suitable and complete answer to your question at the top, along with a few good alternatives below.