2016-07-26 75 views
0

我有ListViewImagebuttonsEditText。我怎樣才能按下按鈕,並保存在按鈕行上的EditText
我在onClick內創建了哪些代碼?保存EditText與按鈕稍後調用

public View getView(int position, View convertView, ViewGroup parent) { 

    View linha = mInflater.inflate(R.layout.suport_activity, parent, false); 

    ImageButton ib = (ImageButton) convertView.findViewById(R.id.image_adicionar); 
    ib.setImageDrawable(getResources().getDrawable(R.drawable.add_car)); 

    ImageButton carrinhoButton = (ImageButton) linha.findViewById(R.id.image_adicionar); 
    carrinhoButton.setOnClickListener(new View.OnClickListener() { 

     @Override 
     public void onClick(View v) { 
      Intent intent = new Intent(MainActivity.class, CarrinhoActivity.class); 

     } 
    }); 
} 
+0

請張貼列表項的XML – humazed

回答

-2
public IssoActivity { 

ImageButton ib; 

ImageButton carrinhoButton; 

boolean ib; 
boolean carrinhoButton; 

EditText issoText; 

public View getView(int position, View convertView, ViewGroup parent) { 

    View linha = mInflater.inflate(R.layout.suport_activity, parent, false); 

    ib = (ImageButton) convertView.findViewById(R.id.image_adicionar); 
    ib.setImageDrawable(getResources().getDrawable(R.drawable.add_car)); 

    carrinhoButton = (ImageButton) linha.findViewById(R.id.image_adicionar); 
    carrinhoButton.setOnClickListener(new View.OnClickListener() { 

     @Override 
     public void onClick(View v) { 
      Intent intent = new Intent(MainActivity.class, CarrinhoActivity.class); 
if (ib) 
IssoActivity.issoText.setText("Clicked IB"); 

if (carinhoButton) 
IssoActivity.issoText.setText("Clicked Carinho Button"); 

     } 
    }); 
}