How to create tab in android

Put your problem here if it does not fit any of the other categories.

Postby muneshs » Sat Apr 10, 2010 10:34 am

you give ur download link or ur application but there are only .apk files
can u give me any source code
plusminus wrote:Hello smalltalk,

I don't know why it works only directly form Eclipse.

Regards,
plusminus
Sharma M.
muneshs
Junior Developer
Junior Developer
 
Posts: 14
Joined: Wed Mar 10, 2010 9:08 am
Location: india

Top

Re: How to create tab in android

Postby siva.demo » Thu May 27, 2010 2:59 pm

Hi Friends,

I am new to android application development.

I have tried to use the tab widget for my application.

When I dragged TabWidget inside the linear layout it showing "NullPointerException:null".

Can you help me on this?

Thanks,
Siva
siva.demo
Once Poster
Once Poster
 
Posts: 1
Joined: Wed May 26, 2010 6:05 am

Re: How to create tab in android

Postby ddudley3 » Sat May 29, 2010 4:16 pm

I am also receiving a nullpointerexception in the Layout editor.

Does anyone know how to get the tabs to work?
Thanks,
David
ddudley3
Freshman
Freshman
 
Posts: 6
Joined: Fri Apr 16, 2010 2:20 pm

Re: How to create tab in android

Postby anarche » Sat May 29, 2010 6:20 pm

Rashi, do you have the stacktraces/logs?
anarche
Master Developer
Master Developer
 
Posts: 369
Joined: Sun Apr 11, 2010 5:21 am

Re: How to create tab in android

Postby ddudley3 » Tue Jun 01, 2010 12:49 pm

When I try and run it .. I get this in the LogCat


06-01 11:47:08.766: ERROR/AndroidRuntime(209): java.lang.NullPointerException
06-01 11:47:08.766: ERROR/AndroidRuntime(209): at android.widget.TabHost.dispatchWindowFocusChanged(TabHost.java:295)
06-01 11:47:08.766: ERROR/AndroidRuntime(209): at android.view.ViewGroup.dispatchWindowFocusChanged(ViewGroup.java:661)
06-01 11:47:08.766: ERROR/AndroidRuntime(209): at android.view.ViewGroup.dispatchWindowFocusChanged(ViewGroup.java:661)
06-01 11:47:08.766: ERROR/AndroidRuntime(209): at android.view.ViewGroup.dispatchWindowFocusChanged(ViewGroup.java:661)
06-01 11:47:08.766: ERROR/AndroidRuntime(209): at android.view.ViewRoot.handleMessage(ViewRoot.java:1819)
06-01 11:47:08.766: ERROR/AndroidRuntime(209): at android.os.Handler.dispatchMessage(Handler.java:99)
06-01 11:47:08.766: ERROR/AndroidRuntime(209): at android.os.Looper.loop(Looper.java:123)
06-01 11:47:08.766: ERROR/AndroidRuntime(209): at android.app.ActivityThread.main(ActivityThread.java:4363)
06-01 11:47:08.766: ERROR/AndroidRuntime(209): at java.lang.reflect.Method.invokeNative(Native Method)
06-01 11:47:08.766: ERROR/AndroidRuntime(209): at java.lang.reflect.Method.invoke(Method.java:521)
06-01 11:47:08.766: ERROR/AndroidRuntime(209): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:860)
06-01 11:47:08.766: ERROR/AndroidRuntime(209): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:618)
06-01 11:47:08.766: ERROR/AndroidRuntime(209): at dalvik.system.NativeStart.main(Native Method)
Thanks,
David
ddudley3
Freshman
Freshman
 
Posts: 6
Joined: Fri Apr 16, 2010 2:20 pm

Re: How to create tab in android

Postby uncre8d1 » Wed Jun 02, 2010 3:26 am

Rashi, I get the same thing in my IDE every time I use a tabhost; however, I've found that the TabHost works fine on the emulator/device.

I do have my own problem, though. I can startActivity() from my TabHost's context menu, but the activity that I launch can't startActivityForResult(). Has anyone else experienced this?

I would attach LogCat, but LogCat doesn't seem to catch anything from the emulator and the debugger won't attach to my Droid (which the LogCat communicates with just fine). I'm afraid I don't know how to do a stack trace, so I can't post that either.

