i have a question about android device

by minchoo » Wed, 29 Apr 2009 01:07:57 GMT


Sponsored Links
 hello
I'm interest to develop android application.

but I have a question about android device.
Will every device that use android OS has physical 5-way direction
keys and 5 main keys(call, call end, home, menu, back)?
In the documents for developers, I read that developers can assume
those keys to develop application, but i'm wonder that those physical
keys are mendatory things for device manufacture company.
If the device doesnt's support those physical keys, is it okey to use
applications which are sold in android market?

Plz let me know that can i assum and use those keys to develope my
application.
Thanx!

--~--~---------~--~----~------------~-------~--~----~



Other Threads

1. Not all views are displayed

First, let me say I've only briefly searched for this on the forum, as
I'm not sure what exactly the problem is, only the consequence of it,
making it hard to problem-find.

Anyway,

I'm making my own first Android app, an app for displaying recipes.
I've read through most of the dev guide, and gone through the NotePad
examples but I just can't figure out this problem I'm having, but I'm
sure it's just some newbie problem.

My main screen is a list of categories defined in an XML file, and
I've populated it fine.
Once a recipe is selected, is where my problems enter.

I've defined my view in recipes_view.xml as follows:

<?xml version="1.0" encoding="utf-8"?>

<LinearLayout xmlns:android=" http://www.***.com/ 
android"
        android:orientation="vertical" android:layout_width="fill_parent"
        android:layout_height="fill_parent">

<LinearLayout xmlns:android=" http://www.***.com/ 
android"
        android:orientation="horizontal" android:layout_width="fill_parent"
        android:layout_height="fill_parent">
<ImageView android:layout_width="wrap_content"
android:layout_height="wrap_content" android:text="@+id/RecipePicture"
android:id="@+id/RecipePicture"></ImageView>
<LinearLayout xmlns:android=" http://www.***.com/ 
android"
        android:orientation="vertical" android:layout_width="fill_parent"
        android:layout_height="fill_parent">
<TextView android:text="@+id/DifficultyView"
android:layout_width="wrap_content"
android:layout_height="wrap_content" android:id="@+id/
DifficultyView"></TextView>
<TextView android:text="@+id/RatingView"
android:layout_width="wrap_content"
android:layout_height="wrap_content" android:id="@+id/RatingView"></
TextView>
</LinearLayout>
</LinearLayout>
<ListView android:text="@+id/IngredientsList"
android:layout_width="wrap_content"
android:layout_height="wrap_content" android:id="@+id/
IngredientsList"></ListView>
<TextView android:text="@+id/DirectionsView"
android:layout_width="wrap_content"
android:layout_height="wrap_content" android:id="@+id/
DirectionsView"></TextView>
</LinearLayout>

This should be fairly simple, though it employs several LinearLayouts
in vertical / horizontal orientations.

I've then defined RecipeView.java, in which I set the content view in
onCreate:
setContentView(R.layout.recipe_view);

My problem is, that when I populate this view, only the DifficultyView
and RatingView actually shows up.
I could perhaps see why the ImageView and the ListView do not show up
- I could have messed up something there - but the final TextView
(DirectionsView) also does not show up, strangely.

To populate the DirectionsView with data I do the following:

TextView directionsView = (TextView)
findViewById(R.id.DirectionsView);
//Get the description
String desc = recipeCursor.getString(2);
directionsView.setText(desc);
directionsView.setVisibility(TextView.VISIBLE);

My de{*filter*} clearly shows that desc is non-empty, non-null string.

I've tried everything I can think of to no avail.

Cheers in advance!

-- 

2. How fix bookmark鈥檚 list item click listener

I read bookmarks from database, show it by a listview, but when click
list item it can't load url correctly, some codes from browser app
source.

I have not much experience about android and java, this trouble have
confused me two days

Thanks for your help

public class bookmarks extends Activity {
private Cursor bookmarks;
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.main);

    bookmarks = Browser.getAllBookmarks(getContentResolver());
    int urlColumn =
bookmarks.getColumnIndex(android.provider.Browser.BookmarkColumns.URL);
    Cursor results;
    String[] proj = new String[]{
        android.provider.Browser.BookmarkColumns.URL,
        android.provider.Browser.BookmarkColumns.TITLE
    };
    int[] to = new int[]{
        android.R.id.text2,
        android.R.id.text1
    };

    String whereClause;
    String orderBy = Browser.BookmarkColumns.VISITS + " DESC";
    whereClause = Browser.BookmarkColumns.BOOKMARK + " != 0";

    results = managedQuery(Browser.BOOKMARKS_URI,
            Browser.HISTORY_PROJECTION, whereClause, null, orderBy);
    startManagingCursor(results);

    ListAdapter adapter = new SimpleCursorAdapter(this,
android.R.layout.simple_list_item_2, results, proj, to);
    ListView myListView = (ListView) findViewById(R.id.list);
    myListView.setAdapter(adapter);
    myListView.setOnItemClickListener(mListener);       // 

}

// 
private AdapterView.OnItemClickListener mListener = new
AdapterView.OnItemClickListener() {
    @Override
    public void onItemClick(AdapterView<?> adapterView, View v, int
position, long id) {
        // TODO Auto-generated method stub
        loadUrl(position);
    }

};

// 
private void loadUrl(int position) {
    Intent intent = (new Intent()).setAction(getUrl(position));
    setResultToParent(RESULT_OK, intent);
    finish();
}

public String getUrl(int position) {
    String url = getString(Browser.HISTORY_PROJECTION_URL_INDEX,
position);
    return url;
}

// This Activity is generally a sub-Activity of
CombinedHistoryActivity. In
// that situation, we need to pass our result code up to our parent.
// However, if someone calls this Activity directly, then this has no
// parent, and it needs to set it on itself.
private void setResultToParent(int resultCode, Intent data) {
    Activity a = getParent() == null ? this : getParent();
    a.setResult(resultCode, data);
}

-- 

3. Do i need to call DatabaseHelper.close()?

4. Access resources from another application

5. Quick Search

6. Module Installation

7. Android Calendar and Time Zone Shifts