Good site for standard cookbook style examples - date pickers, etc.?

by Preston » Fri, 23 Apr 2010 08:02:08 GMT


Sponsored Links
 Right now I'm trying to find out what the most commonly used Android
date picker is. It seems to me that it's probably cumbersome to always
use the DatePicker proper. Just because of the size of it and the fact
that many people for a given date field would want to enter data
manually. So I'm thinking someone out there must have come up with a
pattern where you click on a TextEdit field and it brings up a modal
Activity with a DatePicker, after which it returns that value to the
previous Window. Anyone know of such a thing? Or better yet a site
where noobs such as myself can see examples in cookbook fashion and
work the rest out ourselves.

Thanks,

Preston

--



Other Threads

1. Application Object and Intents

I have an application that I am developing where I am sending an
intent from the Application class.  The intent has extras, and I am
using sendBroadcast.  Everytime I try and send the intent I get a
nullreferencepointer exception.  I have tried sending it from my
onDecodedData method as well as from another method that is called by
onDecodedData.  Now I am trying to call it from a class that extends
broadcast receiver.  Nothing is working.  Here is my code for sending
the intent:


public void onDecodedData(DeviceInfo deviceInfo,
                                ISktScanDecodedData decodedData) {
                        // Log.d(TAG, "Received Scan");
                        // if(_scanwindow!=null)
                        //
_scanwindow.DoScannedData(decodedData.getData(),decodedData.getSymbologyName());
                        char[] data = decodedData.getData();
                        String processedData = processData(data);
                        Log.d(TAG, "Received Scan = " + processedData);
                        // Intent intentsent = new Intent(
                        // PickupItemsActivity.NOTIFY_DATA_ARRIVAL);
                        // Intent intentsent = new Intent();
                        // 
intentsent.setAction(PickupItemsActivity.NOTIFY_DATA_ARRIVAL);
                        // char[] data = decodedData.getData();
                        // 
intentsent.putExtra("com.SocketMobile.ScannerSettings.Data",
                        // processedData);
                        // String symbologyName = 
decodedData.getSymbologyName();
                        //
intentsent.putExtra("com.SocketMobile.ScannerSettings.Symbology",
                        // symbologyName);
                        try {
                                // sendScanData(processedData);
                                new SendIntents().sendIntent(processedData);
                                Log.d(TAG, "Scan Intent Sent");
                        } catch (Exception e) {
                                Log.d(TAG, "Error = " + e.getMessage());
                        }
                }

private class SendIntents extends BroadcastReceiver {
                ProgressDialog dialog;

                @Override
                public void onReceive(Context arg0, Intent arg1) {
                        // TODO Auto-generated method stub

                }

                public void sendIntent(String msg) {
                        /*Intent intentsent = new Intent(
                                        
PickupItemsActivity.NOTIFY_DATA_ARRIVAL);
                        intentsent
                                        
.putExtra("com.guardianml.android.handset.Scan.Data", msg);
                        sendBroadcast(intentsent);*/
                        sendBroadcast(new Intent(
                                        
PickupItemsActivity.NOTIFY_DATA_ARRIVAL));
                        Log.d(TAG, "Sending Intent Sent");

                }
        }

-- 

2. How to use ListView in Tab?

Good day.
In my app I have three tab (one Activity extend TabActivity and others
activitys provides access to content). In first tab I have ImageView,
a few TextView and it is works. But when I add ListView and in
activity that contain ListView I add a few rows it was not show in may
tab.

Can someone tell me where I was wrong? Here my code:

In StartActivity:


        intent = new Intent().setClass(this,
GoodsAndShopsActivity.class);

        spec = tabHost.newTabSpec("shops").setIndicator("Shops",
                          res.getDrawable(R.drawable.ic_tab_shops))
                      .setContent(intent);
        tabHost.addTab(spec);

In GoodsAndShopsActivity:

    protected void onCreate(Bundle savedInstanceState) {
                super.onCreate(savedInstanceState);
                setContentView(R.layout.descriptions);

        m_shopsLayout = (ListView) findViewById(R.id.shops);

        m_shopList = new ArrayList<Shop>();
        m_shopAdapter = new ShopAdapter(m_shopList, this);
        m_shopsLayout.setChoiceMode(ListView.CHOICE_MODE_SINGLE);
        m_shopsLayout.setAdapter(m_shopAdapter);

        for (int i = 0; i<3; i++) {
                        m_shopList.add(new Shop("new description"));
                        m_shopAdapter.notifyDataSetChanged();
                }

        }
In class that extends BaseAdapter:

    @Override
        public View getView(int position, View convertView, ViewGroup parent)
{
                ViewHolder holder;
                if (convertView == null) {
                        convertView = m_inflater.inflate(R.layout.shop, null);

                        holder = new ViewHolder();
                        holder.descriptions = (TextView)
convertView.findViewById(R.id.shop);

                        convertView.setTag(holder);
                } else {
                        holder = (ViewHolder) convertView.getTag();
                }
                String textOnView = m_shops.get(position).getDescription();
                holder.descriptions.setText(textOnView);
                return convertView;
        }

        static class ViewHolder{
                TextView descriptions;
        }
And my xml where define ListView (Sorry that so much):

    <RelativeLayout
        xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent">

        <LinearLayout
                android:id="@+id/full_info"
                android:layout_width="wrap_content"
        android:layout_height="wrap_content">

        <ImageView
                android:id="@+id/icon"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"

                android:layout_margin="10px"
                android:src="@drawable/icon">
        </ImageView>

        <LinearLayout
                android:id="@+id/short_info"
                android:orientation="vertical"
                android:layout_width="fill_parent"
                android:layout_height="wrap_content"
                android:layout_toRightOf="@id/icon"
                android:layout_alignParentRight="true">

                <TextView
                        android:id="@+id/name_for_good"
                android:layout_width="fill_parent"
                android:layout_height="0dip"
                android:layout_weight="1"
                android:gravity="center_vertical"
                android:text=" ">
            </TextView>

                <TextView
                        android:id="@+id/best_price"
                android:layout_width="fill_parent"
                android:layout_height="0dip"
                android:layout_weight="1"

                android:singleLine="true"
                android:ellipsize="marquee"
                android:text=" : ">
            </TextView>

                        <TextView
                                android:id="@+id/worst_price"
                android:layout_width="fill_parent"
                android:layout_height="0dip"
                android:layout_weight="1"
                android:text=" : ">
            </TextView>

        </LinearLayout>
        </LinearLayout>
        <LinearLayout
                android:id="@+id/description_and_shop"
                android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:layout_below="@id/full_info">

        <TextView
                android:id="@+id/description"
                        android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            android:text="     
,   ..">
        </TextView>

                <ScrollView
                        android:id="@+id/ScrollView"
                        android:layout_width="fill_parent"
                        android:layout_height="fill_parent">
                        <ListView
                                android:id="@+id/shops"
                                android:layout_width="fill_parent"
                                android:layout_height="fill_parent">
                        </ListView>
                </ScrollView>

        </LinearLayout>
</RelativeLayout>

-- 

3. Multiple Sliding Drawers in a ListView

4. Manually Dispatch Key Event

5. Sync contact

6. To know how emailprovider.db gets populated

7. Not able to include jndi.jar in Android Project