José Antonio Pérez Sánchez avatar José Antonio Pérez Sánchez committed ba753cb

sort descending by _id

Comments (0)

Files changed (2)

ContentBrowser/res/layout/main.xml

   android:layout_width="fill_parent"
   android:layout_height="fill_parent">
 
+  <Button
+      android:id="@+id/create_event"
+      android:text="Create Event"
+      android:layout_height="wrap_content"
+      android:layout_width="wrap_content"
+      android:layout_weight="0" />
+
+
   <LinearLayout
     android:id="@+id/hbox"
     android:layout_width="fill_parent"

ContentBrowser/src/com/sharpdrops/contentbrowser/MainActivity.java

 import android.widget.TextView;
 import android.widget.Toast;
 
+import java.util.TimeZone;
+
 public class MainActivity extends Activity implements OnClickListener {
 
 	private static final String[] DEFAULT_PROVIDERS = { "sms", "sms/inbox", "sms/sent", "call_log",
 		super.onCreate(savedInstanceState);
 		setContentView(R.layout.main);
 
-		AutoCompleteTextView uri = (AutoCompleteTextView) findViewById(R.id.uri);
+		final AutoCompleteTextView uri = (AutoCompleteTextView) findViewById(R.id.uri);
 		uri.setAdapter(new ArrayAdapter<String>(this,
 				android.R.layout.simple_dropdown_item_1line, DEFAULT_PROVIDERS));
 
-		Button submit = (Button) findViewById(R.id.submit);
+		final Button submit = (Button) findViewById(R.id.submit);
 		submit.setOnClickListener(this);
+
+        final Button createEvent = (Button) findViewById(R.id.create_event);
+        createEvent.setOnClickListener(new OnClickListener() {
+            public void onClick(View v) {
+                Toast.makeText(getApplicationContext(), TimeZone.getDefault().getID(), Toast.LENGTH_LONG).show();
+            }
+        });
 	}
 
 	public void onClick(View v) {
 
 		// create cursor
 		try {
-			Cursor cur = managedQuery(uri, null, null, null, null);
+			Cursor cur = managedQuery(uri, null, null, null, "_id desc");
 			GridView grid = (GridView) findViewById(R.id.grid);
 			grid.setAdapter(new DynamicCursorAdapter(this, cur, R.layout.entry));
 		} catch (Exception e) {
 			// fixme: never shown!
-			Toast.makeText(this, e.getMessage(), Toast.LENGTH_LONG);
+			Toast.makeText(this, e.getMessage(), Toast.LENGTH_LONG).show();
 		}
 	}
 
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.