No view found for id for fragment PlaceholderFragment - java

I created a Main activity, which sends me to an ActiviteResultats activity.
My goal is now just to show a message in this activity (Message who come from the main).
I followed the Starting Another Activity tutorial.
The problem is, when I start the ActiviteResultats activity, I have an error:
"no view found for id 0x7f080000 ........... for fragment PlaceholderFragment"
... and the app shuts down.
I don't know yet how to use fragments, and the tutorial says I don't have to use it for this example.
Where am I going wrong?
My code :
package com.example.surveyor;
import android.app.Activity;
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.TextView;
public class ActiviteResultats extends Activity {
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_activite_resultats);
if (savedInstanceState == null) {
getFragmentManager().beginTransaction()
.add(R.id.container, new PlaceholderFragment()).commit();
}
String message = "TODO";
// Create the text view
TextView textView = new TextView(this);
textView.setTextSize(40);
textView.setText(message);
// Set the text view as the activity layout
setContentView(textView);
}
#Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.activite_resultats, 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_activite_resultats, container, false);
return rootView;
}
}
}

I had the same problem. Just remove the part:
if (savedInstanceState == null) {
getFragmentManager().beginTransaction()
.add(R.id.container, new PlaceholderFragment()).commit();
}
That solved it for me. Hope that helps!

A quick look over the tutorial shows that most of the Fragment code is removed in a later step. You could remove all the code related to the fragments, along with the bit about the options menu if you want to clear out all distractions. It's likely to solve your problem and isn't vital to that tutorial

What you need to do is to set up intent in your main activity, and then get it here so it goes like follows:
under Main_Activity.java
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.Main_Activity);
Intent i = new Intent(this,activiteResultats.class); // or getApplicationContext() <= for context
i.putExtras("TagOfMyMessage","MyMessageblablabla");
startActivity(i);
}
under ActivteResultats.java
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_activite_resultats);
Intent i = getIntent();
String message = i.getStringExtras(); // or something like it
// Create the text view
TextView textView = new TextView(this);
textView.setTextSize(40);
textView.setText(message);
// Set the text view as the activity layout
setContentView(textView);
}
You just don't need to use fragments if you want a clear and easy tutorial i advice you to check this one : http://www.vogella.com/tutorials/AndroidIntent/article.html

Related

