top button
Flag Notify
    Connect to us
      Site Registration

Site Registration

How to launch an activity in android?

+2 votes
591 views
How to launch an activity in android?
posted Jan 24, 2017 by Farhan

Looking for an answer?  Promote on:
Facebook Share Button Twitter Share Button LinkedIn Share Button

Similar Questions
+2 votes

I want to open another application from my application. I know I should use Intent for that, but I am not sure how to use that.

+1 vote

I use this code to save the contents of a textbox to an array, i want display this array in a list view on another activity.
any idea about this? thanks.

txt = (TextView)findViewById(R.id.name);
show = (ListView)findViewById(R.id.mygardenlist);
add = (Button)findViewById(R.id.btnAdd);
add.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
    String getInput = txt.getText().toString();
    if(addArray.contains(getInput)) {
        Toast.makeText((getBaseContext()), "Plant Already Added", Toast.LENGTH_LONG).show();
    }
    else {
        addArray.add(getInput);
        ArrayAdapter<String> adapter = new ArrayAdapter<String>(SingleItemView.this, android.R.layout.simple_list_item_1, addArray);
        show.setAdapter(adapter);
        ((TextView)findViewById(R.id.name)).setText(" ");
    }
}
});
+3 votes

Hi, I have used the below sample code downloaded from a website and it is crashing.

Intent sendIntent = new Intent();
sendIntent.setAction(Intent.ACTION_SEND);
sendIntent.putExtra(Intent.EXTRA_TEXT, textMessage);
sendIntent.setType(HTTP.PLAIN_TEXT_TYPE); // "text/plain" MIME type
startActivity(sendIntent);

Let me know the possible solution.

...