[android-developers] Android Back Button Handling Issue
My App starts with a splash screen loading background data from remote server. After completion of data load, An Activity(say B) launched. This activity B (A photo Gallery of different Animals), when pressed back launches SplashScreen, so inorder to solve this, i prompt user if it really wants to exit the app, if clicked yes, exit closes. private void exitApp(){ B.this.finish(); } My issues comes here. Since Activity B, when clicks on Particular Animals say DOG, Intent intent = new Intent(B.this,C.class) startActivity(Intent); takes the user to Activity (C) reviews of particular Animals. When back button is pressed on C, takes me to B, thats fine. Since B has menu options, such as bookmark,Home. i do Launch BOOKMARK as with sartActivity(B.this, Bookmark.class); Since BookMark has menu for HOME i.e Activity B. And now when i pressed back, it prompts me to Exit but it does exit the app rather takes me to BOOKMARK. Can i solve this issues? As i was reading the doc, i found `finishActivityFromChild(Activity, requestCode);` can this help me achieve? -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] Efficeint Handling of Multipart SMS or Long SMS in Android
I have a few questions on Android SMSManager. 1. How do I send long SMS, say more than 160 characters. My application send SMS as an email when there is no wifi/data connection. The SMS as email is retrieved by the server and the server sent a msg: Your email has been recieved. How do I show this message on my custom dailog, 2. How do I retrieve long SMS? My application would even allow an user to retrieve emails from the server as an sms when no wifi/data connection found? 3. Four of my activity is supposed to send/recieve sms, so do i need to have multiple BroadcastReciecver for each activity or can i simple handle with one BroadcastReciever? Can i have a snippet code on such? 4. Is there a mechanism to sync the device apps and my email server. Currently i part of code handles as all above. But i know my codes are in-efficeint. Thats one reason i have such question. Please bear my question. -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] ListView Data disappears
Dear All, I have a listview with checkbox. I have a menu which makes the list hide/unhide the checkbox. When i hit my menu 3 to 4 times with hide and unhide the checkbox, the data in listview disappears? Why is this happening? -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] Re: i have problem about listview adding can any one help me?
Where is the problem? On Aug 31, 2:09 pm, Jhew SAN tawisak.ruksu...@gmail.com wrote: package com.cityweather; import java.io.FileInputStream; import java.io.FileOutputStream; import java.io.IOException; import java.io.InputStreamReader; import java.io.OutputStreamWriter; import java.net.MalformedURLException; import java.net.URL; import java.util.ArrayList; import javax.xml.parsers.ParserConfigurationException; import javax.xml.parsers.SAXParser; import javax.xml.parsers.SAXParserFactory; import org.xml.sax.InputSource; import org.xml.sax.SAXException; import org.xml.sax.XMLReader; import com.cityweather.OZWFGoogleWeatherAPIData; import com.cityweather.OZWFXMLHandler; import android.app.Activity; import android.app.AlertDialog; import android.app.ListActivity; import android.content.Context; import android.content.DialogInterface; import android.content.Intent; import android.os.Bundle; import android.util.Log; import android.view.LayoutInflater; import android.view.View; import android.view.View.OnClickListener; import android.view.ViewGroup; import android.widget.ArrayAdapter; import android.widget.AutoCompleteTextView; import android.widget.BaseAdapter; import android.widget.Button; import android.widget.EditText; import android.widget.ListView; import android.widget.TextView; import android.widget.Toast; public class MyLocationActivity extends ListActivity implements OnClickListener { TextView selection; EditText et; AutoCompleteTextView at; String data[]={}; public static int state = 0; public static String city = ; static final String[] COUNTRIES = new String[] { Harare,Lusaka,Kampala,Tunis,Mbabane,Paramaribo,Khartoum,Pret oria,Mogadishu,Freetown,Victoria,Dakar,Kigali,Abuja,Niamey, Wimdhoek,Maputo,Rabat,Port Louis,Bamako,Lilongwe,Antananarivo,Tripoli,Monrovia,Maseru,Ta rawa,Nairobi,Bissau,Conakry,Accra,Banjul,Libreville,Asmara, Malabo,Cairo,Djibouti,Brazzaville,Moroni,Bangul,Praia,Yaounde ,Bujumbura,Ouagadougou,Garborone,Porto-Novo,Algiers,Hanoi,Tas hkent,Ashkhabad,Bangkok,Dushanbe,Taipei,Colombo,Singapore,Man ila,Islamabad,Kathmandu,Yangon,Ulaanbaatar,Male,Kuala Lumpur,Vientiane,Bishkek,Seoul,Pyongyang,Astana,Tokyo,Jakarta ,New Delhi,Beijing,Phnom Penh,Manama,Baku,Yerevan,Kabul,Kamphaeng Phet,Chiang Rai,Chiang Mai,Tak,Nan ,Phichit,Phitsanulok,Phetchabun,Phrae,Mae Hong Son,Lampang,Sukhothai,Uttaradit ,Phayao,Chanthaburi,Chon Buri,Chai Nat,Trat,Nakhon Nayok,Nakhon Pathom,Nonthaburi ,Pathum Thani,Prachuap Khiri Khan,Prachin Buri,Phetchaburi,Rayong,Ratchaburi,Lop Buri ,Samut Prakan,Samut Songkhram,Samut Sakhon,Saraburi,Sing Buri,Suphan Buri ,Ang Thong,Sa Kaeo,Kalasin,Chaiyaphum,Yasothon,Maha Sarakham,Loei,Si Sa Ket ,Nong Khai,Udon Thani,Ubon Ratchathani,Mukdahan,Amnat Charoen,Nong Bua Lam Phu ,Krabi,Trang,Nakhon Si Thammarat,Narathiwat,Pattani,Phuket,Phatthalung ,Yala,Songkhla,Satun,Surat Thani ,}; public void onCreate(Bundle icicle) { super.onCreate(icicle); //WriteSettings(this, Skopje); data = ReadSettings(this).trim().split(,); data[data.length-1]=data[data.length-1].trim(); //Log.v(datodeka, data[30].toString()); setContentView(R.layout.lview); setListAdapter(new ArrayAdapterString(this, android.R.layout.simple_list_item_1, data)); selection = (TextView) findViewById(R.id.selection); //selection.setText(ReadSettings(this)); // button // Button del = (Button)findViewById(R.id.btDel); // del.setOnClickListener(new View.OnClickListener() { // // @Override // public void onClick(View v) { // // TODO Auto-generated method stub // Intent intent = new Intent(MyLocationActivity.this,PEdit.class); // startActivity(intent); // } // }); Button btnAdd = (Button) findViewById(R.id.btnAdd); btnAdd.setOnClickListener(this); } public class MyCustomAdapter extends BaseAdapter { private ArrayListString mData = new ArrayListString(); private LayoutInflater mInflater; public MyCustomAdapter(Activity context,String c) { mInflater = (LayoutInflater)getSystemService(Context.LAYOUT_INFLATER_SERVICE); } public void addItem(final String item) { mData.add(item); notifyDataSetChanged();} @Override public int getCount() { // TODO Auto-generated method stub return mData.size(); } @Override public Object getItem(int position) { // TODO Auto-generated method stub return mData.get(position); } @Override public long getItemId(int position) { // TODO Auto-generated method stub return position; } @Override public View getView(int position, View convertView, ViewGroup parent) { // TODO Auto-generated method stub ViewHolder holder = null; if (convertView == null) { convertView = mInflater.inflate(R.layout.item, null); holder = new ViewHolder(); holder.textView = (TextView)convertView.findViewById(R.id.text); convertView.setTag(holder);} else { holder = (ViewHolder)convertView.getTag();} holder.textView.setText(mData.get(position)); Log.i(test,test+ mData);
[android-developers] Unable to Uncheck CheckBox on ListView
Dear All, I have problem on unchecking the checkbox when a menu is fired.? I am using a baseAdapter where i have a getView() method as such: --- public View getView(final int position, View view, ViewGroup parent) { final ViewHolder viewHolder; if (view == null) { viewHolder = new ViewHolder(); view = layoutInfalter.inflate(R.layout.inbox_row, null); viewHolder.checkBox = (CheckBox) view.findViewById(R.id.inboxCheckId); if (INBOX_VIEW_MODE == -1) { viewHolder.checkBox.setVisibility(View.GONE); } else { InboxEmailAdapter.setInboxViewMode(1); viewHolder.checkBox.setVisibility(View.VISIBLE); checkedItems = new ArrayListInteger(); viewHolder.checkBox.setOnCheckedChangeListener(new OnCheckedChangeListener() { @Override public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) { if(isChecked){ viewHolder.checkBox.setId(inboxEmailList.get(position).getId()); checkedItems.add(viewHolder.checkBox.getId()); } } }); } viewHolder.emailFrom = (TextView) view.findViewById(R.id.inboxFrom); viewHolder.emailSubject = (TextView) view.findViewById(R.id.inboxSubject); view.setTag(viewHolder); } else { viewHolder = (ViewHolder) view.getTag(); } viewHolder.emailFrom.setText(inboxEmailList.get(position).getFrom()); viewHolder.emailSubject.setText(inboxEmailList.get(position).getSubject()); return view; } --- On my activity: I have a listView populated with checkbox? I select checkbox, it is being selected. On my Menu i have cancel button which on click should uncheck the selected checkbox? I am not being able to perform this? Any helps would really help me -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] Re: Unable to Uncheck CheckBox on ListView
Why is it so? for me it's working, well my view has slide modification as i need to hide intially the checkbox and all and as to that reason my view as above. Can you suggest me what seems incorrect in the getView() ? On Aug 26, 1:11 pm, Zsolt Vasvari zvasv...@gmail.com wrote: Obviously, given just that code, it's impossible to know to what's wrong, but initialized checkedItems in getView() looks very incorrect to me. On Aug 26, 3:48 pm, RobinDroid librain.ro...@gmail.com wrote: Dear All, I have problem on unchecking the checkbox when a menu is fired.? I am using a baseAdapter where i have a getView() method as such: --- -- -- public View getView(final int position, View view, ViewGroup parent) { final ViewHolder viewHolder; if (view == null) { viewHolder = new ViewHolder(); view = layoutInfalter.inflate(R.layout.inbox_row, null); viewHolder.checkBox = (CheckBox) view .findViewById(R.id.inboxCheckId); if (INBOX_VIEW_MODE == -1) { viewHolder.checkBox.setVisibility(View.GONE); } else { InboxEmailAdapter.setInboxViewMode(1); viewHolder.checkBox.setVisibility(View.VISIBLE); checkedItems = new ArrayListInteger(); viewHolder.checkBox.setOnCheckedChangeListener(new OnCheckedChangeListener() { @Override public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) { if(isChecked){ viewHolder.checkBox.setId(inboxEmailList.get(position).getId()); checkedItems.add(viewHolder.checkBox.getId()); } } }); } viewHolder.emailFrom = (TextView) view.findViewById(R.id.inboxFrom); viewHolder.emailSubject = (TextView) view.findViewById(R.id.inboxSubject); view.setTag(viewHolder); } else { viewHolder = (ViewHolder) view.getTag(); } viewHolder.emailFrom.setText(inboxEmailList.get(position).getFrom()); viewHolder.emailSubject.setText(inboxEmailList.get(position).getSubject()); return view; } --- -- -- On my activity: I have a listView populated with checkbox? I select checkbox, it is being selected. On my Menu i have cancel button which on click should uncheck the selected checkbox? I am not being able to perform this? Any helps would really help me -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] Issues with CheckBox setting checBox ID in a ListView
Dear All, I have a ListView in one of my Tab: Initially the Tab has empty ListView. In the Tab there is a menu with menu item such as EDIT,REFRESH. Firstly, Refresh is clicked and an sms is sent and via broadcastreciever i recieved the sms in the format: 1\nApple\ Sweet Apple\n2\nMango\nSweet Mango (id\n\fruitname\fruitcategory); I somehow parse this data and set it into the model class and added to an ArrayList. Then i used a BaseAdapter for the ListView where the checkbox is hidden initially. The listview appears. Now when EDIT is clicked i need to show the checkbox and the listview has a checkbox. My Problem lies here: On my baseAdapter on getView method i did this: viewHolder.checkBox.setId(fruitsList.get(position).getId()); // getId is frm the model class When edit is clicked, my menu changes to Delete and cancel. I am not being able to retrieve the id which i set in the checkBox? Is this not possible? -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] Re: Should i use multiple BroadCastReciever?
I solved it. Thank you for your replies. On Aug 2, 3:20 pm, Robinns librain.ro...@gmail.com wrote: Dear, I am pasting my code here. --- public class Inbox extends ActivityGroup { private ArrayListInboxEmailDAO inboxEmails = new ArrayListInboxEmailDAO(); private ListView listView; private ArrayListView trackViews; private InboxAdapter inboxAdapter; private String previewEmailFrom = ; private String previewEmailSubject = ; private int previewEmailId; private TextView smsMessage; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); requestWindowFeature(Window.FEATURE_NO_TITLE); setContentView(R.layout.inbox); Bundle bundle = new Bundle(); bundle = getIntent().getExtras(); boolean isRecieved = false; if (bundle != null) { isRecieved = bundle.getBoolean(smsRecievedForInbox); } trackViews = new ArrayListView(); smsMessage = (TextView) findViewById(R.id.smsMessage); listView = (ListView) findViewById(R.id.inboxEmailList); if (isRecieved) { smsMessage.setWidth(-5); smsMessage.setHeight(-5); } inboxEmails = InboxEmailDAO.parseContentForInboxEmails(); inboxAdapter = new InboxAdapter(getApplicationContext(), inboxEmails); listView.setAdapter(inboxAdapter); listView.setChoiceMode(ListView.CHOICE_MODE_MULTIPLE); ((InboxAdapter) inboxAdapter).notifyDataSetChanged(); trackViews.add(listView); listView.setOnItemClickListener(new OnItemClickListener() { @Override public void onItemClick(AdapterView? adapterView, View view, int position, long id) { Intent intent = new Intent(getApplicationContext(), EmailPreview.class); previewEmailId = inboxEmails.get(position).getId(); previewEmailFrom = inboxEmails.get(position).getFrom(); previewEmailSubject = inboxEmails.get(position).getSubject(); holdData(previewEmailId, previewEmailFrom, previewEmailSubject); Bundle bundle = new Bundle(); bundle.putInt(emailId, previewEmailId); bundle.putString(from, previewEmailFrom); bundle.putString(subject, previewEmailSubject); bundle.putInt(TAB_INDEX, 1); intent.putExtras(bundle); InboxAdapter.setInboxViewMode(2); View emailView = getLocalActivityManager().startActivity( EmailPreview, intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP)) .getDecorView(); Toast.makeText(getApplicationContext(), Sending to Preview: + previewEmailId, Toast.LENGTH_LONG).show(); trackViews.add(emailView); replaceView(emailView); } }); } @Override public void onStart(){ super.onStart(); IntentFilter filter = new IntentFilter(SMSInfo.SMS_FOR_INBOX); registerReceiver(new SMSRecieverForInbox(), filter);} @Override public void onStop(){ super.onStop(); unregisterReceiver(new SMSRecieverForInbox()); } @Override public void onBackPressed() { } @Override public boolean onPrepareOptionsMenu(Menu menu) { menu.clear(); MenuInflater inflater = getMenuInflater(); int mode = InboxAdapter.getInboxViewMode(); if (mode == 1) { inflater.inflate(R.menu.inbox_menu_after_edit, menu); } else if (mode == -1) { menu.clear(); inflater.inflate(R.menu.inbox_menu, menu); } else { menu.clear(); inflater.inflate(R.menu.inbox_email_preview_menu, menu); } return true; } @Override public boolean onOptionsItemSelected(MenuItem item) { switch (item.getItemId()) { case R.id.inboxEdit: if (listView.getCount() 0) { Toast.makeText(getApplicationContext(), No emails to edit., Toast.LENGTH_LONG).show(); break;} if (InboxAdapter.getInboxViewMode() == -1) { listView.setAdapter(new InboxAdapter(getApplicationContext(), inboxEmails)); InboxAdapter.setInboxViewMode(1);} break; case R.id.inboxRefresh: sendSmsToRetrieveEmail(inbox); break; case R.id.inboxNext: break; case R.id.inboxPrevious: break; case R.id.inbox_menu_after_edit_delete: deleteAfterEditEmailList(); break; case R.id.inbox_menu_after_edit_cancel: clearCheckedItems(); break; case R.id.email_preview_menu_delete: break; case R.id.email_preview_menu_reply: break; default: break; } return false; } private void clearCheckedItems() { for (int i = 0; i this.inboxAdapter.getCount(); i++) { LinearLayout linearyLay = (LinearLayout) this.listView .getChildAt(i); CheckBox checkBox = (CheckBox) linearyLay .findViewById(R.id.inboxCheckBoxId); if (checkBox.isChecked()) { checkBox.setChecked(false);} } ((InboxAdapter) inboxAdapter).notifyDataSetChanged(); } private void deleteAfterEditEmailList() { Toast.makeText(getBaseContext(), I am checking, Toast.LENGTH_SHORT) .show(); SparseBooleanArray booleanArray = listView.getCheckedItemPositions(); for (int i = 0; i listView.getCount(); i++) { if (booleanArray.get(i)) Toast.makeText(getBaseContext(), the selected index is + i, Toast.LENGTH_SHORT).show(); } } public void replaceView(View view) { setContentView(view); } private void holdData(int emailId, String from,
[android-developers] Re: Issues with CheckBox setting checBox ID in a ListView
Actually my listview is as: After refresh is clicked and the checkbox is invisible - Fruit Name: Apple Type: Sweet Apple - Fruit Name: Mango Type: Sweet Mango EDIT | Refresh -- When EDIT is clicked I need to have check box so that i can delete them if i dont want them: --- [] Fruit Name: Apple Type: Sweet Apple -- [] Fruit Name: Mango Type: Sweet Mango -- DELETE | CANCEL -- I need to know the id's of the check box so that when i click delete i can send an id separated with comma's via sms and notify my adapter that some items has been deleted. Any helps or way of doing this could help me solve my problem. -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] Re: Issues with CheckBox setting checBox ID in a ListView
Any hints on this? On Aug 2, 6:07 pm, RobinDroid librain.ro...@gmail.com wrote: Actually my listview is as: After refresh is clicked and the checkbox is invisible - Fruit Name: Apple Type: Sweet Apple - Fruit Name: Mango Type: Sweet Mango EDIT | Refresh -- When EDIT is clicked I need to have check box so that i can delete them if i dont want them: --- [] Fruit Name: Apple Type: Sweet Apple -- [] Fruit Name: Mango Type: Sweet Mango -- DELETE | CANCEL -- I need to know the id's of the check box so that when i click delete i can send an id separated with comma's via sms and notify my adapter that some items has been deleted. Any helps or way of doing this could help me solve my problem. -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] Re: TabHost with ListViews - Accessing elements
Is that really necessary because your tabhost has view content and on that content you have ure listview? So why not use your tabhost content view for that particular tab. On Aug 3, 4:13 am, Giorgio Torres giorgio.tor...@yahoo.com wrote: Hi, I have a TabHost that hosts 4 ListViews with some elements. I would like to know if it is possible to access those elements from the tabHost object. Exemplifying, i would like something like that: tab(0).getListViewElement(2).findViewById(R.id.name_textview) where tab(0) returns the first tab with a ListView, and getListViewElement(2) returns the 3rd element from that list. After that i can get some view of that row. -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] Should i use multiple BroadCastReciever?
I have to sent sms to server using certain keywords: For that reason i have used BroadCastReciever. In my app, there are around 8 keywords(such as A,B,C,D,E,F etc) and for each keyword i think i shouldn't use 8 BroadcastReciever. I implemented one broadcastreciever for a keyword say A. and populated the data on the listview. Now how can i resuse my same BroadcastReciever for another keyword say B. Any Suggestions -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] Multiple Activities within a Tab
Dear All, I am currently developing a tab based application to learn Android. I have 2 tabs: TAB1 and TAB2. I created tabs: thats fine: TAB1: is used to browser some files, dats ok as well. The problem is with tab2. TAB2 extends ActivityGroup: Why because i will has multiple activities within it and also different Menus: initially, the screen is empty and on menu i have four menuitems as such: - ?xml version=1.0 encoding=utf-8? menu xmlns:android=http://schemas.android.com/apk/res/android; item android:title=Edit android:id=@+id/edit / item android:title=Refresh android:id=@+id/refresh / item android:title=Next android:id=@+id/next / item android:title=Previous android:id=@+id/previous / /menu - @Override public boolean onCreateOptionsMenu(Menu menu) { MenuInflater menuInflater = getMenuInflater(); menuInflater.inflate(R.menu.inbox_menu, menu); return super.onPrepareOptionsMenu(menu); } -- When refresh is clicked i send an SMS to certain KEYWORD and from BroadCastReciever, i have my string data as: 1\n...@something.com\nHello\n2\a...@dosomething.com\nHello Help me and so on. I parse this data split by \n though i get strange character from the emulator and pass this data to datamodel. This data is used in the ListVIew. Once the listview is populated, when an edit menu item is clicked i need to show checkbox. How do i pefrom all this within this TAB2. Any suggestion as how to procceed. -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] Re: Multiple Activities within a Tab
Dear, Though i am learning android but i want to bring some application in the android market. I wish to have tabs for my application. If i dont use ActivityGroup, how can i have multiples view in the same tabs. On Jul 31, 12:02 am, Mark Murphy mmur...@commonsware.com wrote: On Sat, Jul 30, 2011 at 2:54 PM, RobinDroid librain.ro...@gmail.com wrote: I am currently developing a tab based application to learn Android. I have 2 tabs: TAB1 and TAB2. I created tabs: thats fine: TAB1: is used to browser some files, dats ok as well. The problem is with tab2. TAB2 extends ActivityGroup: Why because i will has multiple activities within it and also different Menus: Please don't. ActivityGroup -- and having activities in tabs by extension -- is deprecated. Please use Views as the contents of your tabs in a TabHost. There is no sense in you developing a tab based application to learn Android that uses techniques that are no longer endorsed. -- Mark Murphy (a Commons Guy)http://commonsware.com|http://github.com/commonsguyhttp://commonsware.com/blog|http://twitter.com/commonsguy Android 3.1 Programming Books:http://commonsware.com/books -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] Re: Multiple Activities within a Tab
Can you just give me link or a small demo ? i have so far come up to this: http://stackoverflow.com/questions/6869474/checkbox-id-set-manually-not-being-able-to-retrieve-at-activity-class i have posted my codes here and came up with his thread here. I really find difficulty in understanding one question: public class Inbox extends ActivityGroup { protected static LocalActivityManager mLocalActivityManager; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.inbox); ListView inboxListView = (ListView) findViewById(R.id.inboxEmailList); inboxListView.setEmptyView((TextView) findViewById(R.id.empty)); ListInboxDAO inboxList = new ArrayListInboxDAO(); inboxList.add(new InboxDAO(1, From 1, Subject1)); inboxList.add(new InboxDAO(2, From 2, Subject2)); inboxList.add(new InboxDAO(3, From 3, Subject3)); } @Override public boolean onCreateOptionsMenu(Menu menu) { MenuInflater menuInflater = getMenuInflater(); menuInflater.inflate(R.menu.inbox_menu, menu); return super.onPrepareOptionsMenu(menu); } public void replaceContentView(String id, Intent newIntent) { View view = getLocalActivityManager().startActivity(id, newIntent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP)) .getDecorView(); this.setContentView(view); } @Override public boolean onOptionsItemSelected(MenuItem item) { switch (item.getItemId()) { case R.id.edit: replaceContentView(inboxEdit,new Intent(this,InboxEdit.class)); break; default: return super.onOptionsItemSelected(item); } return true; } } public class InboxEdit extends Activity{ @Override public void onCreate(Bundle savedInstanceState){ super.onCreate(savedInstanceState); TextView textView = new TextView(this); textView.setText(Hello); setContentView(textView); } // this menu doesnt show up why? public boolean onPrepareOptionsMenu(Menu menu) { menu.clear(); MenuInflater inflater = getMenuInflater(); inflater.inflate(R.menu.inbox_menu_edit, menu); return true; } } On Jul 31, 12:10 am, Mark Murphy mmur...@commonsware.com wrote: On Sat, Jul 30, 2011 at 3:07 PM, RobinDroid librain.ro...@gmail.com wrote: I wish to have tabs for my application. If i dont use ActivityGroup, how can i have multiples view in the same tabs. The same way you have multiples view anywhere else: put them in a layout manager (LinearLayout, RelativeLayout, TableLayout, etc.). -- Mark Murphy (a Commons Guy)http://commonsware.com|http://github.com/commonsguyhttp://commonsware.com/blog|http://twitter.com/commonsguy Android 3.1 Programming Books:http://commonsware.com/books -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] Re: Multiple Activities within a Tab
I have been following your examples from tthe github.com on creating tabApplication On Jul 31, 12:17 am, RobinDroid librain.ro...@gmail.com wrote: Can you just give me link or a small demo ? i have so far come up to this:http://stackoverflow.com/questions/6869474/checkbox-id-set-manually-n... i have posted my codes here and came up with his thread here. I really find difficulty in understanding one question: public class Inbox extends ActivityGroup { protected static LocalActivityManager mLocalActivityManager; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.inbox); ListView inboxListView = (ListView) findViewById(R.id.inboxEmailList); inboxListView.setEmptyView((TextView) findViewById(R.id.empty)); ListInboxDAO inboxList = new ArrayListInboxDAO(); inboxList.add(new InboxDAO(1, From 1, Subject1)); inboxList.add(new InboxDAO(2, From 2, Subject2)); inboxList.add(new InboxDAO(3, From 3, Subject3)); } @Override public boolean onCreateOptionsMenu(Menu menu) { MenuInflater menuInflater = getMenuInflater(); menuInflater.inflate(R.menu.inbox_menu, menu); return super.onPrepareOptionsMenu(menu); } public void replaceContentView(String id, Intent newIntent) { View view = getLocalActivityManager().startActivity(id, newIntent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP)) .getDecorView(); this.setContentView(view); } @Override public boolean onOptionsItemSelected(MenuItem item) { switch (item.getItemId()) { case R.id.edit: replaceContentView(inboxEdit,new Intent(this,InboxEdit.class)); break; default: return super.onOptionsItemSelected(item); } return true; } } public class InboxEdit extends Activity{ @Override public void onCreate(Bundle savedInstanceState){ super.onCreate(savedInstanceState); TextView textView = new TextView(this); textView.setText(Hello); setContentView(textView); } // this menu doesnt show up why? public boolean onPrepareOptionsMenu(Menu menu) { menu.clear(); MenuInflater inflater = getMenuInflater(); inflater.inflate(R.menu.inbox_menu_edit, menu); return true; } } On Jul 31, 12:10 am, Mark Murphy mmur...@commonsware.com wrote: On Sat, Jul 30, 2011 at 3:07 PM, RobinDroid librain.ro...@gmail.com wrote: I wish to have tabs for my application. If i dont use ActivityGroup, how can i have multiples view in the same tabs. The same way you have multiples view anywhere else: put them in a layout manager (LinearLayout, RelativeLayout, TableLayout, etc.). -- Mark Murphy (a Commons Guy)http://commonsware.com|http://github.com/commonsguyhttp://commonsware.com/blog|http://twitter.com/commonsguy Android 3.1 Programming Books:http://commonsware.com/books -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] Re: Multiple Activities within a Tab
Thank you so much for the link. I will read the above link and if i have any queries please be there to help me. I actually follow your coding structure from the github On Jul 31, 12:24 am, Mark Murphy mmur...@commonsware.com wrote: On Sat, Jul 30, 2011 at 3:17 PM, RobinDroid librain.ro...@gmail.com wrote: Can you just give me link or a small demo ? To... what? Here is a project that shows a TabHost that uses Views as children: https://github.com/commonsguy/cw-android/tree/master/Fancy/Tab Here is another project: https://github.com/commonsguy/cw-lunchlist/tree/master/06-Tabs public class Inbox extends ActivityGroup { As I wrote, and as you are ignoring, do not write a subclass of ActivityGroup. -- Mark Murphy (a Commons Guy)http://commonsware.com|http://github.com/commonsguyhttp://commonsware.com/blog|http://twitter.com/commonsguy Android 3.1 Programming Books:http://commonsware.com/books -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en