is there a way to create a menu from scratch?

by ~ TreKing » Fri, 23 Apr 2010 02:46:30 GMT


Sponsored Links
 



... because ... ?

-------------------------------------------------------------------------------------------------
TreKing - Chicago transit tracking app for Android-powered devices
 http://sites.google.com/site/rezmobileapps/treking 

--



Other Threads

1. how to retrieve music file information

i m developing a music player and i want to display mp3 file
information like title, album, artwork when clicked on the song.
plz help..

-- 

2. How do I assign each of my ListView list items an individual icon?

Hi,

I'm very new to Android and Java delelopment, searching and reading
various tutorials and using different parts of code from around the
internet, trying to make sense of it as I go. Forgive me if my
explanation isn't too great.

Currently I have a list created with 4 list items, what I'd like to do
is assign a different icon to each of these list items, however, I've
no idea how to do it, nor do I know what to search for.

Here's the code:

main.xml

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/
android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent">

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

</LinearLayout>

row.xml

<TextView xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/rowTextView"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:padding="10dp"
    android:textSize="16sp" >
 </TextView>

FirstList.java

import java.util.ArrayList;
import java.util.Arrays;

import android.app.Activity;
import android.os.Bundle;
import android.widget.ArrayAdapter;
import android.widget.ListView;

public class FirstList extends Activity {

private ListView mainListView;
private ArrayAdapter<String> myListAdapter;

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

    mainListView = (ListView) findViewById( R.id.mainListView);

    String[] myList = new String[] {"List 1", "List 2", "List 3",
"List 4"};

    ArrayList<String> listObjects = new ArrayList<String>();
    listObjects.addAll( Arrays.asList(myList));

    myListAdapter = new ArrayAdapter<String>(this, R.layout.row,
listObjects);

    mainListView.setAdapter(myListAdapter);

    }
}

I'd appreciate any input you have, including any resources that you
may recommend or critique of my code, as a newbie I'd rather not pick
up bad habits from the start!

Thanks.

-- 

3. how to insert images in edittext

4. how to exit touch mode in Android

5. Saving data to SQL lite

6. JavaScript Debugging

7. /dev/mydev permissions after insmod from init.rc