Search Results

Search found 15838 results on 634 pages for 'android layout'.

Page 19/634 | < Previous Page | 15 16 17 18 19 20 21 22 23 24 25 26  | Next Page >

  • android: customized text selector

    - by Yang
    I wanted to design a customized text selector that changed the text color when user clicks the TextView. But got the following error: java.lang.RuntimeException: Unable to start activity ComponentInfo{}: android.view.InflateException: Binary XML file line #55: Error inflating class here is what I have: res/text_selector.xml <selector xmlns:android="http://schemas.android.com/apk/res/android"> <item android:state_enabled="false" android:state_focused="true" android:drawable="@color/black" /> <item android:state_pressed="true" android:drawable="@color/blue" /> <item android:state_focused="true" android:drawable="@color/black" /> </selector> layout/textview.xml <TextView android:id = "@+id/last_page_button" android:text="@string/last_page_button_string" android:gravity="center_horizontal" android:layout_width="wrap_content" android:layout_height="wrap_content" android:background="#ffffff" android:textColor = "@drawable/text_selector" android:layout_weight="1" /> values/color.xml <resources> <color name="white">#ffffffff</color> <color name="black">#ff000000</color> <color name="blue">#ffccddff</color>

    Read the article

  • Reference for good Android UI design patterns.

    - by sat
    Hi, I would like to get some links for getting started with design patterns.My requirement is , (at Initial stage) How to go about developing a particular pattern , say customized ListView which can be shared across applications . e.g. Applications will call something like drawCustomizedListView(params...) and my code will draw the listview according to the parameters supplied. This is particularly useful when across the applications I have to draw customized views. My intention is, I should not repeat the same code everywhere for doing similar task. Any references for the above requirement ?

    Read the article

  • Android Virtual Device freezing during its loading

    - by maarlin
    Hello, I've downloaded Eclipse Classic 3.5 Galileo, the last version of Android SDK, downloaded and installed Eclipse Android 1.6 platform. I've created first (and the only) AVD with Android 1.6 and the default skin. The log may show more: I've filtered only neccessary messages (warnings, errors). -http://www.clipboard.cz/63c As you can see, my new AVD has started in 16:17 and it was still loading in 17:35... The emulator looks like this: http://img130.imageshack.us/img130/3540/androidloading.png PS: The restrictions about number of links for new accounts are REALLY annoying...

    Read the article

  • Android Set ImageButton as Toggle

    - by GuyNoir
    How can I have an imagebutton stay in the 'pressed' state when it is clicked? Basically I just want the background to be the depressed background, but I can't figure out how to set it. At the moment, I've just copied the selected button background into my res folder, but when I set it as the background, it becomes blurry (since the original image is bigger than the button itself). Normal Background: What I'm getting:

    Read the article

  • Using Gradle with an existing Android project

    - by Tom Reznik
    I have an existing Android project with the following structure: - ProjectName -- AndroidManifest.xml -- local.properties -- project.properties -- assets -- libs (containing all jars) -- modules (containing all library projects my project depends on) -- res -- src ---- com/namespace/projectname (all my classes including main activity are here) I haven't been using any specific build system to build my project other than the one provided by default with the Android Studio IDE (though the project was originally created with IntelliJ CE. I would like to use Gradle with the android plugin and do some work on my build process. I have tried several configurations in order to achieve this and have failed to complete a successful build every time. What's the recommended approach in this scenario? should I change my project structure? or is it possible to configure gradle using the existing structure? Any help would be greatly appreciated. Thanks!

    Read the article

  • Ubuntu 13.10 japanese keyboard layout intercepts Caps Lock

    - by Envek
    I've installed Ubuntu 13.10 (clean install on new machine), there are lot of changes for configuring keyboard layouts and I've tried to configure it as I've used earlier: Englis (US), Russian and Japanese (Anthy) with switching between them with Caps Lock key. (See screenshot) Caps Lock switching works fine between Russian and English and vice-versa, but with Japanese I can switch only TO Japanese (not FROM), in Japanese layout Caps Lock starting to work as usual Caps Lock (as a switch between small and BIG letters), so I need to use mouse to switch back to Ru or En layout. This happens ONLY with Japanese layouts (I've tried also simply "Japanese" and "Japanese (Kana)"), not with Chinese, Korean or anything else. I'm not sure who is blame for that, is it ibus-anthy or anything. Please help, I want to use Caps Lock to switch between all layouts. Also, I've created a bug in the LaunchPad: https://bugs.launchpad.net/ubuntu/+source/gnome-control-center/+bug/1247363

    Read the article

  • Launch 7:Windows Phone 7 Style Live Tiles On Android Mobiles

    - by Gopinath
    Android is a great mobile OS but one thought that lingers in the mind of few Android owners is: Am I using a cheap iPhone? This is valid thought for many low end Android users as their phones runs sluggish and the user interface of Android looks like an imitation of iOS. When it comes to Windows Phone 7 users, even though their operating system features are not as great as iPhone/Android but it has its unique user interface; Windows Phone 7 user interface is a very intuitive and fresh, it’s constantly updating Live Tiles show all the required information on the home screen. Android has best mobile operating system features except UI and Windows Phone 7 has excellent user interface. How about porting Windows Phone 7 Tiles interface on an Android? That should be great. Launch 7 app brings the best of Windows Phone 7 look and feel to Android OS. Once the Launcher 7 app is installed and activated, it brings Live Tiles or constantly updating controls that show information on Android home screen. Apart from simple and smooth tiles, there are handful of customization options provided. Users can change colour of the tiles, add new tiles, enable/disable transitions. The reviews on Android Market are on the positive side with 4.4 stars by 10,000 + reviewers. Here are few user reviews 1. Does what it says. only issue for me is that the app drawer doesn’t rotate. And I would like the UI to rotate when my KB is opened. HTC desire z – Jonathan 2. Works great on atrix.Kudos to developers. Awesome. Though needs: Better notification bar More stock images of tiles Better fitting of widgets on tiles – Manny 3. Looks really good like it much more than I thought I would runs real smooth running royal ginger 2.1 – Jay 4. Omg amazing i am definetly keeping it as my default best of android and windows – Devon 5. Man! An update every week! Very very responsive developer! – Andrew You can read more reviews on Android Market here.  There is no doubt that this application is receiving rave reviews. After scanning a while through the reviews, few complaints throw light on the negative side: Battery drains a bit faster & Low end mobile run a bit sluggish. The application is available in two versions – an ad supported free version and $1.41 ad free version. Download Launcher 7 from Android Market This article titled,Launch 7:Windows Phone 7 Style Live Tiles On Android Mobiles, was originally published at Tech Dreams. Grab our rss feed or fan us on Facebook to get updates from us.

    Read the article

  • How to change keyboard layout?

    - by swedishhh
    I'm on ubuntu 12.04. Recently I bought a cheap apple style bluetooth keyboard. It pairs OK. I paired it with the current 102 key still attached. Anyway I noticed that the character mapping is incorrect. Most keys do not type anything - some keys on the right (k, l, ;') etc give numbers, but that's about it. So I rebooted, with 102 kbd unattached, and the bluetooth keyboard on, ready to connect. After boot at the login screen, the bluetooth keyboard had paired. I typed my password, and it logged in fine!! However after the user login was complete it reverted to the broken behaviour. A glance at the layout chart shows ubuntu thinks I still have the 102 layout, even though it remained disconnected. Any ideas? Thanks, Dave

    Read the article

  • Display current layout (language code/country flag) in keyboard indicator

    - by Jono
    Just upgraded from 10.04 to 10.10, and the keyboard indicator applet no longer displays the two-letter country code for the active layout. This is terrible. Is this the default behaviour? Anyone using two layouts can't tell which language they're in. I can't seem to find the setting for this, it used to be in the preferences for keyboard layout. Update 1: In case this wasn't obvious - I have two keyboard layouts - English and Hebrew. I just upgraded form 10.04, where the country code (USA/IL) was displayed, overlaid on the flag. Now all I get is a vague keyboard icon, and can't find the settings for this. Update 2: this seems to be a bug that people have been reporting since Lucid, and is now back in Maverick

    Read the article

  • Display current layout (language code/country flag) in keyboard indicator

    - by Jono
    Just upgraded from 10.04 to 10.10, and the keyboard indicator applet no longer displays the two-letter country code for the active layout. This is terrible. Is this the default behaviour? Anyone using two layouts can't tell which language they're in. I can't seem to find the setting for this, it used to be in the preferences for keyboard layout. Update 1: In case this wasn't obvious - I have two keyboard layouts - English and Hebrew. I just upgraded form 10.04, where the country code (USA/IL) was displayed, overlaid on the flag. Now all I get is a vague keyboard icon, and can't find the settings for this. Update 2: this seems to be a bug that people have been reporting since Lucid, and is now back in Maverick

    Read the article

  • How to set icon to title bar for each Activity in Tablelayout in android

    - by Venu Gopal
    In my tablayout example, i have created 3 tabs, as usually i set 3 activities for each tab. I can set image to title bar of activity, which adds the intent to each tab. Due to this, the image in the title bar is visible in all 3 tabs. My requirement is to set a different image to title bar for each activity. I followed this to set image to title bar. But when i am going to do the same thing to each activity, getting android.util.AndroidRuntimeException: You cannot combine custom titles with other title features this error and application is terminated. manifest.xml <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.aptitsolution.tablayout" android:versionCode="1" android:versionName="1.0"> <application android:icon="@drawable/icon" android:label="@string/app_name" android:theme="@style/MyTheme"> <activity android:name=".TabLayoutDemo" android:label="@string/app_name" > <intent-filter> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" /> </intent-filter> </activity> <activity android:name="AlbumsActivity"></activity> <activity android:name="ArtistsActivity"></activity> <activity android:name="SongsActivity"></activity> TabLayoutDemo.java public class TabLayoutDemo extends TabActivity { /** Called when the activity is first created. */ @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); requestWindowFeature(Window.FEATURE_CUSTOM_TITLE); setContentView(R.layout.main); getWindow().setFeatureInt(Window.FEATURE_CUSTOM_TITLE, R.layout.my_title); Resources res = getResources(); // Resource object to get Drawables TabHost tabHost = getTabHost(); // The activity TabHost TabHost.TabSpec spec; // Resusable 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, ArtistsActivity.class); // Initialize a TabSpec for each tab and add it to the TabHost spec = tabHost.newTabSpec("artists").setIndicator("Artists", res.getDrawable(R.drawable.ic_tab_artists)) .setContent(intent); tabHost.addTab(spec); .... .... ArtistsActivity.java public class ArtistsActivity extends Activity { @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); requestWindowFeature(Window.FEATURE_CUSTOM_TITLE);//here i am getting the error setContentView(R.layout.artists); setFeatureDrawableResource(Window.FEATURE_CUSTOM_TITLE, R.layout.my_title); } } my_title.xml <?xml version="1.0" encoding="utf-8"?><RelativeLayout android:id="@+id/header" xmlns:android="http://schemas.android.com/apk/res/android" android:layout_height="wrap_content" android:layout_width="fill_parent"> <ImageView android:id="@+id/titleImage" android:src="@drawable/nowplaying" android:layout_width="wrap_content" android:layout_height="wrap_content" /> <TextView android:id="@+id/titleText" android:layout_toRightOf="id/titleImage"android:layout_width="wrap_content" android:text="New Title" android:layout_height="wrap_content"/> thanks venu

    Read the article

  • Switching to landscape mode in Android Emulator

    - by Cody
    This is probably a pretty easy to answer question, but I can't find the solution myself after a couple hours of searching the documentation and Google. I set the orientation of my Android app to landscape in the AndroidManifest.xml file: android:screenOrientation="landscape" However, when I run the app in the simulator, it appears sideways and in portrait mode. How can I switch the emulator to landscape mode on a mac? It's running the 1.6 SDK. Thanks!

    Read the article

  • Cannot use standard android color attribute in custom color selector

    - by Manish Gupta
    So, android defines the following in themes.xml: <style name="Theme"> ... <item name="colorPressedHighlight">@color/legacy_pressed_highlight</item> </style> and: <style name="Theme.Holo"> ... <item name="colorPressedHighlight">@color/holo_blue_light</item> </style> I want to use this colorPressedHighlight as the background color for my custom Button when it is pressed. So I defined the following in res/color/app_button_background.xml: <?xml version="1.0" encoding="utf-8"?> <selector xmlns:android="http://schemas.android.com/apk/res/android" > <item android:state_pressed="true" android:drawable="?android:colorPressedHighlight"/> <item android:drawable="@android:color/transparent" /> </selector> Finally, I define my custom ImageButton style: <style name="App_ImageButtonStyle" parent="@android:style/Widget.ImageButton"> <item name="android:gravity">center</item> <item name="android:background">@color/app_button_background</item> </style> I crash on app launch with the following call stack: 06-27 20:24:41.954: E/AndroidRuntime(532): Caused by: org.xmlpull.v1.XmlPullParserException: Binary XML file line #6: <item> tag requires a 'drawable' attribute or child tag defining a drawable 06-27 20:24:41.954: E/AndroidRuntime(532): at android.graphics.drawable.StateListDrawable.inflate(StateListDrawable.java:178) 06-27 20:24:41.954: E/AndroidRuntime(532): at android.graphics.drawable.Drawable.createFromXmlInner(Drawable.java:867) 06-27 20:24:41.954: E/AndroidRuntime(532): at android.graphics.drawable.Drawable.createFromXml(Drawable.java:804) 06-27 20:24:41.954: E/AndroidRuntime(532): at android.content.res.Resources.loadDrawable(Resources.java:1920) I know that directly accessing @color/legacy_pressed_highlight or @color/holo_blue_light instead of accessing them through the colorPressedHighlight fixes the crash but it does not solve the problem. Themes can vary, hence I need to access it through the colorPressedHighlight attribute. PS: I had a similar problem to which I haven't found an answer yet. Can someone please help!

    Read the article

  • Why do I get a null pointer exception from TabWidget?

    - by rushinge
    I'm writing an android program in which I have an activity that uses tabs. The Activity public class UnitActivity extends TabActivity { @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); TabHost tabHost = getTabHost(); TabSpec spec; Resources res = getResources(); LayoutInflater.from(this).inflate(R.layout.unit_view, tabHost.getTabContentView(), true); spec = tabHost.newTabSpec("controls"); spec.setIndicator("Control", res.getDrawable(R.drawable.ic_tab_equalizer)); spec.setContent(R.id.txtview); tabHost.addTab(spec); } } The XML referenced by R.layout.unit_view <?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:layout_width="fill_parent" android:layout_height="fill_parent" android:padding="5dp"> <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" android:padding="5dp"> <TextView android:id="@+id/txtview" android:layout_width="fill_parent" android:layout_height="fill_parent" android:gravity="bottom" android:text="nullpointer this!" /> </FrameLayout> </LinearLayout> </TabHost> As far as I can see I'm doing the same thing I see in the tabs1 api sample from the android sdk. I've tried "getLayoutInflator()" instead of "LayoutInflator.from(this)" with the same result. If I replace the LayoutInflater line with "setContentView(R.layout.unit_view)" my program doesn't crash with a null pointer exception but my content is completely blank and empty. I get the tab and that's it. I've checked to make sure R.layout.unit_view and tabHost are not null when it runs the LayoutInflater line and they seem to be fine. They're defenitely not null. I've also checked to make sure LayoutInflater.from(this) returns a valid layout inflater object and it does. The logcat indicating the error says E/AndroidRuntime( 541): java.lang.NullPointerException E/AndroidRuntime( 541): at android.widget.TabWidget.dispatchDraw(TabWidget.java:206) E/AndroidRuntime( 541): at android.view.ViewGroup.drawChild(ViewGroup.java:1529) E/AndroidRuntime( 541): at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1258) E/AndroidRuntime( 541): at android.view.ViewGroup.drawChild(ViewGroup.java:1529) E/AndroidRuntime( 541): at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1258) E/AndroidRuntime( 541): at android.view.ViewGroup.drawChild(ViewGroup.java:1529) E/AndroidRuntime( 541): at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1258) E/AndroidRuntime( 541): at android.view.ViewGroup.drawChild(ViewGroup.java:1529) E/AndroidRuntime( 541): at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1258) E/AndroidRuntime( 541): at android.view.ViewGroup.drawChild(ViewGroup.java:1529) E/AndroidRuntime( 541): at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1258) E/AndroidRuntime( 541): at android.view.ViewGroup.drawChild(ViewGroup.java:1529) E/AndroidRuntime( 541): at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1258) E/AndroidRuntime( 541): at android.view.View.draw(View.java:6538) E/AndroidRuntime( 541): at android.widget.FrameLayout.draw(FrameLayout.java:352) E/AndroidRuntime( 541): at android.view.ViewGroup.drawChild(ViewGroup.java:1531) E/AndroidRuntime( 541): at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1258) E/AndroidRuntime( 541): at android.view.ViewGroup.drawChild(ViewGroup.java:1529) E/AndroidRuntime( 541): at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1258) E/AndroidRuntime( 541): at android.view.View.draw(View.java:6538) E/AndroidRuntime( 541): at android.widget.FrameLayout.draw(FrameLayout.java:352) E/AndroidRuntime( 541): at com.android.internal.policy.impl.PhoneWindow$DecorView.draw(PhoneWindow.java:1830) E/AndroidRuntime( 541): at android.view.ViewRoot.draw(ViewRoot.java:1349) E/AndroidRuntime( 541): at android.view.ViewRoot.performTraversals(ViewRoot.java:1114) E/AndroidRuntime( 541): at android.view.ViewRoot.handleMessage(ViewRoot.java:1633) E/AndroidRuntime( 541): at android.os.Handler.dispatchMessage(Handler.java:99) E/AndroidRuntime( 541): at android.os.Looper.loop(Looper.java:123) E/AndroidRuntime( 541): at android.app.ActivityThread.main(ActivityThread.java:4363) E/AndroidRuntime( 541): at java.lang.reflect.Method.invokeNative(Native Method) E/AndroidRuntime( 541): at java.lang.reflect.Method.invoke(Method.java:521) E/AndroidRuntime( 541): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:860) E/AndroidRuntime( 541): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:618) E/AndroidRuntime( 541): at dalvik.system.NativeStart.main(Native Method) I/Process ( 61): Sending signal. PID: 541 SIG: 3 I/dalvikvm( 541): threadid=7: reacting to signal 3 I/dalvikvm( 541): Wrote stack trace to '/data/anr/traces.txt' Anybody have any idea how I can get this content into a tab without crashing my application? My actual program is more complex and has more than one tab but I simplified it down to this in an attempt to find out why it's crashing but it still crashes and I don't know why. If I don't use LayoutInflator my program doesn't crash but I don't get any content either, just tabs.

    Read the article

  • log4j support in Android

    - by Travis
    I am attempting to shoehorn an existing SDK onto an android device and one of the dependencies of said SDK is Apache log4j. I am able to load my test program onto the android emulator but when the log4j object "PropertySetter" is called the program fails with a verification exception. Is there a way to ameliorate this issue?

    Read the article

  • Initialize preferences from XML in main Activity

    - by pixel
    My problem is that when I start application and user didn't open my PreferenceActivity so when I retrieve them don't get any default values defined in my preference.xml file. preference.xml file: <?xml version="1.0" encoding="utf-8"?> <PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android" android:key="applicationPreference" android:title="@string/config" > <ListPreference android:key="pref1" android:defaultValue="default" android:title="Title" android:summary="Summary" android:entries="@array/entry_names" android:entryValues="@array/entry_values" android:dialogTitle="@string/dialog_title" /> </PreferenceScreen> Snippet from my main Activity (onCreate method): SharedPreferences appPreferences = PreferenceManager.getDefaultSharedPreferences(this); String pref1 = appPreferences.getString("pref1", null); In result I end up with a null value.

    Read the article

  • Reading Resource Files from my own APK in Android Native Environment

    - by Kyle
    I'm porting to Android. My existing project has a ton of resource files that I'm porting into my Android project. I have them all in /res/raw/, and I would like to access those resources in my native library with functions such as fopen() and such. Can this be done, or do I have to go through JNI for this as well? I would really prefer not to, for ease of porting and possible speed and memory reasons.

    Read the article

  • Register filetype with the browser?

    - by Lord.Quackstar
    In Android, I am trying to make it so that the user downloads a font from the browser, and I am able to view the font when downloaded. After multiple issues, I still have one lingering one: Registering the filetype with the browser. When trying to download with the Emulator (2.1-u1), I get "Cannot download. The content is not supported on this phone". Okay, so maybe its my manifest file. Updated with this: <activity android:name=".MainActivity" android:label="MainActivity"> <intent-filter> <action android:name="android.intent.action.MAIN"/> <category android:name="android.intent.category.LAUNCHER"/> <catagory android:name="android.intent.category.BROWSABLE"/> <data android:scheme="http"/> <data android:scheme="https"/> <data android:scheme="ftp"/> <data android:host="*"/> <data android:mimeType="*/*"/> <data android:pathPattern=".*zip"/> </intent-filter> </activity> Went back to the browser, and fails again. Restart the Emulator, still fails. Note that I got this format from posts here. Any suggestions on what to do?

    Read the article

  • ListView not showing up in fragment

    - by aindurti
    When I insert a listview in a fragment in my application, it doesn't show up after I populate it with items. In fact, the application crashes due to a NullPointerException. Can anybody help me? Here is the detail activity from which I show the fragments. package com.example.sample; import android.content.Intent; import android.os.Bundle; import android.support.v4.app.Fragment; import android.support.v4.app.FragmentTransaction; import android.support.v4.app.NavUtils; import android.widget.ArrayAdapter; import android.widget.ListView; import com.actionbarsherlock.app.ActionBar; import com.actionbarsherlock.app.ActionBar.Tab; import com.actionbarsherlock.app.SherlockFragmentActivity; import com.actionbarsherlock.view.MenuItem; /** * An activity representing a single Course detail screen. This activity is only * used on handset devices. On tablet-size devices, item details are presented * side-by-side with a list of items in a {@link CourseListActivity}. * <p> * This activity is mostly just a 'shell' activity containing nothing more than * a {@link CourseDetailFragment}. */ public class CourseDetailActivity extends SherlockFragmentActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_course_detail); // Show the Up button in the action bar. ActionBar actionBar = getSupportActionBar(); actionBar.setDisplayHomeAsUpEnabled(true); actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS); // initiating both tabs and set text to it. ActionBar.Tab assignTab = actionBar.newTab().setText("Assignments"); ActionBar.Tab schedTab = actionBar.newTab().setText("Schedule"); ActionBar.Tab contactTab = actionBar.newTab().setText("Contact"); // Create three fragments to display content Fragment assignFragment = new Assignments(); Fragment schedFragment = new Schedule(); Fragment contactFragment = new Contact(); assignTab.setTabListener(new MyTabsListener(assignFragment)); schedTab.setTabListener(new MyTabsListener(schedFragment)); contactTab.setTabListener(new MyTabsListener(contactFragment)); actionBar.addTab(assignTab); actionBar.addTab(schedTab); actionBar.addTab(contactTab); ListView listView = (ListView) findViewById(R.id.assignlist); String[] values = new String[] { "Android", "iPhone", "WindowsMobile", "Blackberry", "WebOS", "Ubuntu", "Windows7", "Max OS X", "Linux", "OS/2" }; // First paramenter - Context // Second parameter - Layout for the row // Third parameter - ID of the TextView to which the data is written // Forth - the Array of data ArrayAdapter<String> adapter = new ArrayAdapter<String>(this, android.R.layout.simple_list_item_1, android.R.id.text1, values); // Assign adapter to ListView listView.setAdapter(adapter); } @Override public boolean onOptionsItemSelected(MenuItem item) { switch (item.getItemId()) { case android.R.id.home: // This ID represents the Home or Up button. In the case of this // activity, the Up button is shown. Use NavUtils to allow users // to navigate up one level in the application structure. For // more details, see the Navigation pattern on Android Design: // // http://developer.android.com/design/patterns/navigation.html#up-vs-back // NavUtils.navigateUpTo(this, new Intent(this, CourseListActivity.class)); return true; } return super.onOptionsItemSelected(item); } class MyTabsListener implements ActionBar.TabListener { public Fragment fragment; public Fragment fragment2; public MyTabsListener(Fragment fragment) { this.fragment = fragment; } @Override public void onTabReselected(Tab tab, FragmentTransaction ft) { } @Override public void onTabSelected(Tab tab, FragmentTransaction ft) { ft.replace(R.id.main_across, fragment); } @Override public void onTabUnselected(Tab tab, FragmentTransaction ft) { ft.remove(fragment); } } } The fragment that I am currently trying to get working is called the Assignments fragment. As you can see in the CourseDetailActvity, I populate smaple items in the listview to see if it the listview shows up. The fragment gets inflated properly, but when I try to add items to the listview, the application crashes! Here is the logcat. 11-17 11:54:28.037: E/AndroidRuntime(282): FATAL EXCEPTION: main 11-17 11:54:28.037: E/AndroidRuntime(282): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.sample/com.example.sample.CourseDetailActivity}: java.lang.NullPointerException 11-17 11:54:28.037: E/AndroidRuntime(282): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2663) 11-17 11:54:28.037: E/AndroidRuntime(282): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2679) 11-17 11:54:28.037: E/AndroidRuntime(282): at android.app.ActivityThread.access$2300(ActivityThread.java:125) 11-17 11:54:28.037: E/AndroidRuntime(282): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2033) 11-17 11:54:28.037: E/AndroidRuntime(282): at android.os.Handler.dispatchMessage(Handler.java:99) 11-17 11:54:28.037: E/AndroidRuntime(282): at android.os.Looper.loop(Looper.java:123) 11-17 11:54:28.037: E/AndroidRuntime(282): at android.app.ActivityThread.main(ActivityThread.java:4627) 11-17 11:54:28.037: E/AndroidRuntime(282): at java.lang.reflect.Method.invokeNative(Native Method) 11-17 11:54:28.037: E/AndroidRuntime(282): at java.lang.reflect.Method.invoke(Method.java:521) 11-17 11:54:28.037: E/AndroidRuntime(282): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868) 11-17 11:54:28.037: E/AndroidRuntime(282): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626) 11-17 11:54:28.037: E/AndroidRuntime(282): at dalvik.system.NativeStart.main(Native Method) 11-17 11:54:28.037: E/AndroidRuntime(282): Caused by: java.lang.NullPointerException 11-17 11:54:28.037: E/AndroidRuntime(282): at com.example.sample.CourseDetailActivity.onCreate(CourseDetailActivity.java:66) 11-17 11:54:28.037: E/AndroidRuntime(282): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047) 11-17 11:54:28.037: E/AndroidRuntime(282): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2627) 11-17 11:54:28.037: E/AndroidRuntime(282): ... 11 more

    Read the article

  • Android - exception from an AsynchTask call

    - by GeekedOut
    I have an Activity that makes a remote server call and tries to populate a list. The call to the server works fine, and the call returns some JSON which is good. But then the system throws this exception: 04-06 18:43:19.626: D/AndroidRuntime(2564): Shutting down VM 04-06 18:43:19.626: W/dalvikvm(2564): threadid=1: thread exiting with uncaught exception (group=0x409c01f8) 04-06 18:43:19.686: E/AndroidRuntime(2564): FATAL EXCEPTION: main 04-06 18:43:19.686: E/AndroidRuntime(2564): java.lang.NullPointerException 04-06 18:43:19.686: E/AndroidRuntime(2564): at android.widget.ArrayAdapter.createViewFromResource(ArrayAdapter.java:394) 04-06 18:43:19.686: E/AndroidRuntime(2564): at android.widget.ArrayAdapter.getView(ArrayAdapter.java:362) 04-06 18:43:19.686: E/AndroidRuntime(2564): at android.widget.AbsListView.obtainView(AbsListView.java:2033) 04-06 18:43:19.686: E/AndroidRuntime(2564): at android.widget.ListView.measureHeightOfChildren(ListView.java:1244) 04-06 18:43:19.686: E/AndroidRuntime(2564): at android.widget.ListView.onMeasure(ListView.java:1155) 04-06 18:43:19.686: E/AndroidRuntime(2564): at android.view.View.measure(View.java:12723) 04-06 18:43:19.686: E/AndroidRuntime(2564): at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:4698) 04-06 18:43:19.686: E/AndroidRuntime(2564): at android.widget.LinearLayout.measureChildBeforeLayout(LinearLayout.java:1369) 04-06 18:43:19.686: E/AndroidRuntime(2564): at android.widget.LinearLayout.measureVertical(LinearLayout.java:660) 04-06 18:43:19.686: E/AndroidRuntime(2564): at android.widget.LinearLayout.onMeasure(LinearLayout.java:553) 04-06 18:43:19.686: E/AndroidRuntime(2564): at android.view.View.measure(View.java:12723) 04-06 18:43:19.686: E/AndroidRuntime(2564): at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:4698) 04-06 18:43:19.686: E/AndroidRuntime(2564): at android.widget.FrameLayout.onMeasure(FrameLayout.java:293) 04-06 18:43:19.686: E/AndroidRuntime(2564): at android.view.View.measure(View.java:12723) 04-06 18:43:19.686: E/AndroidRuntime(2564): at android.widget.LinearLayout.measureVertical(LinearLayout.java:812) 04-06 18:43:19.686: E/AndroidRuntime(2564): at android.widget.LinearLayout.onMeasure(LinearLayout.java:553) 04-06 18:43:19.686: E/AndroidRuntime(2564): at android.view.View.measure(View.java:12723) 04-06 18:43:19.686: E/AndroidRuntime(2564): at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:4698) 04-06 18:43:19.686: E/AndroidRuntime(2564): at android.widget.FrameLayout.onMeasure(FrameLayout.java:293) 04-06 18:43:19.686: E/AndroidRuntime(2564): at com.android.internal.policy.impl.PhoneWindow$DecorView.onMeasure(PhoneWindow.java:2092) 04-06 18:43:19.686: E/AndroidRuntime(2564): at android.view.View.measure(View.java:12723) 04-06 18:43:19.686: E/AndroidRuntime(2564): at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:1064) 04-06 18:43:19.686: E/AndroidRuntime(2564): at android.view.ViewRootImpl.handleMessage(ViewRootImpl.java:2442) 04-06 18:43:19.686: E/AndroidRuntime(2564): at android.os.Handler.dispatchMessage(Handler.java:99) 04-06 18:43:19.686: E/AndroidRuntime(2564): at android.os.Looper.loop(Looper.java:137) 04-06 18:43:19.686: E/AndroidRuntime(2564): at android.app.ActivityThread.main(ActivityThread.java:4424) 04-06 18:43:19.686: E/AndroidRuntime(2564): at java.lang.reflect.Method.invokeNative(Native Method) 04-06 18:43:19.686: E/AndroidRuntime(2564): at java.lang.reflect.Method.invoke(Method.java:511) 04-06 18:43:19.686: E/AndroidRuntime(2564): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:784) 04-06 18:43:19.686: E/AndroidRuntime(2564): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:551) 04-06 18:43:19.686: E/AndroidRuntime(2564): at dalvik.system.NativeStart.main(Native Method) Why would this happen? It doesn't point to any of my code so its a bit strange. the protected void onPostExecute(String result) never gets called on the callback. Thanks!

    Read the article

  • "No XML content. Please add a root view or layout to your document"

    - by evc
    I am trying to code a softkeyboard for 2.1 and up when I code ( see code below) in the main.xml graphical view is displays nothing and says No XML content. Please add a root view or layout to your document" I have tried to place the code in textview but still no luck I can not get the softkeyboard to show at all, its as if my code is being ignored..I have tried these two codes separately nothing works <com.example.android.softkeyboard.LatinKeyboardView xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/keyboard" android:layout_alignParentBottom="true" android:layout_width="match_parent" android:layout_height="wrap_content" /> <Keyboard android:keyWidth="%10p" android:keyHeight="50px" android:horizontalGap="2px" android:verticalGap="2px" > <Row android:keyWidth="32px" > <Key android:keyLabel="A" /> ... </Row> ... </Keyboard>

    Read the article

  • How do I change the keyboard layout to a non-standard one on a Live (USB) session?

    - by Agmenor
    I am running Ubuntu 13.04 in a Live (USB) session. My physical keyboard layout is called Bépo, it is the French language Dvorak method-based layout. I would like to change my input layout to this too. To do this, I tried booting in a French spoken session, then open the Keyboard Layout preferences app. Normally, to add a layout, you should click on the + sign and select your layout. However the list that appears is very short and does not contain what I want. On the contrary, on a persistent non-live installation, the choice of Bépo is present. This is also the case during an installation of Ubuntu. So I do I change the keyboard layout of my live session to the correct one?

    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

  • stdexcept On Android

    - by David R.
    I'm trying to compile SoundTouch on Android. I started with this configure line: ./configure CPPFLAGS="-I/Volumes/android-build/mydroid/development/ndk/build/platforms/android-3/arch-arm/usr/include/" LDFLAGS="-Wl,-rpath-link=/Volumes/android-build/mydroid/development/ndk/build/platforms/android-3/arch-arm/usr/lib -L/Volumes/android-build/mydroid/development/ndk/build/platforms/android-3/arch-arm/usr/lib -nostdlib -lc" --host=arm-eabi --enable-shared=yes CFLAGS="-nostdlib -O3 -mandroid" host_alias=arm-eabi --no-create --no-recursion Because the Android NDK targets ARM, I also had to change the Makefile to remove the -msse2 flags to progress. When I run 'make', I get: /bin/sh ../../libtool --tag=CXX --mode=compile arm-eabi-g++ -DHAVE_CONFIG_H -I. -I../../include -I../../include -I/Volumes/android-build/mydroid/development/ndk/build/platforms/android-3/arch-arm/usr/include/ -O3 -fcheck-new -I../../include -g -O2 -MT FIRFilter.lo -MD -MP -MF .deps/FIRFilter.Tpo -c -o FIRFilter.lo FIRFilter.cpp libtool: compile: arm-eabi-g++ -DHAVE_CONFIG_H -I. -I../../include -I../../include -I/Volumes/android-build/mydroid/development/ndk/build/platforms/android-3/arch-arm/usr/include/ -O3 -fcheck-new -I../../include -g -O2 -MT FIRFilter.lo -MD -MP -MF .deps/FIRFilter.Tpo -c FIRFilter.cpp -o FIRFilter.o FIRFilter.cpp:46:21: error: stdexcept: No such file or directory FIRFilter.cpp: In member function 'virtual void soundtouch::FIRFilter::setCoefficients(const soundtouch::SAMPLETYPE*, uint, uint)': FIRFilter.cpp:177: error: 'runtime_error' is not a member of 'std' FIRFilter.cpp: In static member function 'static void* soundtouch::FIRFilter::operator new(size_t)': FIRFilter.cpp:225: error: 'runtime_error' is not a member of 'std' make[2]: *** [FIRFilter.lo] Error 1 make[1]: *** [all-recursive] Error 1 make: *** [all-recursive] Error 1 This isn't very surprising, since the -nostdlib flag was required. Android seems to have neither stdexcept nor stdlib. How can I get past this block of compiling SoundTouch? At a guess, there may be some flag I don't know about that I should use. I could refactor the code not to use stdexcept. There may be a way to pull in the original stdexcept source and reference that. I might be able to link to a precompiled stdexcept library.

    Read the article

< Previous Page | 15 16 17 18 19 20 21 22 23 24 25 26  | Next Page >