Android Studio Coding [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 6 years ago.
Improve this question
My task is to convert an activity to a fragment.
I did some changes but it still doesn't work. I am missing something, but I can't figure it out. One problem I do see is that the public class QuoteFragment extends SingleFregmentActivity is underline...not sure what I forget to do. Help please!
When I wan converting the activity to a fragment what did I forget?
Code for the activity...
import android.os.Bundle;
import android.support.design.widget.FloatingActionButton;
import android.support.design.widget.Snackbar;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentActivity;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.Toolbar;
import android.view.LayoutInflater;
import android.view.View;
import android.view.Menu;
import android.view.MenuItem;
import android.view.ViewGroup;
import android.widget.Button;
import android.widget.ImageView;
import android.widget.TextView;
import android.content.Intent;
/**
* Main activity for the application.
* Displays a series of quotes
*/
public class QuoteFragment extends SingleFragmentActivity{
/** Key for fact about author stored in Intent sent to AuthorFactActivity. */
public static final String EXTRA_AUTHOR_FACT =
"edu.andrews.cptr252.stephanien.quoteoftheday.author_fact";
private static final String KEY_QUOTE_INDEX = "quoteIndex";
/**ImageView used to display inspirational image*/
private ImageView mImageView;
private TextView mQuoteTextView;
private TextView mAuthorTextView;
private Button mNextButton;
/**Quotes used in app */
private Quote[] mQuoteList = new Quote[]{
new Quote(R.string.quote_text_0, R.string.quote_author_0,
R.string.author_fact_0, R.drawable.mountain_pic),
new Quote(R.string.quote_text_1, R.string.quote_author_1,
R.string.author_fact_1, R.drawable.lier),
new Quote(R.string.quote_text_2, R.string.quote_author_2,
R.string.author_fact_2, R.drawable.math),
new Quote(R.string.quote_text_3, R.string.quote_author_3,
R.string.author_fact_3, R.drawable.smiley),
new Quote(R.string.quote_text_4, R.string.quote_author_4,
R.string.author_fact_4, R.drawable.th),
};
/** Index of current quote in list */
private int mCurrentIndex = 0;
/** Launch activity to display author fact */
private void displayAuthorFact(){
//Create intent with name of class for second activity.
//This intent will be sent to the Activity Manager in the OS
//Which will launch the activity.
Intent i = new Intent(QuoteFragment.this, AuthorFactActivity.class);
//Add extra containing resource id for fact
i.putExtra(EXTRA_AUTHOR_FACT, mQuoteList[mCurrentIndex].getAuthorFact());
//Send the intent to the activity manager.
startActivity(i);
}
/**
* Remember the current quote when the activity is destroyed
* #param savedInstanceState Bundle used for saving identity of current quote
*/
#Override
public void onSaveInstanceState(Bundle savedInstanceState) {
super.onSaveInstanceState(savedInstanceState);
//Stored the index of the current quote in the bundle.
//Use our key to access the value later.
savedInstanceState.putInt(KEY_QUOTE_INDEX, mCurrentIndex);
}
/**
* Setup and inflate layout.
* #param savedInstanceState Previously saved Bundle
*/
#Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
View v = inflater.inflate(R.layout.activity_fragment, container, false);
//mQuoteTextView.setText("This should generate an error. Do you see why?");
//Re-display the same quote we were on when activity destroyed
if(savedInstanceState != null){
mCurrentIndex = savedInstanceState.getInt(KEY_QUOTE_INDEX);
}
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
//setSupportActionBar(toolbar);
FloatingActionButton fab = (FloatingActionButton) findViewById(R.id.fab);
fab.setOnClickListener(new View.OnClickListener() {
#Override
public void onClick(View view) {
Snackbar.make(view, "Replace with your own action", Snackbar.LENGTH_LONG)
.setAction("Action", null).show();
}
});
//Display that text for the quote
mQuoteTextView = (TextView) findViewById(R.id.quoteTextView);
int quote = mQuoteList[mCurrentIndex].getQuote();
mQuoteTextView.setText(quote);
mQuoteTextView.setOnClickListener(new View.OnClickListener(){
#Override
public void onClick(View v) {
displayAuthorFact();
}
});
//Display the author of the quote
mAuthorTextView = (TextView) findViewById(R.id.authorTextView);
int author = mQuoteList[mCurrentIndex].getAuthor();
mAuthorTextView.setText(author);
mAuthorTextView.setOnClickListener(new View.OnClickListener() {
#Override
public void onClick(View v) {
displayAuthorFact();
}
});
//Display image
mImageView = (ImageView) findViewById(R.id.imageView);
mImageView.setImageResource(R.drawable.mountain_pic);
//set up listener to handle next button presses
mNextButton = (Button) findViewById(R.id.nextButton);
mNextButton.setOnClickListener(new View.OnClickListener(){
#Override
public void onClick(View v) {
// move to the next quote in the list
//if index reaches end array,
//reset index to zero (first quote)
mCurrentIndex++;
if(mCurrentIndex == mQuoteList.length){
mCurrentIndex = 0;
}
updateQuote();
}
});
return v;
}
/** Display the quote at the current index. */
private void updateQuote(){
int quote = mQuoteList[mCurrentIndex].getQuote();
int author = mQuoteList[mCurrentIndex].getAuthor();
int picture = mQuoteList[mCurrentIndex].getPicture();
mQuoteTextView.setText(quote);
mAuthorTextView.setText(author);
mImageView.setImageResource(picture);
}
#Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.menu_quote, 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();
//noinspection SimplifiableIfStatement
if (id == R.id.action_settings) {
return true;
}
return super.onOptionsItemSelected(item);
}
}
Create QuoteFragment
Copy-paste code from QuoteActivity
Remove setContent(R.layout.activity_quote) and implement onCreateView (LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) method
Initialize views in onViewCreated (View view, Bundle savedInstanceState) method
Rename activity_quote.xml to fragment_quote.xml
Create xml file activity_quote.xml and add the QuoteFragment as a content:
<fragment android:name="com.example.android.fragments.QuoteFragment"
android:layout_width="match_parent"
android:layout_height="match_parent" />
See details here: http://developer.android.com/training/basics/fragments/creating.html#AddInLayout
And remove all code from QuoteActivity except of:
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_quote);
}

