Search Results

Search found 13093 results on 524 pages for 'android widget'.

Page 10/524 | < Previous Page | 6 7 8 9 10 11 12 13 14 15 16 17  | Next Page >

  • Unable to Start Activity ComponentInfo when Starting a New Activity

    - by Timtim17
    {I know there's already a whole bunch of questions like this, but I can't see any problems that related to my program.} I have an Android App that is supposed to take a name from a EditText and put it in a TextView in another activity. It previously worked, but then I wanted it to start another activity if the EditText's value was equal to "ANDROID". However, now the app crashes whenever I try to start either activity. First Activity: package net.timtim17.dev.android.fun.nametag; import android.os.Bundle; import android.app.Activity; import android.content.Intent; import android.view.View; import android.view.View.OnClickListener; import android.widget.Button; import android.widget.EditText; public class MainActivity extends Activity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); final EditText et = (EditText) findViewById(R.id.editText1); Button submit = (Button) findViewById(R.id.button1); submit.setOnClickListener(new OnClickListener(){ @Override public void onClick(View v) { String text = et.getText().toString(); if(text.equals("ANDROID")){ Intent android = new Intent(MainActivity.this, AndroidNameTag.class); startActivity(android); }else{ Intent intent = new Intent(MainActivity.this, NameTag.class); intent.putExtra("name", text); startActivity(intent); } } }); } } NameTag Activity: package net.timtim17.dev.android.fun.nametag; import android.app.Activity; import android.os.Bundle; import android.widget.TextView; public class NameTag extends Activity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_tag); TextView tv = (TextView) findViewById(R.id.textView2); tv.setText(getIntent().getExtras().getString("name")); } } AndroidNameTag Activity: package net.timtim17.dev.android.fun.nametag; import android.app.Activity; import android.graphics.drawable.AnimationDrawable; import android.os.Bundle; import android.widget.ImageView; public class AndroidNameTag extends Activity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_android); ImageView iv = (ImageView) findViewById(R.id.imageView1); iv.setBackgroundResource(R.anim.animation); AnimationDrawable anim = (AnimationDrawable) iv.getBackground(); anim.start(); } } LogCat Error: 10-26 11:26:35.602: E/AndroidRuntime(2900): FATAL EXCEPTION: main 10-26 11:26:35.602: E/AndroidRuntime(2900): java.lang.RuntimeException: Unable to start activity ComponentInfo{net.timtim17.dev.android.fun.nametag/net.timtim17.dev.android.fun.nametag.NameTag}: java.lang.NullPointerException 10-26 11:26:35.602: E/AndroidRuntime(2900): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2211) 10-26 11:26:35.602: E/AndroidRuntime(2900): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2261) 10-26 11:26:35.602: E/AndroidRuntime(2900): at android.app.ActivityThread.access$600(ActivityThread.java:141) 10-26 11:26:35.602: E/AndroidRuntime(2900): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1256) 10-26 11:26:35.602: E/AndroidRuntime(2900): at android.os.Handler.dispatchMessage(Handler.java:99) 10-26 11:26:35.602: E/AndroidRuntime(2900): at android.os.Looper.loop(Looper.java:137) 10-26 11:26:35.602: E/AndroidRuntime(2900): at android.app.ActivityThread.main(ActivityThread.java:5103) 10-26 11:26:35.602: E/AndroidRuntime(2900): at java.lang.reflect.Method.invokeNative(Native Method) 10-26 11:26:35.602: E/AndroidRuntime(2900): at java.lang.reflect.Method.invoke(Method.java:525) 10-26 11:26:35.602: E/AndroidRuntime(2900): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:737) 10-26 11:26:35.602: E/AndroidRuntime(2900): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553) 10-26 11:26:35.602: E/AndroidRuntime(2900): at dalvik.system.NativeStart.main(Native Method) 10-26 11:26:35.602: E/AndroidRuntime(2900): Caused by: java.lang.NullPointerException 10-26 11:26:35.602: E/AndroidRuntime(2900): at net.timtim17.dev.android.fun.nametag.NameTag.onCreate(NameTag.java:15) 10-26 11:26:35.602: E/AndroidRuntime(2900): at android.app.Activity.performCreate(Activity.java:5133) 10-26 11:26:35.602: E/AndroidRuntime(2900): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1087) 10-26 11:26:35.602: E/AndroidRuntime(2900): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2175) 10-26 11:26:35.602: E/AndroidRuntime(2900): ... 11 more MainActivity Layout: <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" android:paddingBottom="@dimen/activity_vertical_margin" android:paddingLeft="@dimen/activity_horizontal_margin" android:paddingRight="@dimen/activity_horizontal_margin" android:paddingTop="@dimen/activity_vertical_margin" tools:context=".MainActivity" > <TextView android:id="@+id/textView1" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_alignParentLeft="true" android:layout_alignParentTop="true" android:layout_marginTop="16dp" android:text="@string/main_text" android:textAppearance="?android:attr/textAppearanceMedium" /> <Button android:id="@+id/button1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignRight="@+id/textView1" android:layout_below="@+id/textView1" android:layout_marginTop="14dp" android:text="@string/submit_button" /> <EditText android:id="@+id/editText1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignLeft="@+id/textView1" android:layout_alignTop="@+id/button1" android:ems="10" android:inputType="textPersonName" > <requestFocus /> </EditText>

    Read the article

  • Android: Adding extended GLSurfaceView to a Layout don't show 3d stuff

    - by Santiago
    I make a game extending the class GLSurfaceView, if I apply SetContentView directly to that class, the 3d stuff and input works great. Now I want to show some items over 3d stuff, so I create a XML with a layout and some objects, and I try to add my class manually to the layout. I'm not getting errors but the 3d stuff is not shown but I can view the objects from XML layout. source: @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); LayoutInflater inflater = (LayoutInflater) getSystemService(LAYOUT_INFLATER_SERVICE); layout = (RelativeLayout) inflater.inflate(R.layout.testlayout, null); //Create an Instance with this Activity my3dstuff = new myGLSurfaceViewClass(this); layout.addView(my3dstuff,4); setContentView(R.layout.testlayout); } And testlayout have: <?xml version="1.0" encoding="utf-8"?> <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="wrap_content" android:layout_height="wrap_content" android:id="@+id/Pantalla"> <ImageView android:id="@+id/zoom_less" android:layout_width="wrap_content" android:layout_height="wrap_content" android:src="@drawable/zoom_less"></ImageView> <ImageView android:id="@+id/zoom_more" android:layout_width="wrap_content" android:src="@drawable/zoom_more" android:layout_height="wrap_content" android:layout_alignParentRight="true"></ImageView> <ImageView android:id="@+id/zoom_normal" android:layout_width="wrap_content" android:layout_height="wrap_content" android:src="@drawable/zoom_normal" android:layout_centerHorizontal="true"></ImageView> <ImageView android:id="@+id/stop" android:layout_width="wrap_content" android:layout_height="wrap_content" android:src="@drawable/stop" android:layout_centerInParent="true" android:layout_alignParentBottom="true"></ImageView> </RelativeLayout> I also tried to add my class to XML but the Activity hangs up. <com.mygame.myGLSurfaceViewClass android:id="@+id/my3dstuff" android:layout_width="fill_parent" android:layout_height="fill_parent"></com.mygame.myGLSurfaceViewClass> and this don't works: <View class="com.mygame.myGLSurfaceViewClass" android:id="@+id/my3dstuff" android:layout_width="fill_parent" android:layout_height="fill_parent"></View> Any Idea? Thanks

    Read the article

  • Start TabActivity from ListActivity (which is content of parent TabActivity) in Android

    - by barmaleikin
    Hi guys, I have problems with switching between activities. I have two TabActivities (A and B), each of of tab activity has 4 tabs with ListActivity. I am trying to show B activity onListItemClick. Code on click is: Intent intent = new Intent(getApplicationContext(), TabBActivity.class); startActivity(intent); My manifest file is following: <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com" android:versionCode="1" android:versionName="1.0"> <application android:icon="@drawable/app_icon" android:label="@string/app_name" android:debuggable="true"> <activity android:name=".SplashScreen" 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=".TabAActivity"> <intent-filter> <action android:name="com.TabAActivity" /> <category android:name="android.intent.category.LAUNCHER" /> </intent-filter> </activity> <activity android:name=".TabAListActivityA" android:label="AA"/> <activity android:name=".TabAListActivityB" android:label="AB"/> <activity android:name=".TabAListActivityC" android:label="AC"/> <activity android:name=".TabBActivity" android:label="B"/> <activity android:name=".TabAListBctivityA" android:label="BA"/> <activity android:name=".TabAListBctivityB" android:label="BB"/> <activity android:name=".TabAListBctivityC" android:label="BC"/> </application> </manifest> Is my manifest correct or maybe something is wrong with code? I would appreciate any help on this topic.

    Read the article

  • Android local search

    - by Aleksander O
    Hi! I'm trying to implement a local search in my activity. I've added an appropriate intent filter and metadata tag to manifest file but if I click Search button it invokes standard android search box. What's my problem? Manifest file: <?xml version="1.0" encoding="utf-8"?> <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.nixsolutions.invertigation.android.dataprovider" android:versionCode="1" android:versionName="1.0"> <application android:icon="@drawable/icon" android:label="@string/app_name" android:debuggable="true"> <provider android:name="NoteProvider" android:authorities="com.nixsolutions.investigation.android.NoteProvider"> </provider> <activity android:name="NotesList"> <intent-filter> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" /> </intent-filter> <intent-filter> <action android:name="android.intent.action.SEARCH" /> <category android:name="android.intent.category.DEFAULT" /> </intent-filter> <meta-data android:name="android.app.searchable" android:resource="@xml/searchable" /> </activity> </application> <uses-sdk android:minSdkVersion="7" /> </manifest> searchable.xml: <?xml version="1.0" encoding="utf-8"?> <searchable xmlns:android="http://schemas.android.com/apk/res/android" android:label="Custom search" android:hint="Custom hint" android:searchMode="showSearchLabelAsBadge" />

    Read the article

  • Nested Linear layout only shows first view after being set from gone to visible in Android

    - by Adam
    Hi guys, I am developing an Android app but I'm still pretty new. I want to have a button, and when you push that button, a few TextViews and Buttons will appear. So I have a main linear layout, and then another linear layout nested inside containing the things I want hidden. I have the nested linear layout set to android:visibility="gone". The problem I am having is that it only shows the first item inside the hidden linear layout instead of all of them. The way I try to make it appear is vgAddView = (ViewGroup)findViewById(R.id.add_details); btnAche.setOnClickListener(new OnClickListener(){ public void onClick(View v){ vgAddView.setVisibility(0); } }); My XML file is this <?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" > <Button android:text="@string/but_stomach_ache" android:id="@+id/but_stomach_ache" android:layout_width="fill_parent" android:layout_height="wrap_content"> </Button> <Button android:text="@string/but_food" android:id="@+id/but_food" android:layout_width="fill_parent" android:layout_height="wrap_content"> </Button> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="vertical" android:layout_width="fill_parent" android:layout_height="fill_parent" android:id="@+id/add_details" android:visibility="gone"> <TextView android:orientation="vertical" android:layout_width="fill_parent" android:layout_height="fill_parent" android:text="@string/when_happen"> </TextView> <Button android:text="@string/happen_now" android:id="@+id/happen_now" android:layout_width="fill_parent" android:layout_height="wrap_content"> </Button> </LinearLayout> </LinearLayout>

    Read the article

  • How do you set Android ViewPager to encompass only one View or Layout?

    - by Kyle
    I am struggling with the concepts needed to properly implement a view pager. By following some tutorials and referencing developer.android.com, I am able to get a view pager almost fully functional. The pager will flip through several text views that have been setup to say "My Message 0" through "My Message 9". The problem is that the view pager also flips the button on the bottom of the activity and the red block that is right above the button. I would like to have the view pager only cycle through the text. Would you please help me understand what I'm doing wrong? I have an activity that represents a dashboard: public class DashBoard extends FragmentActivity { private static final int NUMBER_OF_PAGES = 10; private ViewPager mViewPager; private MyFragmentPagerAdapter mMyFragmentPagerAdapter; public void onCreate(Bundle icicle){ super.onCreate(icicle); setContentView(R.layout.dashboard); mViewPager = (ViewPager) findViewById(R.id.viewpager); mMyFragmentPagerAdapter = new MyFragmentPagerAdapter(getSupportFragmentManager()); mViewPager.setAdapter(mMyFragmentPagerAdapter); } private static class MyFragmentPagerAdapter extends FragmentPagerAdapter{ public MyFragmentPagerAdapter(FragmentManager fm) { super(fm); } @Override public Fragment getItem(int index) { return PageFragment.newInstance("My Message " + index); } @Override public int getCount(){ return NUMBER_OF_PAGES; } } and a class for the page fragment: public class PageFragment extends Fragment { public static PageFragment newInstance(String title){ PageFragment pageFragment = new PageFragment(); Bundle bundle = new Bundle(); bundle.putString("title", title); pageFragment.setArguments(bundle); return pageFragment; } @Override public void onCreate(Bundle icicle){ super.onCreate(icicle); } @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle icicle){ View view = inflater.inflate(R.layout.dashboard, container, false); TextView textView = (TextView) view.findViewById(R.id.textViewPage); textView.setText(getArguments().getString("title")); return view; } } and finally, my xml for the dashboard: <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:id="@+id/dashbaordLabel" android:layout_width="match_parent" android:layout_height="wrap_content" > <android.support.v4.view.ViewPager android:id="@+id/viewpager" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_alignParentTop="true" android:layout_alignParentLeft="true" /> <TextView android:id="@+id/textViewPage" android:layout_width = "match_parent" android:layout_height= "wrap_content" /> <Button android:id="@+id/newGoalButton" android:layout_width="match_parent" android:layout_height="wrap_content" android:text="@string/stringNewGoal" android:layout_alignParentBottom="true" android:layout_alignParentLeft="true" android:onClick="createNewGoal" /> <RelativeLayout android:id="@+id/SpaceBottom" android:layout_width="match_parent" android:layout_height="75dp" android:layout_above="@id/newGoalButton" android:background="@color/red" > </RelativeLayout> </RelativeLayout> A note about my xml, I tried wrapping the text view in some view pager tags eg: <android.support.v4.view.ViewPager android:id="@+id/viewpager" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_alignParentTop="true" android:layout_alignParentLeft="true" > <TextView android:id="@+id/textViewPage" android:layout_width = "match_parent" android:layout_height= "wrap_content" /> </android.support.v4.view.ViewPager> But all that did was make the text view disappear from the screen, while the button and red block still cycled as in the original issue.

    Read the article

  • ClickableSpan on TextView in App Widget

    - by Dave Allison
    I have created an App Widget for Android 1.5. It uses a TextView to present a number of individual Text Links using ClickableSpans. However, the onClick event handler on the ClickableSpan is never called, it appears that you can not select individual components on the widget just the whole widget. This approach works fine for a normal app, so what I do I need to change to make this work for a widget?

    Read the article

  • Andorid - Display HTML Formatted String

    - by Soren
    I need an example how to display the strings that I have marked up with simple html into a TextView. I have found "Spanned fromHtml(String source)", but I don't know how to plug it into my java code. Here is my Java: package com.SorenWinslow.TriumphHistory; import android.app.ListActivity; import android.os.Bundle; import android.widget.ArrayAdapter; public class TriumphHistory extends ListActivity { String[] HistoryList; /** Called when the activity is first created. */ @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); ArrayAdapter<String> adapter; HistoryList = getResources().getStringArray(R.array.history); adapter = new ArrayAdapter<String> (this,R.layout.historylistlayout,HistoryList); setListAdapter(adapter); } } Here is a sample of history: <?xml version="1.0" encoding="utf-8"?> <resources> <string-array name="history"> <item><b>1883</b><br/>Some stuff happened</item> <item><b>1884</b><br/>Some more stuff happened <i>before</i> the other stuff </item> <resources> Here is my historylistlayout.xml: <?xml version="1.0" encoding="utf-8"?> <TextView xmlns:android="http://schemas.android.com/apk/res/android" android:id="@android:id/text1" android:layout_width="fill_parent" android:layout_height="wrap_content" android:textAppearance="?android:attr/textAppearanceLarge" android:gravity="center_vertical" android:textColor="#ffffff" android:background="#000050" android:layout_marginTop="5px" android:minHeight="?android:attr/listPreferredItemHeight" android:padding="3px" android:textSize="8pt" android:layout_gravity="top|left"/> And here is my main.xml <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="vertical" android:textColor="#ffffff" android:background="#000080" android:isScrollContainer="true" android:layout_height="fill_parent" android:layout_width="fill_parent" android:scrollbarStyle="insideOverlay"> <ListView xmlns:android="http://schemas.android.com/apk/res/android" android:id="@android:id/list" android:layout_width="fill_parent" android:layout_height="wrap_content" android:clickable="true" android:dividerHeight="1px"/> </LinearLayout>

    Read the article

  • Android project problem

    - by qwerty
    Hello, here I uploaded my Android project made in Eclipse. The idea is that i have a service, which computes the sum of two random numbers. But when i press the OK Button, i don't see the result in that edit box... why? What i'm doing wrong? Please help Thanks! EDIT: The code: //service class package service; import java.util.Random; import com.android.AplicatieSuma; import android.widget.EditText; import android.widget.TextView; public class ServiciuSuma { public ServiciuSuma() { } public int CalculateSum() { Random generator=new Random(); int n=generator.nextInt(); int m=generator.nextInt(); return n+m; } } The Application class: package com.android; import android.app.*; import service.*; public class ApplicationSum extends Application { public ServiciuSuma service = new ServiciuSuma(); } and the main Activity class: package com.android; import com.android.R; import android.app.Activity; import android.content.Intent; import android.graphics.Color; import android.graphics.PorterDuffColorFilter; import android.graphics.drawable.Drawable; import android.graphics.PorterDuff; import android.os.Bundle; import android.provider.Settings; import android.view.View; import android.view.View.OnClickListener; import android.widget.EditText; import android.view.Menu; import android.view.MenuInflater; import android.view.MenuItem; public class Activitate extends Activity { /** Called when the activity is first created. */ @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); View btn_ok = findViewById(R.id.btn_ok); btn_ok.setOnClickListener(new OnClickListener() { public void onClick(View v) { CalculeazaSuma(); } }); } private void CalculeazaSuma() { AplicatieSuma appState = ((AplicatieSuma)this.getApplication()); EditText txt_amount = (EditText)findViewById(R.id.txt_amount); txt_amount.setText(appState.service.CalculateSum()); //BindData(); } } So that edit text does not show the sum of the random generated numbers, by the service. What's wrong? Thanks EDIT: the manifest xml file: <?xml version="1.0" encoding="utf-8"?> <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.android" android:versionCode="1" android:versionName="1.0.1"> <supports-screens android:largeScreens="true" android:normalScreens="true" android:smallScreens="true" android:anyDensity="true" /> <application android:name="ApplicationSum" android:icon="@drawable/icon" android:label="@string/app_name" android:debuggable="true"> <activity android:label="@string/app_name" android:name=".Activitate"> <intent-filter> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" /> </intent-filter> </activity> </application> <uses-sdk android:minSdkVersion="7" android:targetSdkVersion="7" /> </manifest>

    Read the article

  • Eclipse will not show 2.3 emulator for android compatibility package code

    - by Mark Lasby
    I am trying to learn fragments to modernize an app I originally wrote for android 1.5 that uses Date Picker Dialog. I am using the android-support-v4 library. When I run the code in Eclipse Juno 20120614-1722 it only shows android 4.0 emulators and there is a red X beside my Samsung phone running 2.3.5. When I push the package to phone, the code runs. Here is the code FragTestActivity.java package xyz.marklasby.fragtest; import java.text.SimpleDateFormat; import java.util.Calendar; import android.app.DatePickerDialog; import android.os.Bundle; import android.support.v4.app.DialogFragment; import android.support.v4.app.FragmentActivity; import android.view.View; import android.widget.Button; import android.widget.DatePicker; public class FragTestActivity extends FragmentActivity { private Button date; private Calendar now; private SimpleDateFormat sdf = new SimpleDateFormat(" EEE MMM dd/yyyy"); @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); date = (Button) findViewById(R.id.setdate); now = Calendar.getInstance(); date.setText(sdf.format(now.getTime())); date.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { editDate(v); } }); } public void editDate(View v) { DialogFragment newFragment = DatePickerFragment.newInstance(new DatePickerDialog.OnDateSetListener() { @Override public void onDateSet(DatePicker view, int year, int monthOfYear, int dayOfMonth) { now.set(year, monthOfYear, dayOfMonth); date.setText(sdf.format(now.getTime())); } }); newFragment.show(getSupportFragmentManager(), "datePicker"); } } DatePickerFragment.java package xyz.marklasby.fragtest; import java.util.Calendar; import android.app.DatePickerDialog; import android.app.Dialog; import android.os.Bundle; import android.support.v4.app.DialogFragment; public class DatePickerFragment extends DialogFragment { static DatePickerDialog.OnDateSetListener mListener; public static DatePickerFragment newInstance(DatePickerDialog.OnDateSetListener listener) { mListener = listener; return new DatePickerFragment(); } @Override public Dialog onCreateDialog(Bundle savedInstanceState) { final Calendar c = Calendar.getInstance(); int year = c.get(Calendar.YEAR); int month = c.get(Calendar.MONTH); int day = c.get(Calendar.DAY_OF_MONTH); return new DatePickerDialog(getActivity(), mListener, year, month, day); } } Manifest.xml <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="xyz.marklasby.fragtest" android:versionCode="1" android:versionName="1.0" > <uses-sdk android:minSdkVersion="8" android:targetSdkVersion="15" /> <application android:icon="@drawable/ic_launcher" android:label="@string/app_name" android:theme="@style/AppTheme" > <activity android:name=".FragTestActivity" android:label="@string/title_activity_frag_test" > <intent-filter> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" /> </intent-filter> </activity> </application> </manifest> What am I doing wrong?

    Read the article

  • Android Augmented Reality

    - by Azooz Totti
    I'm working on my first Android Augmented Reality application. The application works pretty good if the ARActivity runs as the first class (android.intent.category.LAUNCHER) in the manifest file. But when I added a splash screen which means the ARActivity will be the second to run(android.intent.category.DEFAULT), the camera seems not detecting the marker. I believe the problem is all in the manifest file. Any suggestions ? Thanks This is the manifest.xml <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.ar.armarkers" android:versionCode="1" android:versionName="1.0" > <uses-sdk android:minSdkVersion="8" android:targetSdkVersion="15" /> <uses-permission android:name="android.permission.CAMERA" /> <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" /> <uses-feature android:name="android.hardware.camera" /> <uses-feature android:name="android.hardware.camera.autofocus" /> <application android:icon="@drawable/ic_launcher" android:label="@string/app_name" android:theme="@style/AppTheme" > <activity android:name=".Splash" android:screenOrientation="landscape" android:theme="@android:style/Theme.Black.NoTitleBar.Fullscreen" > <intent-filter> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" /> </intent-filter> </activity> <activity android:name="com.ar.armarkers.MainActivity" android:clearTaskOnLaunch="true" android:label="@string/title_activity_main" android:noHistory="true" android:screenOrientation="landscape" > <intent-filter> <action android:name="com.ar.armarkers.MAINACTIVITY" /> <category android:name="android.intent.category.DEFAULT" /> </intent-filter> </activity> </application> </manifest> MainActivity.java import edu.dhbw.andar.ARObject; import edu.dhbw.andar.ARToolkit; import edu.dhbw.andar.AndARActivity; import edu.dhbw.andar.exceptions.AndARException; import edu.dhbw.andar.pub.CustomRenderer; import android.os.Bundle; import android.util.Log; public class MainActivity extends AndARActivity { private ARObject someObject; private ARToolkit artoolkit; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); CustomRenderer renderer = new CustomRenderer(); setNonARRenderer(renderer); try { artoolkit = getArtoolkit(); someObject = new CustomObject1("test", "marker16.pat", 80.0, new double[] { 0, 0 }); artoolkit.registerARObject(someObject); someObject = new CustomObject2 ("test", "marker17.patt", 80.0, new double[]{0,0}); artoolkit.registerARObject(someObject); } catch (AndARException ex) { System.out.println(""); } startPreview(); } public void uncaughtException(Thread thread, Throwable ex) { // TODO Auto-generated method stub Log.e("AndAR EXCEPTION", ex.getMessage()); finish(); } } Splash.java import android.app.Activity; import android.app.ProgressDialog; import android.content.Intent; import android.os.Bundle; import android.view.Gravity; public class Splash extends Activity { @Override protected void onCreate(Bundle savedInstanceState) { // TODO Auto-generated method stub super.onCreate(savedInstanceState); setContentView(R.layout.splash); Thread timer = new Thread() { public void run() { try { sleep(1000); } catch (InterruptedException e) { e.printStackTrace(); } finally { Intent i = new Intent(getApplicationContext(), MainActivity.class); startActivity(i); } } }; timer.start(); } }

    Read the article

  • Problem using setEmptyView on a ListActivity

    - by Pentium10
    I have the following setup, and the empty view text doesn't show up... protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); getListView().setEmptyView(findViewById(R.id.empty)); getListView().setTextFilterEnabled(true); setListAdapter(null);// to have empty list } The layout file is: <?xml version="1.0" encoding="utf-8"?> <LinearLayout android:id="@+id/myScrollLayout" android:layout_width="fill_parent" android:layout_height="fill_parent" android:orientation="vertical" xmlns:android="http://schemas.android.com/apk/res/android"> <FrameLayout android:layout_width="fill_parent" android:layout_height="0dip" android:layout_weight="1"> <ListView android:id="@android:id/list" android:layout_width="fill_parent" android:layout_height="fill_parent" android:drawSelectorOnTop="false" /> <!-- Here is the view to show if the list is emtpy --> <ScrollView android:id="@android:id/empty" android:layout_width="fill_parent" android:layout_height="fill_parent"> <TextView android:id="@+id/emptyText" android:layout_width="fill_parent" android:layout_height="fill_parent" android:text="@string/contact_empty_help" android:textSize="20sp" android:textColor="?android:attr/textColorSecondary" android:paddingLeft="10dip" android:paddingRight="10dip" android:paddingTop="10dip" android:lineSpacingMultiplier="0.92" /> </ScrollView> </FrameLayout> </LinearLayout> String is defined as: <string name="contact_empty_help">"You don't have any contacts to display.\n\nTo add contacts, you have to:\n \n<li><font fgcolor="#ffffffff">Go to <b>Contacts</b></font> application to create new contacts\n</li> \n<li><font fgcolor="#ffffffff"><b>Import from VCF file</b></font>, this is available in Contacts menu, the file most be on the root of the SD card\n</li>" </string> Since the list is empty, it should show me the text defined. I followed the example from the List8 http://developer.android.com/intl/de/resources/samples/ApiDemos/src/com/example/android/apis/view/List8.html http://developer.android.com/intl/de/resources/samples/ApiDemos/res/layout/list_8.xml

    Read the article

  • How to add a Fragment inside a ViewPager using Nested Fragment (Android 4.2)

    - by sabadow
    I have a ViewPager with three Fragments, each one shows a List (or Grid). In the new Android API level 17 (Jelly Bean 4.2), one of the features is Nested Fragments. The new functionality description says: if you use ViewPager to create fragments that swipe left and right and consume a majority of the screen space, you can now insert fragments into each fragment page. So, if I understand right, now I can create a ViewPager with Fragments (with a button inside for example) inside, and when user press the button show another Fragment without loose the ViewPager using this new feature. I expend my morning trying to implement this on several ways but I can´t made it... Can somebody show a simple example of how to do this? PS: I'm only interested in doing at this way, with getChildFragmentManager to learn how works.

    Read the article

  • Android camera AVD error 100

    - by Cristian Voina
    I am trying to learn how to make a simple app in android. As background information I have only programmed in C language, no OOP. Currently I am trying turn on the camera using the indications from Android Developer site but some minor changes: - no button for capturing image. - no new activity. What I am trying to do is jut preview the camera. I will post the Code that I am using, the manifest and the LogCat. Main Activity: package com.example.camera_display; import android.app.Activity; import android.hardware.Camera; import android.os.Bundle; import android.view.Menu; import android.widget.FrameLayout; import android.widget.TextView; public class MainActivity extends Activity { private Camera mcamera; private CameraPreview mCameraPreview; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); mcamera = getCameraInstance(); mCameraPreview = new CameraPreview(this, mcamera); FrameLayout preview = (FrameLayout) findViewById(R.id.camera_preview); preview.addView(mCameraPreview); } public static Camera getCameraInstance(){ Camera c = null; try { c = Camera.open(); // attempt to get a Camera instance } catch (Exception e){ // Camera is not available (in use or does not exist) } return c; // returns null if camera is unavailable } @Override public boolean onCreateOptionsMenu(Menu menu) { // Inflate the menu; this adds items to the action bar if it is present. getMenuInflater().inflate(R.menu.main, menu); return true; } } CameraPreview Class: package com.example.camera_display; import java.io.IOException; import android.content.Context; import android.hardware.Camera; import android.util.Log; import android.view.SurfaceHolder; import android.view.SurfaceView; /** A basic Camera preview class */ public class CameraPreview extends SurfaceView implements SurfaceHolder.Callback { private static final String TAG = "MyActivity"; private SurfaceHolder mHolder; private Camera mCamera; public CameraPreview(Context context, Camera camera) { super(context); mCamera = camera; // Install a SurfaceHolder.Callback so we get notified when the // underlying surface is created and destroyed. mHolder = getHolder(); mHolder.addCallback(this); // deprecated setting, but required on Android versions prior to 3.0 mHolder.setType(SurfaceHolder.SURFACE_TYPE_PUSH_BUFFERS); } public void surfaceCreated(SurfaceHolder holder) { // The Surface has been created, now tell the camera where to draw the preview. try { mCamera.setPreviewDisplay(holder); mCamera.startPreview(); } catch (IOException e) { Log.d(TAG, "Error setting camera preview: " + e.getMessage()); } } public void surfaceDestroyed(SurfaceHolder holder) { // empty. Take care of releasing the Camera preview in your activity. } public void surfaceChanged(SurfaceHolder holder, int format, int w, int h) { // If your preview can change or rotate, take care of those events here. // Make sure to stop the preview before resizing or reformatting it. if (mHolder.getSurface() == null){ // preview surface does not exist return; } // stop preview before making changes try { mCamera.stopPreview(); } catch (Exception e){ // ignore: tried to stop a non-existent preview } // set preview size and make any resize, rotate or // reformatting changes here // start preview with new settings try { mCamera.setPreviewDisplay(mHolder); mCamera.startPreview(); } catch (Exception e){ Log.d(TAG, "Error starting camera preview: " + e.getMessage()); } } } Manifest: <uses-permission android:name="android.permission.CAMERA"/> <uses-feature android:name="android.hardware.camera"/> LOG CAT: 06-30 15:58:35.075: D/libEGL(1153): loaded /system/lib/egl/libEGL_emulation.so 06-30 15:58:35.147: D/(1153): HostConnection::get() New Host Connection established 0x2a156060, tid 1153 06-30 15:58:35.478: D/libEGL(1153): loaded /system/lib/egl/libGLESv1_CM_emulation.so 06-30 15:58:35.515: D/libEGL(1153): loaded /system/lib/egl/libGLESv2_emulation.so 06-30 15:58:36.334: W/EGL_emulation(1153): eglSurfaceAttrib not implemented 06-30 15:58:36.685: D/OpenGLRenderer(1153): Enabling debug mode 0 06-30 15:58:36.935: D/MyActivity(1153): Error starting camera preview: startPreview failed 06-30 15:58:36.965: I/Choreographer(1153): Skipped 125 frames! The application may be doing too much work on its main thread. 06-30 15:58:38.455: W/Camera(1153): Camera server died! 06-30 15:58:38.455: W/Camera(1153): ICamera died 06-30 15:58:38.476: E/Camera(1153): Error 100 So If anyone could tell me what I am doing wrong (and explain why it should be done different) that would be great :) Thanks!

    Read the article

  • How to programatically set drawableLeft on Android button?

    - by Frank LoVecchio
    I'm dynamically creating buttons. I styled them using XML first, and I'm trying to take the XML below and make it programattic. <Button android:id="@+id/buttonIdDoesntMatter" android:layout_height="wrap_content" android:layout_width="fill_parent" android:text="buttonName" android:drawableLeft="@drawable/imageWillChange" android:onClick="listener" android:layout_width="fill_parent"> </Button> This is what I have so far. I can do everything but the drawable. linear = (LinearLayout) findViewById(R.id.LinearView); Button button = new Button(this); button.setText("Button"); button.setOnClickListener(listener); button.setLayoutParams( new LayoutParams( android.view.ViewGroup.LayoutParams.FILL_PARENT, android.view.ViewGroup.LayoutParams.WRAP_CONTENT ) ); linear.addView(button);

    Read the article

  • android soft keyboard covers editText in landscape

    - by gabi
    I have the following layout: <?xml version="1.0" encoding="utf-8"?> <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="fill_parent"> <LinearLayout android:layout_height="wrap_content" android:layout_width="fill_parent" android:orientation="vertical" android:layout_above="@+id/edittext"> <TextView android:layout_height="wrap_content" android:layout_width="fill_parent" android:text="line1"/> <TextView android:layout_height="wrap_content" android:layout_width="fill_parent" android:text="line2"/> <TextView android:layout_height="wrap_content" android:layout_width="fill_parent" android:text="line3"/> </LinearLayout> <EditText android:id="@id/edittext" android:layout_height="wrap_content" android:layout_width="fill_parent" android:layout_margin="5dp" android:text="test" android:layout_alignParentBottom="true" android:imeOptions="flagNoExtractUi" /> </RelativeLayout> and in landscape on a Nexus one it looks like: Is there a way to fix this, but keep flag flagNoExtractUi ?

    Read the article

  • Android customizing ViewFlipper...

    - by wearysamurai
    So I'm having pretty much exactly the problem described here: http://code.google.com/p/android/issues/detail?id=6191 and until the ViewFlipper issue in 2.1 and 2.2 has been resolved, I'm attempting to customize my own ViewFlipper in the manner described: @Override protected void onDetachedFromWindow() { try { super.onDetachedFromWindow(); } catch (IllegalArgumentException e) { // Call stopFlipping() in order to kick off updateRunning() stopFlipping(); } } But I've never done this sort of thing before and am hoping to get a little guidance (as my own efforts are coming up short). Here's what I have so far. FixedFlipper.java: import android.content.Context; import android.util.AttributeSet; import android.widget.ViewFlipper; public class FixedFlipper extends ViewFlipper{ public FixedFlipper(Context context){ super(context); } public FixedFlipper(Context context, AttributeSet attrs){ super(context, attrs); } @Override protected void onDetachedFromWindow(){ try{ super.onDetachedFromWindow(); }catch(Exception e){ super.stopFlipping(); } } } main.xml: <com.site.TestApp.FixedFlipper style="@style/body" android:id="@+id/flipper"> ... </com.site.TestApp.FixedFlipper> And in my activity, I invoke it like so: FixedFlipper flipper = (FixedFlipper)findViewById(R.id.flipper); It seems like it should be pretty straightforward, but I keep getting this: Binary XML file line #4: Error inflating class com.site.TestApp.FixedFlipper I appreciate any suggestions. I've been chasing my tail for hours trying to figure out what piece of the puzzle I'm missing.

    Read the article

  • Android Emulator - Cannot get keyboard to display

    - by Ash
    Basically I cannot get the onscreen keyboard to display at all. I've tried every solution I've read to make it appear within my application, and now I've come to the conclusion that it must be the emulator as it isn't appearing when using Messages, writing e-mails etc. I've looked in Language & input within settings and checked Sample Soft Keyboard, rebooted the emulator with no change. Using Android SKD 2.3.3 3.7in WVGA (Nexus One) I'm hoping someone can maybe guess what's going on. Many thanks

    Read the article

  • layout problam in android

    - by mahdi
    Hi i try show layout like image 1 (textView and editText in same line) but my out put shown like image 2 ! i try with this code : <?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="wrap_content" android:padding="5px" > <TextView android:id="@+id/label" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="URL:" android:layout_alignBaseline="@+id/entry" android:layout_alignParentLeft="true"/> /> <EditText android:id="@+id/entry" android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_toRightOf="@id/label" android:layout_alignParentTop="true" /> <Button android:id="@+id/button" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="center_horizontal" android:paddingRight="30px" android:paddingLeft="30px" android:text="Go..." /> </LinearLayout> please help me thanks

    Read the article

  • How to correctly handle click events on Widget

    - by www.liveinternet.ruusersilya_bog
    There is a task to make smt like todo list on widget (with dinamic number of elements), how to organize this list for click support on this elements. I only found how add click event on one widget layout element (with setOnClickPendingIntent), and how send text to widget element TextView. But it's unclear how handle click events for sub-elemets, or how get click coordinates(or item) where was click event. I saw widget "Agenda widget" - and it work fine with clicking on different calendar rows. I will be very much appreciated for help.

    Read the article

  • Android: HTTPClient

    - by primal
    Hi, I was trying http-cleint tutorials from svn.apache.org. While running the application I am getting the following error in console. [2010-04-30 09:26:36 - HalloAndroid] ActivityManager: java.lang.SecurityException: Permission Denial: starting Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] flg=0x10000000 cmp=com.org.example/.HalloAndroid } from null (pid=-1, uid=-1) requires android.permission.INTERNET I have added android.permission.INTERNET in AndroidManifest.xml. <?xml version="1.0" encoding="utf-8"?> <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.org.example" android:versionCode="1" android:versionName="1.0"> <application android:icon="@drawable/icon" android:label="@string/app_name"> <activity android:name=".HalloAndroid" android:label="@string/app_name" android:permission="android.permission.INTERNET"> <intent-filter> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" /> </intent-filter> </activity> </application> <uses-permission android:name="android.permission.INTERNET"></uses-permission> </manifest> The java code in HalloAndroid.java is as follows HttpClient httpclient = new DefaultHttpClient(); HttpGet httpget2 = new HttpGet("http://google.com/"); HttpResponse response2 = null; try { response2 = httpclient.execute(httpget2); } catch (ClientProtocolException e1) { // TODO Auto-generated catch block e1.printStackTrace(); } catch (IOException e1) { // TODO Auto-generated catch block e1.printStackTrace(); } HttpEntity entity = response2.getEntity(); if (entity != null) { long len = entity.getContentLength(); if (len != -1 && len < 2048) { try { Log.d(TAG, EntityUtils.toString(entity)); } catch (ParseException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } } else { // Stream content out } Any help is much appreciated.

    Read the article

  • How to manage a MotionEvent going from one View to another?

    - by Darren
    I have a SurfaceView that takes up part of the screen, and some buttons along the bottom. When a button is pressed and the user drags, I want to be able to drag a picture (based on the button) onto the SurfaceView and have it drawn there. I want to be able to use clickListeners and the like, and not just have a giant SurfaceView with me writing code to detect where the user pressed and if it's a button, etc. I have somewhat of a solution, but it seems a bit of a hack to me. What is the best way to accomplish this using the framework intelligently? Part of my XML: <RelativeLayout android:orientation="vertical" android:layout_width="fill_parent" android:layout_height="fill_parent" android:background="@drawable/background"> <!-- Place buttons along the bottom --> <RelativeLayout android:id="@+id/bottom_bar" android:orientation="horizontal" android:layout_width="fill_parent" android:layout_height="40dip" android:layout_alignParentBottom="true" android:background="@null"> <ImageButton android:id="@+id/btn_1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_centerVertical="true" android:background="@null" android:src="@drawable/btn_1"> </ImageButton> <!-- More buttons here... --> </RelativeLayout> <!-- Place the SurfaceView in a frame so we can stack on top of it --> <FrameLayout android:layout_width="fill_parent" android:layout_height="0px" android:layout_weight="1" android:layout_above="@id/bottom_bar"> <com.project.question.MySurfaceView android:id="@+id/my_view" android:layout_width="fill_parent" android:layout_height="fill_parent" /> </FrameLayout> And the relevant Java code in MySurfaceView, which extends SurfaceView. mTouchX and Y are used in the onDraw method to draw the image: @Override public boolean onTouchEvent(MotionEvent event){ mTouchX = (int) event.getX(); mTouchY = (int) event.getY(); return true; } public void onButtonTouchEvent(MotionEvent event){ event.setLocation(event.getX(), event.getY() + mScreenHeight); onTouchEvent(event); } Finally, the activity: @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); requestWindowFeature(Window.FEATURE_NO_TITLE); setContentView(R.layout.my_surface); mView = (MySurfaceView) findViewById(R.id.my_view); mSurfaceHeight = mView.getHeight(); mBtn = (ImageButton) findViewById(R.id.btn_1); mBtn.setOnTouchListener(mTouchListener); } OnTouchListener mTouchListener = new OnTouchListener() { public boolean onTouch(View v, MotionEvent event) { int [] location = new int[2]; v.getLocationOnScreen(location); event.setLocation(event.getX() + location[0], event.getY()); mView.onButtonTouchEvent(event); return true; } }; Strangely, one has to add to the x-coordinate in the activity, then add to the y coordinate in the View. Otherwise, it doesn't show up in the correct position. If you add nothing, something drawn using mTouchX and mTouchY will show up in the upper left corner of the SurfaceView. Any direction would be greatly appreciated. If I'm going about this completely the wrong way, that would be good information too.

    Read the article

  • Playing video from URL -Android

    - by Rajeev
    In the following code what ami doing wrong the video dosnt seem to play here.Is that the permission issue if so what should be included in the manifest file this main.xml <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="wrap_content" android:layout_height="wrap_content" android:orientation="horizontal" android:baselineAligned="true"> <LinearLayout android:layout_height="match_parent" android:layout_width="wrap_content" android:id="@+id/linearLayout2"></LinearLayout> <MediaController android:id="@+id/mediacnt" android:layout_width="wrap_content" android:layout_height="wrap_content"></MediaController> <LinearLayout android:layout_height="match_parent" android:layout_width="wrap_content" android:id="@+id/linearLayout1" android:orientation="vertical"></LinearLayout> <Gallery android:layout_height="wrap_content" android:id="@+id/gallery" android:layout_width="wrap_content" android:layout_weight="1"></Gallery> <VideoView android:layout_height="match_parent" android:id="@+id/vv" android:layout_width="wrap_content"></VideoView> </LinearLayout> this is java class package com.gallery; import java.net.URL; import android.app.Activity; import android.app.Activity; import android.net.Uri; import android.os.Bundle; import android.widget.MediaController; import android.widget.Toast; import android.widget.VideoView; public class GalleryActivity extends Activity { /** Called when the activity is first created. */ @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); Toast.makeText(GalleryActivity.this, "Hello world", Toast.LENGTH_LONG).show(); VideoView videoView = (VideoView) findViewById(R.id.vv); MediaController mediaController = new MediaController(this); mediaController.setAnchorView(videoView); // Set video link (mp4 format ) Uri video = Uri.parse("http://www.youtube.com/watch?v=lEbxLDuecHU&playnext=1&list=PL040F3034C69B1674"); videoView.setMediaController(mediaController); videoView.setVideoURI(video); videoView.start(); } }

    Read the article

< Previous Page | 6 7 8 9 10 11 12 13 14 15 16 17  | Next Page >