我正在尝试使用Android应用程序供我个人使用,我正在尝试在我的应用中使用标签。
有一个撰写标签,用户填写所需的数据,用户选择发送或丢弃的菜单选项。[不允许我在这里发布我的照片]
假设所有内容都已填满,当用户点击发送时,我想打开主页选项卡。 这对我来说很难实现。 建议表示赞赏。
由于
我的代码:
import android.app.TabActivity;
import android.content.Intent;
import android.content.res.Resources;
import android.os.Bundle;
import android.widget.TabHost;
public class MainActivity extends TabActivity {
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
Resources resources = getResources();
TabHost tabHost = getTabHost();
TabHost.TabSpec tabSpec;
Intent intent;
intent = new Intent(getApplicationContext(),Home.class);
tabSpec = tabHost.newTabSpec("hulak").setIndicator("Home",
resources.getDrawable(R.drawable.ic_tab_artists)).setContent(intent);
tabHost.addTab(tabSpec);
intent = new Intent(getApplicationContext(),Compose.class);
tabSpec = tabHost.newTabSpec("compose").setIndicator("Compose",
resources.getDrawable(R.drawable.ic_tab_artists)).setContent(intent);
tabHost.addTab(tabSpec);
intent = new Intent(getApplicationContext(),Inbox.class);
tabSpec = tabHost.newTabSpec("inbox").setIndicator("Inbox",
resources.getDrawable(R.drawable.ic_tab_artists)).setContent(intent);
tabHost.addTab(tabSpec);
intent = new Intent(getApplicationContext(),Sent.class);
tabSpec = tabHost.newTabSpec("Sent").setIndicator("Sent",
resources.getDrawable(R.drawable.ic_tab_artists)).setContent(intent);
tabHost.addTab(tabSpec);
tabHost.bringToFront();
tabHost.setCurrentTab(0);
}
}
ComposeActivity
import android.app.Activity;
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuItem;
import android.widget.ArrayAdapter;
import android.widget.MultiAutoCompleteTextView;
public class Compose extends Activity {
MultiAutoCompleteTextView myMultiAutoCompleteTextView;
String item[]={
"robin@hotmail.com", "sabin@hotmail.com", "rishi@hotmail.com",
"Kumud@gmail.com", "robin@gmail.com",
"deepak@hotmail.com"};
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.compose);
MultiAutoCompleteTextView myMultiAutoCompleteTextView
= (MultiAutoCompleteTextView)findViewById(R.id.composeEmailID);
myMultiAutoCompleteTextView.setAdapter(
new ArrayAdapter<String>(this,
android.R.layout.simple_dropdown_item_1line, item));
myMultiAutoCompleteTextView.setThreshold(0);
myMultiAutoCompleteTextView.setTokenizer(
new MultiAutoCompleteTextView.CommaTokenizer());
}
public boolean onCreateOptionsMenu(Menu menu){
super.onCreateOptionsMenu(menu);
getMenuInflater().inflate(R.menu.compose_menu, menu);
return true;
}
public boolean onContextItemSelected(MenuItem item){
switch(item.getItemId()){
}
return super.onContextItemSelected(item);
}
}