函数修改2d数组以使用realloc添加行和列

时间:2015-04-30 08:04:25

标签: c segmentation-fault malloc realloc

这个函数有什么问题,预计会在给定的2D数组中添加一行和一列?矩阵是对称的。

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

        Spinner spinnerTaglia = (Spinner) findViewById(R.id.spinnerTaglia);

    // Create an ArrayAdapter using the string array and a default spinner layout ArrayAdapter<CharSequence> adapter = ArrayAdapter.createFromResource(this,     R.array.Taglie, android.R.layout.simple_spinner_item); 

    // Specify the layout to use when the list of choices appears adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); 
        spinnerTaglia.setPrompt("Seleziona la taglia!");

    // Apply the adapter to the spinner 
        spinnerTaglia.setAdapter(new NothingSelectedSpinnerAdapter(
                adapter, 
                R.layout.contact_spinner_row_nothing_selected,
                // R.layout.contact_spinner_nothing_selected_dropdown, // Optional 
                this));




        Button btnCompilaOrdine = (Button) findViewById(R.id.btnCompilaOrdine);
        btnCompilaOrdine.setOnClickListener(new View.OnClickListener(){

            public void onClick(View arg0) {

        //Get the Selected item from the spinner
        final String taglia = spinnerTaglia.getSelectedItem().toString();
        Intent i = new Intent(Intent.ACTION_SEND);
        i.setType("message/rfc822");
        i.putExtra(Intent.EXTRA_EMAIL  , new String[]{"MAIL@gmail.com"});
        i.putExtra(Intent.EXTRA_SUBJECT, "MAIL OBJECT");
        i.putExtra(Intent.EXTRA_TEXT   , "Taglia: "+taglia);
        try { 
            startActivity(Intent.createChooser(i, "Send mail..."));
        } catch (android.content.ActivityNotFoundException ex) {
            Toast.makeText(Modulo.this, "There are no email clients installed.", Toast.LENGTH_SHORT).show();
        } 

        } 
        }); 
    } 

0 个答案:

没有答案