Declaration of MapView (ArcGIS for Android) Center and Zoom

I am begginer in java and ArcGIS for android. I want to make simple app with MapView.
I have problem with declaration of MapView center and Zoom. I need to do it programmatically (application startup) in java file, not in xml file. I will try explain it on on simple example.
Problem is in mMapView.setMapOptions(options); I need to do in onCreate(), if I make Button with mMapView.setMapOptions(options); everything is OK. I searched solution in samples and on the internet, but I think, that I do not know how to ask on it.
Sorry for my english and thank you for your comments.
import android.app.Activity;
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.widget.Button;
import com.esri.android.map.MapOptions;
import com.esri.android.map.MapView;
public class MainActivity extends Activity {
MapView mMapView = null;
Button b1;
MapOptions options = new MapOptions(MapOptions.MapType.TOPO, 49.591241, 17.255503, 16);
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
mMapView = (MapView) findViewById(R.id.map);
//mMapView.centerAndZoom(49.591241, 17.255503, 8);
btnClick();
mMapView.setMapOptions(options);
mMapView.setAllowRotationByPinch(true);
mMapView.setRotationAngle(25);
mMapView.enableWrapAround(true);
}
public void btnClick() {
b1 = (Button) findViewById(R.id.button);
b1.setOnClickListener(new View.OnClickListener() {
#Override
public void onClick(View arg0) {
//mMapView.centerAndZoom(49.591241, 17.255503, 10);
mMapView.setMapOptions(options);
}
});
}
#Override
protected void onPause() {
super.onPause();
// Call MapView.pause to suspend map rendering while the activity is paused, which can save battery usage.
mMapView.pause();
}
#Override
protected void onResume() {
super.onResume();
// Call MapView.unpause to resume map rendering when the activity returns to the foreground.
mMapView.unpause();
}
#Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.menu_main, 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();
//noinspection SimplifiableIfStatement
if (id == R.id.action_settings) {
return true;
}
return super.onOptionsItemSelected(item);
}
}
You could remove the MapView declaration from your XML and create it inside the activity. Then just add the MapView to your layout.
XML (details omitted)
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout android:id="#+id/mapLayout"></LinearLayout>
MainActivity.java
#Override
protected void onCreate(Bundle savedInstanceState) {
MapView mapView = MapView(MainActivity.this, mapOpts);
// other logic/initializations
ViewGroup mapLayout = findViewById(R.id.mapLayout);
mapLayout.addView(mapView); // might have to specify index param if you need buttons
This is my solution by previous answer. Thanks zec!
import android.app.Activity;
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuItem;
import com.esri.android.map.MapOptions;
import com.esri.android.map.MapView;
public class MainActivity extends Activity {
MapView mMapView;
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
MapOptions options = new MapOptions(MapOptions.MapType.TOPO, 49.591241, 17.255503, 16);
mMapView = new MapView(MainActivity.this, options);
setContentView(mMapView);
}
#Override
protected void onPause() {
super.onPause();
// Call MapView.pause to suspend map rendering while the activity is paused, which can save battery usage.
mMapView.pause();
}
#Override
protected void onResume() {
super.onResume();
// Call MapView.unpause to resume map rendering when the activity returns to the foreground.
mMapView.unpause();
}
}

DisplayMessageActivity.java file tutorial issue

i'm starting to learn how to make android application by following the tutorial on their developer page. I'm trying to make a new DisplayMessageActivity class.
this is the tutorial https://developer.android.com/training/basics/firstapp/starting-activity.html#CreateActivity
My DisplayMessageActivity.java file contains by default this:
package com.example.myfirstapp;
import android.support.v7.app.ActionBarActivity;
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuItem;
public class DisplayMessageActivity extends ActionBarActivity {
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_display_message);
}
#Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.display_message, 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);
}
}
while on their website it sais it should contain this :
public class DisplayMessageActivity extends ActionBarActivity {
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_display_message);
if (savedInstanceState == null) {
getSupportFragmentManager().beginTransaction()
.add(R.id.container, new PlaceholderFragment()).commit();
}
}
#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_display_message,
container, false);
return rootView;
}
}
}
I have updated my eclipse to the latest version of ADT plugin and i still get this. When I try to paste their code to my DisplayMessageActivity.java file i get these errors:
activity_display_message cannot be resolved or is not a field
The method add(int, Fragment) in the type FragmentTransaction is not
applicable for the arguments (int,
DisplayMessageActivity.PlaceholderFragment)
fragment_display_message cannot be resolved or is not a field
Both of your references in the code should be to R.layout.activity_display_message, although I do not get any errors there (make sure you followed all the steps in the tutorial). But I am following the same tutorial and am getting the same error with the add method and cannot figure out why.

