Skip to main content


Showing posts from May, 2014

Export the SQLITEDB into .csv or .pdf

If you want to export the sqlite db into .csv  or .pdf. You are going use the following libraries
OPENCSV-2.3.jariTextPDF – 5.2.1.jar
Task of Creating CSV
public class ExportCSVTask extends AsyncTask<String, Void, Boolean> {            private final ProgressDialog dialog = new ProgressDialog(                      MainActivity.this);
           protected void onPreExecute() {                 this.dialog.setMessage("Exporting database...");       ;            }
           @Override            protected Boolean doInBackground(String... params) {                 File dbFile = getDatabasePath("basic_db");                 File exportDB = new File(Environment.getExternalStorageDirectory(),                            "");                 if (!exportDB.exists()) {                      exportDB.mkdirs();                 }                 File file = new File(exportDB, getDateTime() + ".csv");                 try {                      file.…

Link the TextView without using webview

Java TextView link; link = (TextView) findViewById(; link.setMovementMethod(LinkMovementMethod.getInstance());
<string name="link_google"><u><a href="">Go to Google</a></u></string>
<TextView         android:layout_width="wrap_content"         android:layout_height="wrap_content"         android:textColor="#80BFFF"         android:text="@string/link_google"         android:id="@+id/link"         android:layout_gravity="center_vertical"         />

Identify app is installed in the device

If you want to know the other app is installed or not, just using PackageManager.

public boolean appInstalledOrNot(String uri) {
PackageManager pm = getPackageManager();
boolean app_installed = false;
try {
pm.getPackageInfo(uri, PackageManager.GET_ACTIVITIES);
app_installed = true;
} catch (PackageManager.NameNotFoundException e) {
app_installed = false;
return app_installed;

String uri means package name like 
if(appInstalledOrNot({ <-- app is not installed--> } else{ <-- app is installed--> }