Search Results

Search found 17553 results on 703 pages for 'android sdk 2 1'.

Page 27/703 | < Previous Page | 23 24 25 26 27 28 29 30 31 32 33 34  | Next Page >

  • Eclipse + Android + JUnit test references android.os class = NoClassDefFoundError WTF

    - by Peter Pascale
    I have a custom timer that extends android.os.CountDownTimer. I have a test in the test project (standard Android/Eclipse project config) that tests the custom Timer. When I try to run this test, I get a java.lang.NoClassDefFoundError: android/os/CountDownTimer at java.lang.ClassLoader.defineClass1(Native Method) at java.lang.ClassLoader.defineClass(ClassLoader.java:698) You get the idea. Can I not run code that references android code code in junit test?

    Read the article

  • Position of builtInZoomControls in WebView and MapView

    - by Mathias Lin
    I noticed that the position of the builtInZoomControls in WebView (bottom, horizontal right) is not consistent with the default position in the MapView (bottom, horizontal center). 1) Why is that not consistent? (Probably a question to be asked to Google) 2) Is there a way to horizontal center the builtInZoomControls of the WebView without applying custom Zoom controls? Or is that the only way?

    Read the article

  • Video playback on VideoView disappears after going back from another Activity

    - by pixel
    I have two Activities: one with VideoView and the second one. I start watching a video in the first Activity, then during playback I start second Activity. After going back to first Activity I can hear sound but see no picture. My Video Layout: <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="vertical" android:layout_width="fill_parent" android:layout_height="fill_parent"> <VideoView android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_weight="1" android:id="@+id/videoView" android:layout_gravity="center" /> <ListView android:layout_width="fill_parent" android:layout_height="125dp" android:id="@+id/ListView" /> </LinearLayout> Do you have any ideas why video doesn't appear?

    Read the article

  • Android Source Not Compilable?

    - by GuyNoir
    So I've been looking at code from various parts of the Android git, but when I try to load and compile many of them (camera, media player, etc) they reference classes and parts of the SDK that just aren't available even with my SDK version updated to 2.2. (for example the bitmap config option inNativeAlloc) Is there a reason that these are not in the SDK given out to developers?

    Read the article

  • Port android / android tv on nokia booklet 3G

    - by Suresh
    is it possible to port android (android tv) on Nokia booklet 3G , i like the booklet hardware (built in 3g modem and hdmi port and overall build) but windows 7 is horrible. it would be great to have android with android tv port on nokia booklet 3G any idea how to do?

    Read the article

  • twitter4j code doent work on ICS and JellyBean help me

    - by swapnil adsure
    Hey guys i am using twitter4J to post tweet on twitter Here i Change the Code according to your suggestion . i do some google search. The problem is When i try to shift from main activity to twitter activity it show force close. Main activity is = "MainActivity" twitter activity is = "twiti_backup" I think there is problem in Manifestfile but i dont know what was it. public class twiti_backup extends Activity { private static final String TAG = "Blundell.TweetToTwitterActivity"; private static final String PREF_ACCESS_TOKEN = ""; private static final String PREF_ACCESS_TOKEN_SECRET = ""; private static final String CONSUMER_KEY = ""; private static final String CONSUMER_SECRET = ""; private static final String CALLBACK_URL = "android:///"; private SharedPreferences mPrefs; private Twitter mTwitter; private RequestToken mReqToken; private Button mLoginButton; private Button mTweetButton; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); Log.i(TAG, "Loading TweetToTwitterActivity"); setContentView(R.layout.twite); mPrefs = getSharedPreferences("twitterPrefs", MODE_PRIVATE); mTwitter = new TwitterFactory().getInstance(); mTwitter.setOAuthConsumer(CONSUMER_KEY, CONSUMER_SECRET); mLoginButton = (Button) findViewById(R.id.login_button); mTweetButton = (Button) findViewById(R.id.tweet_button); } public void buttonLogin(View v) { Log.i(TAG, "Login Pressed"); if (mPrefs.contains(PREF_ACCESS_TOKEN)) { Log.i(TAG, "Repeat User"); loginAuthorisedUser(); } else { Log.i(TAG, "New User"); loginNewUser(); } } public void buttonTweet(View v) { Log.i(TAG, "Tweet Pressed"); tweetMessage(); } private void loginNewUser() { try { Log.i(TAG, "Request App Authentication"); mReqToken = mTwitter.getOAuthRequestToken(CALLBACK_URL); Log.i(TAG, "Starting Webview to login to twitter"); WebView twitterSite = new WebView(this); twitterSite.loadUrl(mReqToken.getAuthenticationURL()); setContentView(twitterSite); } catch (TwitterException e) { Toast.makeText(this, "Twitter Login error, try again later", Toast.LENGTH_SHORT).show(); } } private void loginAuthorisedUser() { String token = mPrefs.getString(PREF_ACCESS_TOKEN, null); String secret = mPrefs.getString(PREF_ACCESS_TOKEN_SECRET, null); // Create the twitter access token from the credentials we got previously AccessToken at = new AccessToken(token, secret); mTwitter.setOAuthAccessToken(at); Toast.makeText(this, "Welcome back", Toast.LENGTH_SHORT).show(); enableTweetButton(); } @Override protected void onNewIntent(Intent intent) { super.onNewIntent(intent); Log.i(TAG, "New Intent Arrived"); dealWithTwitterResponse(intent); } @Override protected void onResume() { super.onResume(); Log.i(TAG, "Arrived at onResume"); } private void dealWithTwitterResponse(Intent intent) { Uri uri = intent.getData(); if (uri != null && uri.toString().startsWith(CALLBACK_URL)) { // If the user has just logged in String oauthVerifier = uri.getQueryParameter("oauth_verifier"); authoriseNewUser(oauthVerifier); } } private void authoriseNewUser(String oauthVerifier) { try { AccessToken at = mTwitter.getOAuthAccessToken(mReqToken, oauthVerifier); mTwitter.setOAuthAccessToken(at); saveAccessToken(at); // Set the content view back after we changed to a webview setContentView(R.layout.twite); enableTweetButton(); } catch (TwitterException e) { Toast.makeText(this, "Twitter auth error x01, try again later", Toast.LENGTH_SHORT).show(); } } private void enableTweetButton() { Log.i(TAG, "User logged in - allowing to tweet"); mLoginButton.setEnabled(false); mTweetButton.setEnabled(true); } private void tweetMessage() { try { mTwitter.updateStatus("Test - Tweeting with @Blundell_apps #AndroidDev Tutorial using #Twitter4j http://blog.blundell-apps.com/sending-a-tweet/"); Toast.makeText(this, "Tweet Successful!", Toast.LENGTH_SHORT).show(); } catch (TwitterException e) { Toast.makeText(this, "Tweet error, try again later", Toast.LENGTH_SHORT).show(); } } private void saveAccessToken(AccessToken at) { String token = at.getToken(); String secret = at.getTokenSecret(); Editor editor = mPrefs.edit(); editor.putString(PREF_ACCESS_TOKEN, token); editor.putString(PREF_ACCESS_TOKEN_SECRET, secret); editor.commit(); } } And here is Manifest <application android:icon="@drawable/ic_launcher" android:label="@string/app_name" android:theme="@style/AppTheme" > <activity android:name=".MainActivity" android:label="@string/title_activity_main" android:launchMode="singleInstance" android:configChanges="orientation|screenSize"> <intent-filter> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" /> </intent-filter> </activity> <activity android:name=".twiti_backup" android:launchMode="singleInstance"> <action android:name="android.intent.action.VIEW" /> <category android:name="android.intent.category.DEFAULT" /> <category android:name="android.intent.category.BROWSABLE" /> <data android:scheme="android" android:host="callback_main" /> </activity> <activity android:name=".MyTwite"/> <activity android:name=".mp3" /> <activity android:name=".myfbapp" /> </application> Here is Log cat when i try to launch twiti_backup from main activity W/dalvikvm(16357): threadid=1: thread exiting with uncaught exception (group=0x4001d5a0) E/AndroidRuntime(16357): FATAL EXCEPTION: main E/AndroidRuntime(16357): java.lang.VerifyError: com.example.uitest.twiti_backup E/AndroidRuntime(16357): at java.lang.Class.newInstanceImpl(Native Method) E/AndroidRuntime(16357): at java.lang.Class.newInstance(Class.java:1409) E/AndroidRuntime(16357): at android.app.Instrumentation.newActivity(Instrumentation.java:1040) E/AndroidRuntime(16357): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1735) E/AndroidRuntime(16357): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1842) E/AndroidRuntime(16357): at android.app.ActivityThread.access$1500(ActivityThread.java:132) E/AndroidRuntime(16357): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1038) E/AndroidRuntime(16357): at android.os.Handler.dispatchMessage(Handler.java:99) E/AndroidRuntime(16357): at android.os.Looper.loop(Looper.java:143) E/AndroidRuntime(16357): at android.app.ActivityThread.main(ActivityThread.java:4263) E/AndroidRuntime(16357): at java.lang.reflect.Method.invokeNative(Native Method) E/AndroidRuntime(16357): at java.lang.reflect.Method.invoke(Method.java:507) E/AndroidRuntime(16357): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:839) E/AndroidRuntime(16357): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:597) E/AndroidRuntime(16357): at dalvik.system.NativeStart.main(Native Method)

    Read the article

  • How to fix "OutOfMemoryError: java heap space" while compiling MonoDroid App in MonoDevelop

    - by Rodja
    When I try to compile one of my projects, I recently get the following error: Tool /usr/bin/java execution started with arguments: -jar /Applications/android-sdk-mac_x86/platform-tools/lib/dx.jar --no-strict --dex --output=obj/Debug/android/bin/classes.dex obj/Debug/android/bin/classes /Developer/MonoAndroid/usr/lib/mandroid/platforms/android-8/mono.android.jar FlurryAnalytics/Jars/FlurryAgent.jar Jars/android-support-v4.jar UNEXPECTED TOP-LEVEL ERROR: java.lang.OutOfMemoryError: Java heap space at com.android.dx.rop.code.RegisterSpecSet.<init>(RegisterSpecSet.java:49) at com.android.dx.rop.code.RegisterSpecSet.mutableCopy(RegisterSpecSet.java:383) at com.android.dx.ssa.LocalVariableInfo.mutableCopyOfStarts(LocalVariableInfo.java:169) at com.android.dx.ssa.LocalVariableExtractor.processBlock(LocalVariableExtractor.java:104) at com.android.dx.ssa.LocalVariableExtractor.doit(LocalVariableExtractor.java:90) at com.android.dx.ssa.LocalVariableExtractor.extract(LocalVariableExtractor.java:56) at com.android.dx.ssa.SsaConverter.convertToSsaMethod(SsaConverter.java:50) at com.android.dx.ssa.Optimizer.optimize(Optimizer.java:99) at com.android.dx.ssa.Optimizer.optimize(Optimizer.java:73) at com.android.dx.dex.cf.CfTranslator.processMethods(CfTranslator.java:273) at com.android.dx.dex.cf.CfTranslator.translate0(CfTranslator.java:134) at com.android.dx.dex.cf.CfTranslator.translate(CfTranslator.java:87) at com.android.dx.command.dexer.Main.processClass(Main.java:487) at com.android.dx.command.dexer.Main.processFileBytes(Main.java:459) at com.android.dx.command.dexer.Main.access$400(Main.java:67) at com.android.dx.command.dexer.Main$1.processFileBytes(Main.java:398) at com.android.dx.cf.direct.ClassPathOpener.processArchive(ClassPathOpener.java:245) at com.android.dx.cf.direct.ClassPathOpener.processOne(ClassPathOpener.java:131) at com.android.dx.cf.direct.ClassPathOpener.process(ClassPathOpener.java:109) at com.android.dx.command.dexer.Main.processOne(Main.java:422) at com.android.dx.command.dexer.Main.processAllFiles(Main.java:333) at com.android.dx.command.dexer.Main.run(Main.java:209) at com.android.dx.command.dexer.Main.main(Main.java:174) at com.android.dx.command.Main.main(Main.java:91) Other projects build as expected. I think I need to increase the heap size for this java build step? But how?

    Read the article

  • Can't get precise layout on Nexus One

    - by Johnny
    I want to use precise layout on Nexus One, my code is like this: <LinearLayout android:orientation="horizontal" android:layout_width="fill_parent" android:layout_height="90px"> <ImageView android:layout_width="5px" android:layout_height="fill_parent" android:src="@drawable/d10" /> <ImageView android:layout_width="94px" android:layout_height="fill_parent" android:src="@drawable/d5" /> <ImageView android:layout_width="94px" android:layout_height="fill_parent" android:src="@drawable/d6" /> <ImageView android:layout_width="94px" android:layout_height="fill_parent" android:src="@drawable/d7" /> <ImageView android:layout_width="94px" android:layout_height="fill_parent" android:src="@drawable/d8" /> <ImageView android:layout_width="94px" android:layout_height="fill_parent" android:src="@drawable/d9" /> <ImageView android:layout_width="5px" android:layout_height="fill_parent" android:src="@drawable/d10" /> But it turns out on Nexus One, the screen width is not 480 px. So this LinearLayout will exceed the screen width. How should I fix this?

    Read the article

  • how can i update view when fragment change?

    - by user1524393
    i have a activity that have 2 sherlockfragment in this The first two pages display fragments with custom list views which are built from xml from server using AsyncTask. However, when the app runs, only one list view is displayed, the other page is just blank public class VpiAbsTestActivity extends SherlockFragmentActivity { private static final String[] CONTENT = new String[] { "1","2"}; TestFragmentAdapter mAdapter; ViewPager mPager; PageIndicator mIndicator; protected void onCreate(Bundle savedInstanceState) { setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT); super.onCreate(savedInstanceState); setContentView(R.layout.simple_tabs); mAdapter = new TestFragmentAdapter(getSupportFragmentManager()); mPager = (ViewPager)findViewById(R.id.pager); mPager.setAdapter(mAdapter); mIndicator = (TabPageIndicator)findViewById(R.id.indicator); mIndicator.setViewPager(mPager); mIndicator.notifyDataSetChanged(); } class TestFragmentAdapter extends FragmentPagerAdapter { private int mCount = CONTENT.length; public TestFragmentAdapter(FragmentManager fm) { super(fm); } @Override public Fragment getItem(int position) { switch(position) { case 0: return new customlist(); case 1: return new customlistnotuser(); default: return null; } } @Override public int getCount() { return mCount; } public CharSequence getPageTitle(int position) { return VpiAbsTestActivity.CONTENT[position % VpiAbsTestActivity.CONTENT.length].toUpperCase(); } @Override public void destroyItem(View collection, int position, Object view) { ((ViewPager) collection).removeView((View) view); } } } what can i update viewpager when change pages ? the customlistnotuser page likes customlist page but not show public class customlistnotuser extends SherlockFragment { // All static variables static final String URL = "url"; // XML node keys static final String KEY_TEST = "test"; // parent node static final String KEY_ID = "id"; static final String KEY_TITLE = "title"; static final String KEY_Description = "description"; static final String KEY_DURATION = "duration"; static final String KEY_THUMB_URL = "thumb_url"; static final String KEY_PRICE = "price"; static final String KEY_URL = "url"; private ProgressDialog pDialog; ListView list; LazyAdapterbeth adapter; XMLParser parser = new XMLParser(); public void onActivityCreated(Bundle savedInstanceState) { super.onActivityCreated(savedInstanceState); } public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); new getFeed().execute(); } public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View thisfragment = inflater.inflate(R.layout.dovomi, container, false); return thisfragment; } private class getFeed extends AsyncTask<Void, Void, Document> { } protected Document doInBackground(Void... params) { XMLParser parser = new XMLParser(); String xml = parser.getXmlFromUrl(URL); // getting XML from URL Document doc = parser.getDomElement(xml); // getting DOM element return doc; } protected void onPostExecute(Document doc) { ArrayList<HashMap<String, String>> songsList = new ArrayList<HashMap<String, String>>(); NodeList nl = doc.getElementsByTagName(KEY_TEST); // looping through all song nodes <song> for (int i = 0; i < nl.getLength(); i++) { // creating new HashMap HashMap<String, String> map = new HashMap<String, String>(); Element e = (Element) nl.item(i); // adding each child node to HashMap key => value map.put(KEY_ID, parser.getValue(e, KEY_ID)); map.put(KEY_TITLE, parser.getValue(e, KEY_TITLE)); map.put(KEY_Description, parser.getValue(e, KEY_Description)); map.put(KEY_DURATION, parser.getValue(e, KEY_DURATION)); map.put(KEY_THUMB_URL, parser.getValue(e, KEY_THUMB_URL)); map.put(KEY_PRICE, parser.getValue(e, KEY_PRICE)); map.put(KEY_URL, parser.getValue(e, KEY_URL)); // adding HashList to ArrayList songsList.add(map); pDialog.dismiss(); } list=(ListView)getActivity().findViewById(R.id.list); // Getting adapter by passing xml data ArrayList adapter=new LazyAdapterbeth(getActivity(), songsList); list.setAdapter(adapter); // Click event for single list row list.setOnItemClickListener(new OnItemClickListener() {

    Read the article

  • How to return ArrayList results from an IntentService

    - by gcl1
    I have an IntentService that loads up an ArrayList with data from a network source (AWS SDB tables). The ArrayList is in a global space -- accessible to both the calling Activity and the IntentService (like this: appState = ((App)getApplicationContext())). When the IntentService is done, it notifies the Activity through a ResultReceiver, and the Activity calls adapter.notifyDataChanged() to update the ListView. This solution works most of the time, ... but it violates the rule that only the UI thread should make changes to data underlying a ListView. So as it is, I sometimes get an error: "The content of the adapter has changed but ListView did not receive a notification." I think this must be a common situation. Please let me know if you have any suggestions or best practices for this problem. Here are three options I'm aware of: Keep the IntentService, and have it store the results in another "working" ArrayList, also in the global space. When the result is ready, the IntentService calls the ResultReceiver (on the UI thread), which can then: a) copy the result to the ArrayList associated with the ListView, and b) call adapter.notifyDataChanged(). CONS: I don't like the idea of putting temp/working data in a global space, and copying the result list seems inefficient. Keep the IntentService, and have it pass the results back through a bundle loaded with a ParcelableArrayList. CONS: I'm not sure if this approach would scale for very large result sets. It also requires copying the result list. Switch to a Service which builds a local copy of the result list. Have the Activity directly access the address space of the Service in order to read the result list. CON: Still requires copying results to the ArrayList associated with the ListView. Thank you.

    Read the article

  • how to show all added items into another activity, like: AddtoCart and ViewCart Functionality

    - by Stanley
    i am trying to make a shopping cart app, allowing user to choose category then select item to purchase, once user will click on any item to purchase, then showing that selected item into another activity with item image, name, cost, qty (to accept by user) and also providing add to cart functionality, now i want whenever user will click on Add to Cart button, then selected item need to show in ViewCart Activity, so here i am placing my AddtoCart Activity code, please tell me what i need to write to show added item(s) into ViewCart Category just like in shopping cart, In ViewCart activity i just want to show item title, cost and qty (entered by user):- public class AddtoCart extends Activity{ static final String KEY_TITLE = "title"; static final String KEY_COST = "cost"; static final String KEY_THUMB_URL = "imageUri"; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.single); Intent in = getIntent(); String title = in.getStringExtra(KEY_TITLE); String thumb_url = in.getStringExtra(KEY_THUMB_URL); String cost = in.getStringExtra(KEY_COST); ImageLoader imageLoader = new ImageLoader(getApplicationContext()); ImageView imgv = (ImageView) findViewById(R.id.single_thumb); TextView txttitle = (TextView) findViewById(R.id.single_title); TextView txtcost = (TextView) findViewById(R.id.single_cost); txttitle.setText(title); txtcost.setText(cost); imageLoader.DisplayImage(thumb_url, imgv); // Save a reference to the quantity edit text final EditText editTextQuantity = (EditText) findViewById(R.id.edit_qty); ImageButton addToCartButton = (ImageButton) findViewById(R.id.img_add); addToCartButton.setOnClickListener(new OnClickListener() { public void onClick(View v) { // Check to see that a valid quantity was entered int quantity = 0; try { quantity = Integer.parseInt(editTextQuantity.getText() .toString()); if (quantity <= 0) { Toast.makeText(getBaseContext(), "Please enter a quantity of 1 or higher", Toast.LENGTH_SHORT).show(); return; } } catch (Exception e) { Toast.makeText(getBaseContext(), "Please enter a numeric quantity", Toast.LENGTH_SHORT).show(); return; } // Close the activity finish(); } }); }}

    Read the article

  • How to add a dynamically resolved activity name to the back stack (without using PARENT_ACTIVITY)?

    - by user3214249
    The goal is 1) Start activity A from AppWidgetProvider or any other background task (it is simple). 2) From activity A go to activity B after clicking Back button. The problem is that I can't set PARENT_ACTIVITY in AndroidManifest.xml, because the activity B class name gets determined at run time. So in one case I need to go to activity B, in other case it is another activity. Seems like I can't use TaskStackBuilder without PARENT_ACTIVITY. I could handle this in the finish() method of activity A, but it should be a simpler way to add activity B to the "back stack" when I run startActivity(intent). Any ideas?

    Read the article

  • Evernote for Android Updates with New Features and Updated Widget

    - by Jason Fitzpatrick
    Android: Evernote for Android now features enhanced sharing, tighter Skitch integration, and a brand new homescreen widget. With this update you can now share entire notebooks directly from your Android phone, edit and annotate images with Skitch, and use the Evernote widget regardless of where you have Evernote installed–the previous version of Evernote’s widget would only function if Evernote was installed on the main memory instead of the SD card. You can read more about the new release here or hit up the link below to grab a copy from the Android Market. Evernote [Android Market] How to Make the Kindle Fire Silk Browser *Actually* Fast! Amazon’s New Kindle Fire Tablet: the How-To Geek Review HTG Explains: How Hackers Take Over Web Sites with SQL Injection / DDoS

    Read the article

  • Android - Switching Activities with a Tab Layout

    - by Bill Osuch
    This post is based on the Tab Layout  tutorial on the Android developers site, with some modifications. I wanted to get rid of the icons (they take up too much screen real estate), and modify the fonts on the tabs. First, create a new Android project, with an Activity called TabWidget. Then, create two additional Activities called TabOne and TabTwo. Throw a simple TextView on each one with a message identifying the tab, like this: public class TabTwo extends Activity {  @Override  public void onCreate(Bundle savedInstanceState) {   super.onCreate(savedInstanceState);   TextView tv = new TextView(this);   tv.setText("This is tab 2");   setContentView(tv);  } } And don't forget to add them to your AndroidManifest.xml file: <activity android:name=".TabOne"></activity> <activity android:name=".TabTwo"></activity> Now we'll create the tab layout - open the res/layout/main.xml file and insert the following: <?xml version="1.0" encoding="utf-8"?> <TabHost xmlns:android="http://schemas.android.com/apk/res/android"  android:id="@android:id/tabhost"  android:layout_width="fill_parent"  android:layout_height="fill_parent">  <LinearLayout   android:orientation="vertical"   android:layout_width="fill_parent"   android:layout_height="fill_parent">   <TabWidget    android:id="@android:id/tabs"    android:layout_width="fill_parent"    android:layout_height="wrap_content" />   <FrameLayout    android:id="@android:id/tabcontent"             android:layout_width="fill_parent"    android:layout_height="fill_parent" />  </LinearLayout> </TabHost> Finally, we'll create the code needed to populate the TabHost. Make sure your TabWidget class extends TabActivity rather than Activity, and add code to grab the TabHost and create an Intent to launch a new Activity:    TabHost tabHost = getTabHost();  // The activity TabHost    TabHost.TabSpec spec;  // Reusable TabSpec for each tab    Intent intent;  // Reusable Intent for each tab       // Create an Intent to launch an Activity for the tab (to be reused)    intent = new Intent().setClass(this, TabOne.class); Add the first tab to the layout:    // Initialize a TabSpec for each tab and add it to the TabHost    spec = tabHost.newTabSpec("tabOne");      spec.setContent(intent);     spec.setIndicator("Tab One");     tabHost.addTab(spec); It's pretty tall as-is, so we'll shorten it:   // Squish the tab a little bit horizontally   tabHost.getTabWidget().getChildAt(0).getLayoutParams().height = 40; But the text is a little small, so let's increase the font size:   // Bump the text size up   LinearLayout ll = (LinearLayout) tabHost.getChildAt(0);   android.widget.TabWidget tw = (android.widget.TabWidget) ll.getChildAt(0);   RelativeLayout rllf = (RelativeLayout) tw.getChildAt(0);   TextView lf = (TextView) rllf.getChildAt(1);   lf.setTextSize(20); Do the same for the second tab, and you wind up with this: @Override     public void onCreate(Bundle savedInstanceState) {         super.onCreate(savedInstanceState);         setContentView(R.layout.main);                 TabHost tabHost = getTabHost();  // The activity TabHost         TabHost.TabSpec spec;  // Reusable TabSpec for each tab         Intent intent;  // Reusable Intent for each tab            // Create an Intent to launch an Activity for the tab (to be reused)         intent = new Intent().setClass(this, TabOne.class);         // Initialize a TabSpec for each tab and add it to the TabHost         spec = tabHost.newTabSpec("tabOne");           spec.setContent(intent);          spec.setIndicator("Tab One");          tabHost.addTab(spec);         // Squish the tab a little bit horizontally         tabHost.getTabWidget().getChildAt(0).getLayoutParams().height = 40;         // Bump the text size up         LinearLayout ll = (LinearLayout) tabHost.getChildAt(0);         android.widget.TabWidget tw = (android.widget.TabWidget) ll.getChildAt(0);         RelativeLayout rllf = (RelativeLayout) tw.getChildAt(0);         TextView lf = (TextView) rllf.getChildAt(1);         lf.setTextSize(20);            // Do the same for the other tabs         intent = new Intent().setClass(this, TabTwo.class);         spec = tabHost.newTabSpec("tabTwo");          spec.setContent(intent);          spec.setIndicator("Tab Two");         tabHost.addTab(spec);         tabHost.getTabWidget().getChildAt(1).getLayoutParams().height = 40;         RelativeLayout rlrf = (RelativeLayout) tw.getChildAt(1);         TextView rf = (TextView) rlrf.getChildAt(1);         rf.setTextSize(20);            tabHost.setCurrentTab(0);     } Save and fire up the emulator, and you should be able to switch back and forth between your tabs!

    Read the article

  • Android Development: MVC vs MVVM

    - by Mel
    I've started coding for android and I'm having difficulty trying to properly partition my code. I always end up with a very tight coupling between my UI logic and the actual controls I use to represent them. I have background in both WPF MVVM and ASP.net MVC so I'm familiar with those patterns. After some digging, I found Android Binding. It seems nice and fits nicely with my WPF background. However, it bugs me that its not built in. I'm pretty sure that the android makers have thought of this when designing the android programming interface. So my question is, what is the best practice pattern to use when developing in android, if any. I have looked and looked at their site but didn't find anything...

    Read the article

  • How To Create a Full Android Phone or Tablet Backup Without Rooting or Unlocking Your Device

    - by Chris Hoffman
    Android includes a built-in way to back up and restore the contents of your phone or tablet. All you need is a computer and a device running Android 4.0 (Ice Cream Sandwich) or newer. We’ve also covered backing up and restoring your Android phone with Titanium Backup. Titanium Backup is a great app, but it requires rooting your Android. This feature isn’t exposed in Android’s user interface, so you should consider it experimental. 8 Deadly Commands You Should Never Run on Linux 14 Special Google Searches That Show Instant Answers How To Create a Customized Windows 7 Installation Disc With Integrated Updates

    Read the article

  • Screenshot Tour: 10 New Features in Android 4.2 Jelly Bean

    - by Chris Hoffman
    Android 4.2 improves on Android 4.1 in numerous ways, adding a variety of new features. Android 4.2 isn’t as big an update as Android 4.1, also called Jelly Bean, but it’s a definite improvement. If you have a Nexus 7 or Galaxy Nexus, you should be getting this update very soon. Unfortunately, it will likely take quite a bit longer for manufacturers to ship Android 4.2 on non-Nexus devices. How To Delete, Move, or Rename Locked Files in Windows HTG Explains: Why Screen Savers Are No Longer Necessary 6 Ways Windows 8 Is More Secure Than Windows 7

    Read the article

  • How To Boot Your Android Phone or Tablet Into Safe Mode

    - by Chris Hoffman
    On your Windows PC, you can boot into safe mode to load Windows without any third-party software. You can do the same on Android with Android’s safe mode. In safe mode, Android won’t load any third-party applications. This allows you to troubleshoot your device – if you’re experiencing crashes, freezes, or battery life issues, you can boot into safe mode and see if the issues still happen there. From safe mode, you can uninstall misbehaving third-party apps. HTG Explains: Does Your Android Phone Need an Antivirus? How To Use USB Drives With the Nexus 7 and Other Android Devices Why Does 64-Bit Windows Need a Separate “Program Files (x86)” Folder?

    Read the article

  • Android, OpenGL and extending GLSurfaceView?

    - by Spoon Thumb
    This question is part-technical, part-meta, part-subjective and very specific: I'm an indie game dev working on android, and for the past 6 months I've struggled and finally succeeded in making my own 3D game app for android. So I thought I'd hop on SO and help out others struggling with android and openGL-ES However, the vast majority of questions relate to extending GLSurfaceView. I made my whole app without extending GLSurfaceView (and it runs fine). I can't see any reason at all to extend GLSurfaceView for the majority of questions I come across. Worse, the android documentation implies that you ought to, but gives no detailed explaination of why or what the pros/cons are vs not extending and doing everything through implementing your own GLSurfaceView.Renderer as I did Still, the sheer volume of questions where the problem is purely to do with extending GLSurfaceView is making me wonder whether actually there is some really good reason for doing it that way vs the way I've been doing it (and suggesting in my answers to others to do). So, is there something I'm missing? Should I stop answering questions in the meantime? Android openGL documentation

    Read the article

  • Network sharing for android

    - by Shagun
    I am on ubuntu 12.04 and I want to create a wifi hotspot to be used with my android device. Now I know there are so many tutorials available every where and that I have all options in network tab to use but I couldn't get it to work. Android does not work with an adhoc connection and whatever wifi network I created, my android device could not connect to it (I could connect a phone using bada to it and other computers can also be connected) I know the work around to get android on a adhoc connection but can't I have some thing as simple as connectify for windows? PS : I am not looking for workarounds involving android.

    Read the article

  • Kill Android Apps without Task Manager

    - by Gopinath
    Android is for geeks. It best fits for the users who know how to get around sloppy areas and find their way out. If you are an heavy Android user you would have noticed Apps crashing often. A well written App should not crash, if crashes should exit the process gracefully. But unfortunately Google Play has many apps that not only just crash, they hang in a where they don’t respond and you can’t access the application. The only option left to you is to forcefully close them. If you encounter a situation to forcefully close an App you have two options. First one is to use Task Manager application to close them and the second option is use built in Android OS features. Here are the steps to forcefully close an Android App without using Task Manager Step 1: Go to Settings and select Apps Step 2: Switch to All apps tab and select the application you want to close Step 3: Touch on Force Stop button to forcefully close the app That’s the simplest way to forcefully kill Android Apps.

    Read the article

< Previous Page | 23 24 25 26 27 28 29 30 31 32 33 34  | Next Page >