Errors in created activity help (android)

I keep getting errors in code below, specifically the two pieces surrounded by asterisks (R.id.action_settings and fragment_display_message,)
package com.example.completelypointlessapp;
import android.app.Fragment;
import android.content.Intent;
import android.os.Bundle;
import android.support.v7.app.ActionBarActivity;
import android.view.LayoutInflater;
import android.view.MenuItem;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;
public class DisplayMessageActivity extends ActionBarActivity {
#Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
// Get the message from the intent
Intent intent = getIntent();
String message = intent.getStringExtra(MainActivity.EXTRA_MESSAGE);
// Create the text view
TextView textView = new TextView(this);
textView.setTextSize(40);
textView.setText(message);
// Set the text view as the activity layout
setContentView(textView);
}
#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_display_message,**
container, false);
return rootView;
}
}
}
The errors state:"fragment_display_message cannot be resolved or is not a field" and "action_settings cannot be resolved or is not a field"
Can anyone help resolve this?
(Apology for certain incorrect formatting, I am new to this site)
View rootView = inflater.inflate(R.layout.fragment_display_message,
container, false);
Do you have fragment_display_message.xml layout file ?
if (id == R.id.action_settings)
Do you have the custom menu file for ActionBar ?
Example -
<menu xmlns:android="http://schemas.android.com/apk/res/android" >
<item
android:id="#+id/action_settings"
android:title="Settings"
android:showAsAction="never"
>
</item>
</menu>
If answer to both is NO, then error is obvious.

Cannot get google tutorial to work [closed]

Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 8 years ago.
Improve this question
I just starting learning to develop an android app and for that i followed google's basic tutorial.
In the tutorial there is simply a textbox and a button. On pressing the button it takes the text from the textbox and displays it in another activity. But somehow the button isn't working for me.
Here is the code for the fragment_main.xml, MainActivity.java and DisplayMessageActivity.java. I just want to know if i am doing something wrong or if i am missing something.
fragmant_main.xml:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout 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:orientation="horizontal">
<EditText android:id="#+id/edit_message"
android:layout_weight="1"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:hint="#string/edit_message" />
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="#string/button_send"
onClick="sendMessage" />
</LinearLayout>
MainActivity.java:
package com.example.first;
import android.content.Intent;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.support.v7.app.ActionBarActivity;
import android.view.LayoutInflater;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.view.ViewGroup;
import android.widget.EditText;
public class MainActivity extends ActionBarActivity {
public final static String EXTRA_MESSAGE = "com.example.myfirstapp.MESSAGE";
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
if (savedInstanceState == null) {
getSupportFragmentManager().beginTransaction()
.add(R.id.container, new PlaceholderFragment()).commit();
}
}
#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;
}
#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_main, container,
false);
return rootView;
}
}
/** Called when the user clicks the Send button */
public void sendMessage(View view) {
Intent intent = new Intent(this, DisplayMessageActivity.class);
EditText editText = (EditText) findViewById(R.id.edit_message);
String message = editText.getText().toString();
intent.putExtra(EXTRA_MESSAGE, message);
startActivity(intent);
}
}
DisplayMessageActivity.java
package com.example.first;
import android.content.Intent;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.support.v7.app.ActionBarActivity;
import android.view.LayoutInflater;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;
public class DisplayMessageActivity extends ActionBarActivity {
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
// Get the message from the intent
Intent intent = getIntent();
String message = intent.getStringExtra(MainActivity.EXTRA_MESSAGE);
// Create the text view
TextView textView = new TextView(this);
textView.setTextSize(40);
textView.setText(message);
// Set the text view as the activity layout
setContentView(textView);
}
#Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.display_message, 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_display_message,
container, false);
return rootView;
}
}
}
EDIT **
In your fragment_main.xml file the the last line of your Button tag should be : android:onClick="sendMessage" instead of onClick="sendMessage"

Categories