I'm wedging Google's Notepadv3 tutorial (Apache license so I can use it) into my app; the notepad code is unchanged (aside from making the package reference match my app), so I'll just link to the tutorial. Here's my code for launching the notepad (it's the last case in the switch stmt):
Syntax: [ Download ] [ Hide ]
Using java Syntax Highlighting
  1.         @Override
  2.         public boolean onOptionsItemSelected(MenuItem item) {
  3.                 switch (item.getItemId()){
  4.                 case R.id.ctxtalterfate: {
  5.                 //Code TBD
  6.                 break;
  7.                 }
  8.                
  9.                 case R.id.ctxtabout: {
  10.                         //About Dialog
  11.                         AlertDialog about = new AlertDialog.Builder(Main.this)
  12.             .setTitle("About This Program")
  13.             .setMessage(R.string.about_text)
  14.             .setPositiveButton("OK", new DialogInterface.OnClickListener() {
  15.                 public void onClick(DialogInterface dialog, int whichButton) {
  16.                         return;
  17.                 }
  18.             })
  19.             .create();
  20.                         about.show();
  21.                         break;
  22.        
  23.                 }
  24.                 case R.id.ctxtopenjournal: {//launch journal
  25.                         Intent i=new Intent(this, Notepadv3.class);
  26.                         startActivity(i);
  27.                         break;
  28.                 }
  29.                 }
Parsed in 0.033 seconds, using GeSHi 1.0.8.4


P.S. I just previewed, and it's parsing one of my ' : 's as ' & # 0 5 8 ; ' - just so you know that's not the problem with my code.
Normal?!? Man, I'd give my left arms to be normal.
User avatar
uncre8d1
Junior Developer
Junior Developer
 
Posts: 18
Joined: Tue Mar 16, 2010 3:41 am
Location: Silver Spring, MD

Top

Re: How to create tab in android

Postby uncre8d1 » Wed Jun 02, 2010 3:42 am

OK, nevermind. I didn't have the NoteEdit class (which is called on the startActivityForResult()) declared in my AndroidManifest.xml... I'll leave my post in case it helps someone.
Normal?!? Man, I'd give my left arms to be normal.
User avatar
uncre8d1
Junior Developer
Junior Developer
 
Posts: 18
Joined: Tue Mar 16, 2010 3:41 am
Location: Silver Spring, MD

Re: How to create tab in android

Postby cnapagoda » Wed Jun 30, 2010 11:19 am

Hi,


I have created tab using "smalltalk" example. But My tabs data load from database. Then I need to refresh the Loaded data( ListAdapter) content when user click on it. Is there any way to refresh the Tab loaded data?

Thaks,
Chandana
cnapagoda
Freshman
Freshman
 
Posts: 9
Joined: Sun Jun 27, 2010 3:11 pm
Location: Sri Lanka

Re: How to create tab in android

Postby Benzebuth » Wed Jun 30, 2010 11:49 am

first you have to notify your list adapter that his content has changed.
If i remember well, you have to call notifyDataSetChanged() on your list adapter
Image
User avatar
Benzebuth
Freshman
Freshman
 
Posts: 6
Joined: Fri May 28, 2010 11:50 am

Re: Exception in Layout

Postby suren » Fri Sep 17, 2010 11:35 am

Hi, I run your code and it work perfectly. But there is an error NullPointerException:null in Layout page of xml. so I couldn't see and any interface in layout form. Welcome to any updated suggestion...
suren
Freshman
Freshman
 
Posts: 2
Joined: Fri Sep 17, 2010 10:39 am
Location: Kathmandu, Nepal

Re: How to create tab in android

Postby pemko » Tue Nov 02, 2010 9:41 am

i have an other problem:

i start an activity befor the main activity (like startscreen)

in android 2.2 it run... in android 2.1 not

11-02 09:24:34.376: ERROR/AndroidRuntime(228): java.lang.NullPointerException
11-02 09:24:34.376: ERROR/AndroidRuntime(228): at android.widget.TabHost.dispatchWindowFocusChanged(TabHost.java:295)
11-02 09:24:34.376: ERROR/AndroidRuntime(228): at android.view.ViewGroup.dispatchWindowFocusChanged(ViewGroup.java:661)
11-02 09:24:34.376: ERROR/AndroidRuntime(228): at android.view.ViewGroup.dispatchWindowFocusChanged(ViewGroup.java:661)
11-02 09:24:34.376: ERROR/AndroidRuntime(228): at android.view.ViewGroup.dispatchWindowFocusChanged(ViewGroup.java:661)
11-02 09:24:34.376: ERROR/AndroidRuntime(228): at android.view.ViewRoot.handleMessage(ViewRoot.java:1819)
11-02 09:24:34.376: ERROR/AndroidRuntime(228): at android.os.Handler.dispatchMessage(Handler.java:99)
11-02 09:24:34.376: ERROR/AndroidRuntime(228): at android.os.Looper.loop(Looper.java:123)
11-02 09:24:34.376: ERROR/AndroidRuntime(228): at android.app.ActivityThread.main(ActivityThread.java:4363)
11-02 09:24:34.376: ERROR/AndroidRuntime(228): at java.lang.reflect.Method.invokeNative(Native Method)
11-02 09:24:34.376: ERROR/AndroidRuntime(228): at java.lang.reflect.Method.invoke(Method.java:521)
11-02 09:24:34.376: ERROR/AndroidRuntime(228): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:860)
11-02 09:24:34.376: ERROR/AndroidRuntime(228): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:618)
11-02 09:24:34.376: ERROR/AndroidRuntime(228): at dalvik.system.NativeStart.main(Native Method)
pemko
Freshman
Freshman
 
Posts: 9
Joined: Fri May 28, 2010 12:17 pm
Location: Switzerland

Re: How to create tab in android

Postby antonykkk » Tue Sep 20, 2011 7:19 am

Here there is a example for creating customize tabview http://android-codes-examples.blogspot.com/2011/09/customize-tab-in-android.html
antonykkk
Freshman
Freshman
 
Posts: 3
Joined: Tue Sep 20, 2011 7:01 am

Top
Previous

Return to Other Coding-Problems

Who is online

Users browsing this forum: MSNbot Media and 18 guests