English 中文(简体)
密码是多少? 代码是多少? 写在案件元元中?
原标题:what is the code shoulb be written inside case statmenet
  • 时间:2012-05-28 06:51:37
  •  标签:
  • android

我点击时在机器人体内创建了一个按钮检查数据, 它没有做任何事情。 。 。

switch(v.getId()){

        case R.id.Button01add:
            showDialog(DIALOG_ID);
            break;

        case R.id.Button01check:
             break;
        时 时

when i click on add it shows some dialog which pops up like that i want to display images which are saved in database when i click on check button this is my checkdata.java

public class CheckData extends ListActivity  {     
    TextView selection;
    DataManipulator dm;
    private DataManipulator DbHelper;
private Object testFruit;
    protected void onCreate(Bundle savedInstanceState){
    super.onCreate(savedInstanceState);
    setContentView(R.layout.check);
    dm = new DataManipulator(this);

    LinearLayout layout = new LinearLayout(this);
    ImageView image = new ImageView(this);
    DbHelper = new DataManipulator(this);

    DbHelper.open();
    DbHelper.createFruitEntry((Fruit) testFruit);
    DbHelper.close();

    testFruit = null;

    DbHelper.open();
    testFruit = DbHelper.getFirstFruitFromDB();
    DbHelper.close();

    image.setImageBitmap(((Fruit) testFruit).getBitmap());

    ViewGroup.LayoutParams params = new ViewGroup.LayoutParams(
                                    LinearLayout.LayoutParams.WRAP_CONTENT,
                                    LinearLayout.LayoutParams.WRAP_CONTENT);

    setContentView(layout);
    addContentView(image, params);
时 时

时 时

在此情况下的语句之间应该写出什么内容, 这样我可以看到保存在数据库中的图像 。

最佳回答
public class TestActivity extends Activity implements OnClickListener {
    /** Called when the activity is first created. */
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);

  Button aboutButton =(Button)findViewById(R.id.about_content);
        aboutButton.setOnClickListener(this);
    }
public void onClick(View v) {
        switch (v.getId()) {
        case R.id.about_content:
        break;
        // More buttons go here (if any) ...
        }
    }
}

尝试像上面的代码。

问题回答

暂无回答




相关问题
Android - ListView fling gesture triggers context menu

I m relatively new to Android development. I m developing an app with a ListView. I ve followed the info in #1338475 and have my app recognizing the fling gesture, but after the gesture is complete, ...

AsyncTask and error handling on Android

I m converting my code from using Handler to AsyncTask. The latter is great at what it does - asynchronous updates and handling of results in the main UI thread. What s unclear to me is how to handle ...

Android intent filter for a particular file extension?

I want to be able to download a file with a particular extension from the net, and have it passed to my application to deal with it, but I haven t been able to figure out the intent filter. The ...

Android & Web: What is the equivalent style for the web?

I am quite impressed by the workflow I follow when developing Android applications: Define a layout in an xml file and then write all the code in a code-behind style. Is there an equivalent style for ...

TiledLayer equivalent in Android [duplicate]

To draw landscapes, backgrounds with patterns etc, we used TiledLayer in J2ME. Is there an android counterpart for that. Does android provide an option to set such tiled patterns in the layout XML?

Using Repo with Msysgit

When following the Android Open Source Project instructions on installing repo for use with Git, after running the repo init command, I run into this error: /c/Users/Andrew Rabon/bin/repo: line ...

Android "single top" launch mode and onNewIntent method

I read in the Android documentation that by setting my Activity s launchMode property to singleTop OR by adding the FLAG_ACTIVITY_SINGLE_TOP flag to my Intent, that calling startActivity(intent) would ...

From Web Development to Android Development

I have pretty good skills in PHP , Mysql and Javascript for a junior developer. If I wanted to try my hand as Android Development do you think I might find it tough ? Also what new languages would I ...

热门标签