the class data helper establishes
connection with database code generator inserts the quotes with
keywords in database randomcodes class toasts the random
quote
import android.app.Activity; import android.app.ListActivity; import android.content.Intent; import android.os.Bundle; import android.view.View; import android.widget.AdapterView; import android.widget.ArrayAdapter; import android.widget.Button; import android.widget.ListView; import android.widget.TextView; import android.widget.Toast; import android.widget.AdapterView.OnItemClickListener; public class RandomCodes extends ListActivity { /** Called when the activity is first created. */ @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); //setContentView(R.layout.main); String[] category = getResources().getStringArray(R.array.category_array); setListAdapter(new ArrayAdapter<String>(this, R.layout.list_item, category)); final ListView lv = getListView(); lv.setTextFilterEnabled(true); lv.setOnItemClickListener(new OnItemClickListener() { @Override public void onItemClick(AdapterView<?> parent, View view, int position, long id) { // When clicked, show a toast with the TextView text // Toast.makeText(getApplicationContext(), ((TextView) view).getText(), //Toast.LENGTH_SHORT).show(); Intent switchIntent= new Intent(getBaseContext(),CodeGenerator.class); switchIntent.putExtra("myKey",((TextView) view).getText().toString()); startActivity(switchIntent); } }); // Button random=(Button)findViewById(R.id.Button01); } } import java.util.List; import android.app.Activity; import android.os.Bundle; import android.util.Log; import android.widget.TextView; public class CodeGenerator extends Activity { private Datahelper dh; private TextView output; String category; String quote; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.db); this.output = (TextView) this.findViewById(R.id.out_text); System.out.println("hello"); this.dh = new Datahelper(this); this.dh.deleteAll(); this.dh.insert("Fortune and love favor the brave.","Miscellinious"); this.dh.insert("Honesty is the best policy.","Honesty"); this.dh.insert("Work is worship.","Wisdom"); this.dh.insert("Health is Wealth","Health"); this.dh.insert("The value of achievement lies in the achieving.---Albert Einstien","FamousPersonalities"); this.dh.insert("If I loved you less, I might be able to talk about it more.","Love"); this.dh.insert("Friendship is most beautiful thing in life","Friendship"); this.dh.insert("If it's very painful for you to criticize your friends - you're safe in doing it. But if you take the slightest pleasure in it, that's the time to hold your tongue","Wisdom"); this.dh.insert("Without hard work, nothing grows but weeds","Hardwork"); this.dh.insert("We must become the change we want to see","Wisdom"); this.dh.insert("A man's moral worth is not measured by what his religious beliefs are but rather by what emotional impulses he has received from Nature during his lifetime","Religious"); this.dh.insert("Dream is some thing what we dont see in sleep it is something that does allow u to sleep.---APJ Abdul Kalam","FamousPersonalities"); Bundle extras = getIntent().getExtras(); category= extras.getString("myKey"); System.out.println(category+"================="); List<String> names = this.dh.selectAll(quote,category); StringBuilder sb = new StringBuilder(); sb.append("" + "The available quotes in category are:: nn"); for (String name : names) { sb.append(name +"nn"); } System.out.println("output of sb ---->"+sb); Log.d("EXAMPLE", "names size - " + names.size()); this.output.setText(sb.toString()); } } import android.content.Context; import android.database.Cursor; import android.database.sqlite.SQLiteDatabase; import android.database.sqlite.SQLiteOpenHelper; import android.database.sqlite.SQLiteStatement; import android.util.Log; import java.util.ArrayList; import java.util.List; public class Datahelper { private static final String DATABASE_NAME = "codes_391184_new.db"; private static final int DATABASE_VERSION = 1; private static final String
People often delete received messages, but with the help of a tracking app you still will be able to read it, how to hack someones phone app find here.