Android 你的列表视图? 11-07 11:55:30.805: W/Bundle(1393): Key id expected Integer but value was a java.lang.Long. The default value 0 was ret

Android 你的列表视图? 11-07 11:55:30.805: W/Bundle(1393): Key id expected Integer but value was a java.lang.Long. The default value 0 was ret,android,mysql,listview,Android,Mysql,Listview,你的列表视图? 11-07 11:55:30.805: W/Bundle(1393): Key id expected Integer but value was a java.lang.Long. The default value 0 was returned. 11-07 11:55:30.835: W/Bundle(1393): Attempt to cast generated internal exception: 11-07 11:55:30.835: W/Bundle(1393

你的列表视图?
11-07 11:55:30.805: W/Bundle(1393): Key id expected Integer but value was a java.lang.Long.  The default value 0 was returned.
11-07 11:55:30.835: W/Bundle(1393): Attempt to cast generated internal exception:
11-07 11:55:30.835: W/Bundle(1393): java.lang.ClassCastException: java.lang.Long cannot be cast to java.lang.Integer
11-07 11:55:30.835: W/Bundle(1393):     at android.os.Bundle.getInt(Bundle.java:1000)
11-07 11:55:30.835: W/Bundle(1393):     at android.os.Bundle.getInt(Bundle.java:982)
11-07 11:55:30.835: W/Bundle(1393):     at com.reserveme.RestaurantInformation.onCreate(UserInformation.java:53)
11-07 11:55:30.835: W/Bundle(1393):     at android.app.Activity.performCreate(Activity.java:5231)
11-07 11:55:30.835: W/Bundle(1393):     at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1087)
11-07 11:55:30.835: W/Bundle(1393):     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2159)
11-07 11:55:30.835: W/Bundle(1393):     at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2245)
11-07 11:55:30.835: W/Bundle(1393):     at android.app.ActivityThread.access$800(ActivityThread.java:135)
11-07 11:55:30.835: W/Bundle(1393):     at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1196)
11-07 11:55:30.835: W/Bundle(1393):     at android.os.Handler.dispatchMessage(Handler.java:102)
11-07 11:55:30.835: W/Bundle(1393):     at android.os.Looper.loop(Looper.java:136)
11-07 11:55:30.835: W/Bundle(1393):     at android.app.ActivityThread.main(ActivityThread.java:5017)
11-07 11:55:30.835: W/Bundle(1393):     at java.lang.reflect.Method.invokeNative(Native Method)
11-07 11:55:30.835: W/Bundle(1393):     at java.lang.reflect.Method.invoke(Method.java:515)
11-07 11:55:30.835: W/Bundle(1393):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:779)
11-07 11:55:30.835: W/Bundle(1393):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:595)
11-07 11:55:30.835: W/Bundle(1393):     at dalvik.system.NativeStart.main(Native Method)
public class Users extends Activity {

ListView listView;
TextView textView;
private StockAdaptor stockAdaptor;
String jsonResult = null;
ImageView image;
String info;

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.users); //Just a listView, shown below
    listView = (ListView) findViewById(android.R.id.list);
    textView = (TextView) findViewById(R.id.name);
    textView = (TextView) findViewById(R.id.rest_id);
    textView = (TextView) findViewById(R.id.info);
    image = (ImageView) findViewById(R.id.image);
    new JsonReadTask().execute("http://link.to.site/GetUsers.php");

    RelativeLayout.LayoutParams lp = new RelativeLayout.LayoutParams(listView.getLayoutParams());
    lp.setMargins(10, 10, 0, 0);
    listView.setLayoutParams(lp);

    listView.setOnItemClickListener(new AdapterView.OnItemClickListener() {

        @Override
        public void onItemClick(AdapterView<?> parent, final View view, int position, long id) {
            Intent intent = new Intent(Users.this, UserInformation.class);
            //intent.putExtra("id", position);
            intent.putExtra("id", stockAdaptor.getItemId(position));
            intent.putExtra("info", info);
            //intent.putExtra("text", text);
            startActivity(intent);
        }

    });
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
    return true; //No options
}

