When I open the app it says "Unfortunately program has stopped". So i can't use the application. How can i repair this?
This is my code:
I put the incorrect code, this is the real code, same error
package com.RaulLara.projects;
import android.support.v7.app.ActionBarActivity;
import android.support.v7.app.ActionBar;
import android.support.v4.app.Fragment;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.view.ViewGroup;
import android.os.Build;
import android.app.Activity;
import android.widget.TextView;
import android.view.View.OnClickListener;
import android.widget.Button;
public class MainActivity extends ActionBarActivity {
Button btn = (Button) findViewById(R.id.btn1);
#Override
protected void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
setContentView(R.layout.fragment_main);
setupmybutton();
if (savedInstanceState == null) {
getSupportFragmentManager().beginTransaction()
.add(R.id.container, new PlaceholderFragment())
.commit();
}
}
private void setupmybutton() {
btn.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
}
});
}
#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;
}
/**
* A placeholder fragment containing a simple view.
*/
public static class PlaceholderFragment extends Fragment {
public PlaceholderFragment() {
}
#Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
View rootView = inflater.inflate(R.layout.fragment_main, container, false);
return rootView;
}
}
}
This is my
fragment_main:
<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="com.RaulLara.projects.MainActivity$PlaceholderFragment" >
<TextView
android:id="#+id/textView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:layout_centerHorizontal="true"
android:layout_marginTop="79dp"
android:text="Large Text"
android:textAppearance="?android:attr/textAppearanceLarge" />
<Button
android:id="#+id/btn1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#+id/textView1"
android:layout_centerHorizontal="true"
android:layout_marginTop="56dp"
android:text="#string/button" />
</RelativeLayout>
And this is my
AndroidManifest:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.RaulLara.projects"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="8"
android:targetSdkVersion="19" />
<application
android:allowBackup="true"
android:icon="#drawable/ic_launcher"
android:label="#string/app_name"
android:theme="#style/AppTheme" >
<activity
android:name="com.RaulLara.projects.MainActivity"
android:label="#string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
</manifest>
You are using wrong id for the button. This is causing a NULL mybutton1 to be returned and hence a null pointer exception.
Change
Button mybutton1 = (Button) findViewById(R.id.button1);
to
Button mybutton1 = (Button) findViewById(R.id.btn1);
Good Luck
Since you are setting up your button in OnCreate of the MainActivity make sure your declare your btn1 in activity_main and not in the fragment's layout fragment_main
Related
I have problem with my application for android (TelephonyManager Service). When I run app with code without getters it works, but if I use get() function app send me a message "The Application has stopped unexpectedly. Please try again". I really don't know what's wrong.
My "bad" code:
package com.example.tc;
import android.support.v7.app.ActionBarActivity;
import android.support.v7.app.ActionBar;
import android.support.v4.app.Fragment;
import android.telephony.TelephonyManager;
import android.content.Context;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;
import android.os.Build;
public class TC1 extends ActionBarActivity {
TextView textView1;
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_tc1);
if (savedInstanceState == null) {
getSupportFragmentManager().beginTransaction()
.add(R.id.container, new PlaceholderFragment()).commit();
}
textView1=(TextView)findViewById(R.id.textView1);
//Get the instance of TelephonyManager
TelephonyManager tm=(TelephonyManager)getSystemService(Context.TELEPHONY_SERVICE);
//Calling the methods of TelephonyManager the returns the information
//If I remove this code app works
String IMEINumber=tm.getDeviceId();
}
#Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.tc1, menu);
return true;
}
#Override
public boolean onOptionsItemSelected(MenuItem item) {
// Handle action bar item clicks here. The action bar will
// automatically handle clicks on the Home/Up button, so long
// as you specify a parent activity in AndroidManifest.xml.
int id = item.getItemId();
if (id == R.id.action_settings) {
return true;
}
return super.onOptionsItemSelected(item);
}
/**
* A placeholder fragment containing a simple view.
*/
public static class PlaceholderFragment extends Fragment {
public PlaceholderFragment() {
}
#Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
View rootView = inflater.inflate(R.layout.fragment_tc1, container,
false);
return rootView;
}
}
}
Layout.activity_tc1.xml:
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="#+id/container"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context="com.example.tc.TC1"
tools:ignore="MergeRootFrame" />
Layout.fragment_tc1.xml:
<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="com.example.tc.TC1$PlaceholderFragment" >
<TextView
android:id="#+id/textView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Phone Details:" />
<EditText
android:id="#+id/editText1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#+id/textView1"
android:layout_centerHorizontal="true"
android:layout_marginTop="68dp"
android:ems="10"
android:text="aaaa" >
<requestFocus />
</EditText>
</RelativeLayout>
AndroidManifest.xml:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.tc"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="8"
android:targetSdkVersion="19" />
<application
android:allowBackup="true"
android:icon="#drawable/ic_launcher"
android:label="#string/app_name"
android:theme="#style/AppTheme" >
<activity
android:name="com.example.tc.TC1"
android:label="#string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
</manifest>
The official documentation for getDeviceID says
Returns the unique device ID, for example, the IMEI for GSM and the MEID or ESN for CDMA phones. Return null if device ID is not available.
**Requires Permission: READ_PHONE_STATE**
You have not given that READ_PHONE_STATE permission in your manifest file.
ADD PERMISSION IN MANIFEST FILE
TelephonyManager tm = (TelephonyManager) getSystemService(Context.TELEPHONY_SERVICE);
// get IMEI
String imei = tm.getDeviceId();
//get The Phone Number
String phone = tm.getLine1Number();
Manifest
<uses-permission android:name="android.permission.READ_PHONE_STATE" />
Hi I have a basic app for logging in with hardcoded credentials, and I want it to take you to another activity called Welcome. Here is my main activity:
package com.example.numericlogin;
import android.support.v7.app.ActionBarActivity;
import android.support.v7.app.ActionBar;
import android.support.v4.app.Fragment;
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;
import android.widget.EditText;
import android.widget.Toast;
import android.os.Build;
public class MainActivity extends Activity{
private EditText login_key=null;
private Button login=null;
#Override
protected void onCreate(Bundle savedInstanceState){
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
login_key = (EditText)findViewById(R.id.editText1);
login = (Button)findViewById(R.id.login);
}
public void login(View view){
if(login_key.getText().toString().equals("123456")){
Toast.makeText(getApplicationContext(), "Login Successful!",
Toast.LENGTH_LONG).show();
startActivity(new Intent(MainActivity.this,Welcome.class));
}
else{
Toast.makeText(getApplicationContext(), "Wrong Credentials",
Toast.LENGTH_SHORT).show();
{
login.setEnabled(false);
}
}
}
#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;
}
}
Here is the main activity's xml:
<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="com.example.numericlogin.MainActivity$PlaceholderFragment" >
<TextView
android:id="#+id/textView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="#string/login_key" />
<EditText
android:id="#+id/editText1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_alignTop="#+id/textView1"
android:ems="10"
android:digits="0123456789"
android:inputType="number|textPassword"
android:maxLength="6"
android:password="true"
/>
<Button
android:id="#+id/login"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#+id/editText1"
android:layout_centerHorizontal="true"
android:layout_marginTop="70dp"
android:text="#string/login" />
</RelativeLayout>
Here is the second activity I want it to switch to when logged in correctly:
package com.example.numericlogin;
import android.view.View;
import android.widget.ImageView;
public class Welcome {
public void welcome(View v){
ImageView picture = (ImageView)
setContenView(R.layout.fragment_main);
}
private ImageView setContenView(int fragmentMain) {
// TODO Auto-generated method stub
return null;
}
}
Here is the xml for the above activity:
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent" >
<ImageView
android:id="#+id/imageView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:layout_centerHorizontal="true"
android:layout_marginTop="74dp"
android:src="#drawable/welcome" />
</RelativeLayout>
And here is the manifest:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.numericlogin"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="10"
android:targetSdkVersion="17" />
<application
android:allowBackup="true"
android:icon="#drawable/ic_launcher"
android:label="#string/app_name"
android:theme="#style/AppTheme" >
<activity
android:name="com.example.numericlogin.MainActivity"
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=".Welcome"/>
</application>
</manifest>
At the moment when I launch it it brings up the first activity and allows you to enter input in the login area, but when you click the login button nothing happens. There are no errors in the code and here is the logcat output:
07-01 14:11:15.313: W/IInputConnectionWrapper(23128): showStatusIcon on inactive InputConnection
This is how you switch between activities:
In MainActivity.java:
Intent go = new Intent(this, Welcome.class);
startActivity(go);
Your second activity class must extend Activity
public class Welcome extends Activity {
#Override
protected void onCreate(Bundle savedInstanceState) {
// TODO Auto-generated method stub
super.onCreate(savedInstanceState);
setContentView(R.layout.childact);
}
}
And you must register all activities in manifest file.
You are missing this:
<activity
android:name="com.example.testingproj.Welcome"
android:label="#string/app_name">
</activity>
I think you forgot set onClickListener for the login button or set attribute onClick with value 'login' in the properties panel in graphical layout preview.
final Button login= (Button) findViewById(R.id.login);
button.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
// Perform code validation
}
});
This question already has answers here:
NullPointerException accessing views in onCreate()
(13 answers)
Closed 8 years ago.
I know there are a couple of questions similar to this but I've tried different things suggested such as cleaning and rebuilding and still nothing is working for me. I'm new to android and working on Eclipse. I'm trying to make a simple test app where a user clicks an image button (a ball) and there is a textview which changes text when the button is clicked.
As I'm new to android, I've noticed there is a fragment main.xml and a main.xml so I'm wondering if there is meant to be 2.
Does anyone know why this isn't running on emulator or device? Thanks for any help.
main -
<item
android:id="#+id/action_settings"
android:orderInCategory="100"
android:showAsAction="never"
android:title="#string/action_settings"/>
</menu>
fragment main -
<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="com.example.imagebutton.MainActivity$PlaceholderFragment" >
<ImageButton
android:id="#+id/ball"
android:layout_width="100dip"
android:layout_height="100dip"
android:scaleType="fitXY"
android:src="#drawable/ball"
/>
<TextView
android:id="#+id/tv"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBottom="#+id/ball"
android:layout_marginBottom="36dp"
android:layout_marginLeft="48dp"
android:layout_toRightOf="#+id/ball"
android:text="#string/click" />
</RelativeLayout>
Main Activity -
package com.example.imagebutton;
import android.app.Activity;
import android.app.ActionBar;
import android.app.Fragment;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;
import android.widget.ImageButton;
import android.widget.TextView;
import android.os.Build;
public class MainActivity extends Activity {
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
ImageButton ballButton = (ImageButton) findViewById(R.id.ball);
ballButton.setOnClickListener(new View.OnClickListener(){
#Override
public void onClick (View v){
TextView text = (TextView) findViewById(R.id.tv);
text.setText("It has been clicked!");
}
});
}
}
Manifest -
<uses-sdk
android:minSdkVersion="14"
android:targetSdkVersion="19" />
<application
android:allowBackup="true"
android:icon="#drawable/ic_launcher"
android:label="#string/app_name"
android:theme="#style/AppTheme" >
<activity
android:name="com.example.imagebutton.MainActivity"
android:label="#string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
</manifest>
This is because findViewById() searches in the activity_main layout, while the button is located in the fragment's layout fragment_main.
Move that piece of code in the onCreateView() method of the fragment:
//...
View rootView = inflater.inflate(R.layout.fragment_main, container, false);
ImageButton ballButton = (ImageButton) findViewById(R.id.ball);
ballButton.setOnClickListener(new View.OnClickListener(){
#Override
public void onClick (View v){
TextView text = (TextView) findViewById(R.id.tv);
text.setText("It has been clicked!");
}
});
//...
Notice that now you access it through rootView view:
ImageButton ballButton = (ImageButton)rootView.findViewById(R.id.ball);
otherwise you would get again NullPointerException.
I'm working on a project and I managed to get to the point where I can show my images in a gallery sort of style using PagerAdapter. Now what I want to do is add an indicator to which image is on the screen and I figure that VPI could help me out - the problem is that I'm really new to code and don't know how to implement it, could someone help?
Here's a gif of what I want to achieve - the green line indicator: http://imgur.com/GgYgY8I
I made a simpler version of my project to fit in this post, here it is:
ImageAdapter.java
package com.exp.viewpagersstest1;
import android.content.Context;
import android.support.v4.view.PagerAdapter;
import android.support.v4.view.ViewPager;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
public class ImageAdapter extends PagerAdapter {
Context ssContext;
private int[] ssImages = new int[] { R.drawable.splash1,R.drawable.splash2, R.drawable.splash3 };
ImageAdapter(Context ssContext) {
this.ssContext = ssContext;
}
#Override
public int getCount() {
return ssImages.length;
}
#Override
public boolean isViewFromObject(View ssView, Object ssObject) {
return ssView == ((ImageView) ssObject);
}
#Override
public Object instantiateItem(ViewGroup ssContainer, int ssPosition) {
ImageView ssImageView = new ImageView(ssContext);
ssImageView.setScaleType(ImageView.ScaleType.FIT_XY);
ssImageView.setImageResource(ssImages[ssPosition]);
((ViewPager) ssContainer).addView(ssImageView, 0);
return ssImageView;
}
#Override
public void destroyItem(ViewGroup ssContainer, int ssPosition,
Object ssObject) {
((ViewPager) ssContainer).removeView((ImageView) ssObject);
}
}
SSTest.java
package com.exp.viewpagersstest1;
import android.app.Activity;
import android.os.Bundle;
import android.support.v4.view.ViewPager;
import android.view.Menu;
public class SSTest extends Activity {
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_sstest);
ViewPager ssViewPager = (ViewPager) findViewById(R.id.ss_view_pager);
ImageAdapter ssAdapter = new ImageAdapter(this);
ssViewPager.setAdapter(ssAdapter);
}
#Override
public boolean onCreateOptionsMenu(Menu menu){
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.sstest, menu);
return true;
}
activity_sstest.xml
<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"
tools:context=".SSTest" >
<android.support.v4.view.ViewPager
android:id="#+id/ss_view_pager"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_centerHorizontal="true"
android:layout_centerVertical="true"
android:adjustViewBounds="true" />
</RelativeLayout>
ViewPagerSSTest1 Manifest:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.exp.viewpagersstest1"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="8"
android:targetSdkVersion="17" />
<application
android:allowBackup="true"
android:icon="#drawable/ic_launcher"
android:label="#string/app_name"
android:theme="#style/AppTheme" >
<activity
android:name="com.exp.viewpagersstest1.SSTest"
android:label="#string/app_name"
android:theme="#style/Theme.Sherlock.NoActionBar"
>
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
</manifest>
Thanks in advance to anyone who replies.
Was much more simple than I expected, just needed to add the following to my xml:
<com.viewpagerindicator.UnderlinePageIndicator
android:id="#+id/pageIndic"
android:layout_height="3dp"
android:layout_width="fill_parent"
android:layout_alignParentBottom="true"
app:selectedColor="#ef4154"/>
And the following to the oncreate under the java file:
UnderlinePageIndicator pageIndicator = (UnderlinePageIndicator) findViewById(R.id.pageIndic);
pageIndicator.setViewPager(ssViewPager);
I'm just trying to come up with a skeleton for an activity that uses a ListView as a news feed for a game my class is making.
In this activity there's simply the news feed, and a Refresh button (to update the ListView with the latest news)
My activity_news.xml:
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_gravity="center">
<ListView
android:id="#+id/news"
android:layout_width="match_parent"
android:layout_height="320dp"
>
</ListView>
<Button
android:layout_width="fill_parent"
android:layout_height="45dp"
android:text="Refresh"
android:id="#+id/bRef"
/>
My NewsActivty.java:
package com.example.mynews;
import com.example.mynews.R;
import android.os.Bundle;
import android.app.Activity;
import android.content.Intent;
import android.view.Menu;
import android.view.View;
import android.widget.ArrayAdapter;
import android.widget.Button;
import android.widget.ListView;
public class NewsActivity extends Activity {
Button refresh;
String newsfeed [] = {"latest news", "older news"};
Intent ref = new Intent(this, NewsActivity.class);
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_news);
refresh = (Button) findViewById(R.id.bRef);
ListView newsStuff = (ListView) findViewById(R.id.news);
ArrayAdapter<String> adapter = new ArrayAdapter<String>(this, android.R.layout.simple_list_item_1, newsfeed);
newsStuff.setAdapter(adapter);
refresh.setOnClickListener(new View.OnClickListener() {
#Override
public void onClick(View v) {
// TODO Auto-generated method stub
startActivity(ref);
}
});
}
#Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.news, menu);
return true;
}
}
And my manifest:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.mynews"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="8"
android:targetSdkVersion="17" />
<application
android:allowBackup="true"
android:icon="#drawable/ic_launcher"
android:label="#string/app_name"
android:theme="#style/AppTheme" >
<activity
android:name="com.example.mynews.NewsActivity"
android:label="#string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
I built everything up piece by piece and ran it as I finished something new (the layout, the array adapter, etc) and the activity started to break once I added the OnClickListener (emulator tells me "mynews has unfortunately stopped") for my Refresh button. I'm sure there's a better way to accomplish what i'm trying to do, but any assistance with what I have so far would be greatly appreciated.
Did u define a class ref.java?
if yes then you need define that activity(ref) in the manifest file.