public void onStart() {
    super.onStart();

    stockAdaptor = new StockAdaptor(this); //Create a new StockAdaptor
}

public static String strFromStream(InputStream in) throws IOException { //Simple function, getting a String from an InputStream
    StringBuilder out = new StringBuilder();
    BufferedReader breader = new BufferedReader(new InputStreamReader(in));
    String cline;
    String newLine = System.getProperty("line.separator");
    while ((cline = breader.readLine()) != null) {
        out.append(cline);
        out.append(newLine);
    }
    return out.toString();
}

private class StockAdaptor extends BaseAdapter { //The stocks list adaptor

    class ViewHolder {
        TextView id;
        TextView name;
        TextView info;
        ImageView image; 
    }

    private LayoutInflater layoutInflater;
    private RestaurantStrings[] stocks = null; //Array of stocks
    private ListView stocksListView = null;

    public StockAdaptor(Context context) {
        super();
        layoutInflater = LayoutInflater.from(context);
    }

    public void setStockList(RestaurantStrings[] stocksinfo) {
        this.stocks = stocksinfo;// //////////////LITERALLY THIS

    }

    @Override
    public int getCount() {
        return stocks.length;
    }

    @Override
    public Object getItem(int position) {
        return stocks[position];
    }
    public RestaurantStrings[] getAll() { //Return the array of stocks
        return stocks;
    }

    @Override
    public long getItemId(int position) {
        return stocks[position].id;
    }

    public View getView(int position, View convertView, ViewGroup parent) {
        ViewHolder holder; //New holder
        if (convertView == null) {
            convertView = layoutInflater.inflate(R.layout.users_second, null);
            holder = new ViewHolder();
            // Creates the new viewHolder define above, storing references to the children
            holder.id = (TextView) convertView.findViewById(R.id.rest_id);
            holder.name = (TextView) convertView.findViewById(R.id.name);
            holder.info = (TextView) convertView.findViewById(R.id.info);

            if (holder.image != null) {
                if (holder.image.getDrawable() == null) {
                    new ImageDownloaderTask(holder.image, null)                                 
                    .execute(stocks[position].image); //Download the image using the image

                }
            }
            convertView.setTag(holder);
        } else {

            holder = (ViewHolder) convertView.getTag();
        }

        //holder.id.setText(stocks[position].id);
        holder.name.setText(stocks[position].name);
        holder.info.setText(stocks[position].info);

        return convertView;
    }
}
// some more code below ( image download, json response ... etc)
public class UserInformation extends Activity {

String info;
int rest_id;
TextView textView;

@Override
    protected void onCreate(Bundle savedInstanceState) {
            super.onCreate(savedInstanceState);
            setContentView(R.layout.user_informations);

    textView = (TextView) findViewById(R.id.rest_id);
    textView = (TextView) findViewById(R.id.info);

    Bundle b = getIntent().getExtras();
    if (b != null) {
        rest_id = b.getInt("id");
        textView.setText(rest_id+"");
        info = b.getString("info");
        textView.setText(info+"");
    }

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

<LinearLayout
    android:layout_width="300dp"
    android:layout_height="0dp"
    android:layout_marginLeft="10dp"
    android:layout_marginTop="5dp"
    android:layout_weight="13.07"
    android:background="@drawable/restaurants_buttons"
    android:orientation="horizontal" >
    <TextView
        android:id="@+id/info"
        android:layout_width="280dp"
        android:layout_height="wrap_content"
        android:paddingBottom="10dp"
        android:paddingLeft="5dp"
        android:paddingTop="5dp"
        android:text="" />
    <TextView
        android:id="@+id/rest_id"
        android:layout_width="300dp"
        android:layout_height="wrap_content"
        android:paddingBottom="5dp"
        android:paddingTop="15dp" />


</LinearLayout>
</LinearLayout>
int rest_id;
long rest_id;
rest_id = b.getInt("id");
rest_id = b.getLong("id");