I want to customize my title in my DialogFragment, I know how to How to set the title to my DialogFragment , but I want more not just a title , I need a customized title(color,fontSize ...), So I defined a TextView and customized it
public View onCreateView(LayoutInflater inflater, #Nullable ViewGroup container, #Nullable Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.height_fragment,container,false);
TextView title = new TextView(getContext());
title.setText("Your Height Information");
title.setGravity(Gravity.CENTER);
title.setTextSize(30);
title.setBackgroundColor(Color.GRAY);
title.setTextColor(Color.WHITE);
getDialog().setCustomTitle(title); //Error Can not resolve method setCustomTitle(android.widget.TextView)
return view;
}
but there is an error on this line
getDialog().setCustomTitle(title);
getDialog().setCustomTitle(title);
I searched a lot before posting this question but I couldn't find how can I customize my title of DialogFragment.
Thank you for taking time to help me
"getDialog" does not have a method "setCustomTitle".This method can only be used for AlertDialog.Builder. Try it like this:
getDialog().setTitle("Your Height Information");
TextView textView=(TextView) getDialog().findViewById(android.R.id.title);
textView.setTextSize(30);
I never could easily customize the Title of my DialogFragment. So, instead, I use to remove the title and add a TextView to Dialog layout (and use it like a Title). This way, you can customize how you want and easily.
Dialog Code:
#Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
// Remove TITLE
getDialog().getWindow().requestFeature(Window.FEATURE_NO_TITLE);
View dialogView = dialogView = inflater.inflate(R.layout.height_fragment, null);
// Do your stuff
return dialogView;
}
height_fragment.xml
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent" >
<TextView
android:id="#+id/dialog_title"
android:layout_width="match_parent"
android:layout_height="56dp"
<!-- THIS VIEW IS YOUR TITLE... CUSTOMIZE LYKE YOU WANT -->
android:textColor="#color/white"
android:textSize="18sp"
android:textStyle="bold"
android:layout_gravity="top"
android:text="#string/TITLE"
android:gravity="center_vertical"
android:paddingLeft="16dp" />
<!-- Real Content goes below the title -->
</FrameLayout>
You need to connect your xml to your class. findViewById tells your class which TextView to use. Notice how it must match the android:id in the xml:
public class DialogFragmentTest extends DialogFragment {
public final static String TITLE = "title";
public final static String MESSAGE = "message";
#Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
// Get the layout inflater
LayoutInflater inflater = getActivity().getLayoutInflater();
View view = inflater.inflate(R.layout.dialog, null);
// Inflate and set the layout for the dialog
// Pass null as the parent view because its going in the dialog layout
builder.setView(view);
Bundle args = getArguments();
String title = args.getString(TITLE, "default title");
String msg = args.getString(MESSAGE, "default message");
TextView tvTitle = (TextView)view.findViewById(R.id.dialog_title);
tvTitle.setText(title);
TextView tvMessage = (TextView)view.findViewById(R.id.dialog_message);
tvMessage.setText(msg);
Button btnDone = (Button)view.findViewById(R.id.dialog_button);
btnDone.setOnClickListener(new View.OnClickListener() {
#Override
public void onClick(View v) {
dismiss();
}
});
return builder.create();
}
}
dialog.xml:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="300dp"
android:layout_height="wrap_content">
<TextView
android:id="#+id/dialog_title"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center_horizontal"
android:text="title"/>
<TextView
android:id="#+id/dialog_message"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="#id/dialog_title"
android:layout_marginTop="10dp"
android:text="message"/>
<Button
android:id="#+id/dialog_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#id/dialog_message"
android:layout_marginTop="20dp"
android:layout_centerHorizontal="true"
android:text="done"/>
</RelativeLayout>
This is then called from your activity with:
DialogFragmentTest bd = new DialogFragmentTest();
Bundle b = new Bundle();
b.putString(DialogFragmentTest.TITLE, "my title");
b.putString(DialogFragmentTest.MESSAGE, "my message");
bd.setArguments(b);
bd.show(getFragmentManager(), "my title");
Please, use custom dialog, based on DialogFragment:
public class MyCustomDialog extends DialogFragment{
private Context context;
#Override
public void onAttach(Context context) {
super.onAttach(context);
this.context = context;
}
#Nullable
#Override
public View onCreateView(LayoutInflater inflater, #Nullable ViewGroup container, Bundle savedInstanceState) {
View dialogView = inflater.inflate(R.layout.custom_dialog, null, false);
TextView tvTitle = (TextView) getDialog().findViewById(android.R.id.title);
tvTitle.setTextSize(25);
tvTitle.setTextColor(Color.GREEN);
return dialogView;
}
#Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
Dialog dialog = new Dialog(this.context, R.style.CustomDialog);
dialog.setTitle("custom dialog title");
dialog.getWindow().setLayout(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT);
return dialog;
}
public static MyCustomDialog newInstance() {
MyCustomDialog myCustomDialog = new MyCustomDialog();
return myCustomDialog;
}
}
Related
I created a progress dialog into a fragment by using this effect. Now i must call it in different activities. When I call the effect the buttons at the background must not work. How can I do that?
First i need to learn how to call the fragment in a different activity. Then i must make the buttons at the background unclickable but there are many of them so ‘setclickabla(false)’ would be a tiring choice.
Progress Dialog Fragment XML:
<FrameLayout 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"
xmlns:app="http://schemas.android.com/apk/res-auto"
tools:context=".ProgressDialogFragment">
<com.skyfishjy.library.RippleBackground
android:id="#+id/ProgressDialogs"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#CB000000"
app:rb_color="#80FFFFFF"
app:rb_duration="2500"
app:rb_radius="32dp"
app:rb_rippleAmount="4"
app:rb_scale="6">
<ImageView
android:id="#+id/centerImage"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:src="#drawable/logo" />
</com.skyfishjy.library.RippleBackground>
ProgressDialogFragment.java
#Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
final View view = inflater.inflate(R.layout.fragment_progress_dialog, container, false);
RippleBackground rippleBackground = (RippleBackground)view.findViewById(R.id.ProgressDialogs);
rippleBackground.startRippleAnimation();
return view;
}
For the buttons at the background to respond to clicks, you have to implement the onClick listener of the various buttons.
<com.skyfishjy.library.RippleBackground
android:id="#+id/ProgressDialogs"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#CB000000"
app:rb_color="#80FFFFFF"
app:rb_duration="2500"
app:rb_radius="32dp"
app:rb_rippleAmount="4"
app:rb_scale="6">
<Button
android:id="#+id/centerButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:src="#drawable/logo" />
In your layout above, you are making use of ImageView which I changed to centerButton and you can make it respond to clicks this way:
#Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
final View view = inflater.inflate(R.layout.fragment_progress_dialog, container, false);
RippleBackground rippleBackground = (RippleBackground)view.findViewById(R.id.ProgressDialogs);
rippleBackground.startRippleAnimation();
Button button=(Button)view.findViewById(R.id.centerButton);
button.setOnClickListener(new View.OnClickListener() {
#Override
public void onClick(View view) {
// your respond to clicks
}
});
return view;
}
Call your fragment from your activity:
public class MainActivity extends AppCompatActivity {
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
Fragment fragment = new MainFragment(); // your fragment
getSupportFragmentManager().beginTransaction()
.replace(R.id.fragment_frame, fragment, fragment.getClass().getSimpleName()).addToBackStack(null).commit();
}
}
I cannot figure out what to do to fix this Null Pointer Exception I am getting. mButton.setText("Hi"); is what triggers it. I have tried looking at other questions but I have not been able to get it to work. Here is my code:
ContactsTab.java
public class ContactsTab extends ListFragment implements LoaderCallbacks<Cursor> {
private CustomAdapter mAdapter;
private Cursor mCursor;
private String currentQuery;
private Button mButton;
private static final String[] PROJECTION = {
Contacts._ID,
Contacts.DISPLAY_NAME_PRIMARY,
Contacts.LOOKUP_KEY,
Contacts.PHOTO_THUMBNAIL_URI,
Contacts.HAS_PHONE_NUMBER,
};
private static final String[] FROM = { Contacts.DISPLAY_NAME_PRIMARY };
private static final int[] TO = { R.id.contact_text };
private static final String SELECTION = "(" + Contacts.IN_VISIBLE_GROUP + " = 1) AND (" + Contacts.HAS_PHONE_NUMBER + " != 0 )";
#Override
public View onCreateView(LayoutInflater inflater, #Nullable ViewGroup container, #Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setHasOptionsMenu(true);
View v =inflater.inflate(R.layout.contacts_tab, container, false);
mButton = (Button) v.findViewById(R.id.badge);
mButton.setText("Hi");
return v;
}
#Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
mCursor = null;
mAdapter = new CustomAdapter(getActivity(), R.layout.contacts_list_item, mCursor, FROM, TO, 0);
}
#Override
public void onActivityCreated(Bundle savedInstanceState) {
super.onActivityCreated(savedInstanceState);
setHasOptionsMenu(true);
setListAdapter(mAdapter);
getLoaderManager().initLoader(0, null, this);
getListView().setDivider(null);
getListView().setDividerHeight(0);
}
...
}
contacts_tab.xml
<?xml version="1.0" encoding="utf-8"?>
<ListView xmlns:android="http://schemas.android.com/apk/res/android"
android:id="#+id/contacts_list"
android:layout_width="match_parent"
android:layout_height="match_parent">
</ListView>
contacts_list_item.xml
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_height="wrap_content"
android:layout_width="match_parent"
android:orientation="horizontal"
android:background="#color/white">
<Button
android:id="#+id/badge"
android:background="#drawable/circle_button"
android:fontFamily="sans-serif-thin"
android:textSize="24sp"
android:textColor="#color/white"
android:layout_width="42dp"
android:layout_height="42dp"
android:layout_marginLeft="16dp"
android:layout_marginRight="16dp"
android:gravity="center"/>
<TextView
android:id="#+id/contact_text"
android:layout_width="match_parent"
android:layout_height="64dp"
android:textColor="#color/grey_dark"
android:textSize="20sp"
android:fontFamily="sans-serif-thin"
android:gravity="center_vertical"/>
</LinearLayout>
By code
View v =inflater.inflate(R.layout.contacts_tab, container, false);
mButton = (Button) v.findViewById(R.id.badge);
mButton.setText("Hi");
you are trying to get Button, which is part of contacts_tab.xml, but in this xml you don't have any buttons.
You have button in your adapter list item and you need to get reference to that button using adapter.
You need to do this in your adapter, not in the fragment. In the adapter, you will have a reference to each one of the items of the listview.
In addition to #Anand Singh answer, using a ListFragment requires a specific layout with predefined ListView id:
ListFragment has a default layout that consists of a single list view. However, if you desire, you can customize the fragment layout by returning your own view hierarchy from onCreateView(LayoutInflater, ViewGroup, Bundle).
To do this, your view hierarchy must contain a ListView object with the id "#android:id/list" (or list if it's in code)
For more please look at ListFragment documentation.
I have a problem with a Fragment.
There is a Dialog inside a Fragment, and a Fragment inside this Dialog.
But when I add the second Fragment, there is an IllegalArgumentException : No view found for id ***** (fr.*****:id/container_list_collections) for fragment FragmentCollectionVignette.
FragmentHP.java
public class FragmentHP extends Fragment {
/** Bouton Ajouter à **/
private Button btAddTo;
#Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, final Bundle savedInstanceState) {
View vueFragmentHP = inflater.inflate(R.layout.fragment_hp, container, false);
getFragmentManager().beginTransaction().replace(R.id.container_dernier_ajout, new FragmentDerniersAjoutsHP()).commit();
getFragmentManager().beginTransaction().replace(R.id.container_collections, new FragmentCollectionsHP()).commit();
getFragmentManager().beginTransaction().replace(R.id.container_ebooks, new FragmentEbooksHP()).commit();
getFragmentManager().beginTransaction().replace(R.id.container_games, new FragmentGamesHP()).commit();
getFragmentManager().beginTransaction().replace(R.id.container_software, new FragmentSoftwareHP()).commit();
getFragmentManager().beginTransaction().replace(R.id.container_digital_creation, new FragmentDigitalCreationHP()).commit();
btAddTo = (Button) vueFragmentHP.findViewById(R.id.bt_collections);
btAddTo.setOnClickListener(new OnClickListener() {
#Override
public void onClick(View v) {
LayoutInflater inflater = getActivity().getLayoutInflater();
View view = inflater.inflate(R.layout.dialog_add_to, null);
final Dialog dialog = new Dialog(getActivity());
dialog.requestWindowFeature(Window.FEATURE_NO_TITLE);
dialog.setContentView(view);
dialog.show();
dialog.setCanceledOnTouchOutside(false);
Button btValider = (Button) view.findViewById(R.id.bt_add_to);
getFragmentManager().beginTransaction().add(R.id.container_list_collections, new FragmentCollectionVignette()).commit();
}
});
return vueFragmentHP;
}
}
dialog_add_to.xml
<?xml version="1.0" encoding="UTF-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent" >
<TextView
android:id="#+id/tv_add_to"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="#string/add_to"/>
<TextView
android:id="#+id/tv_choose_collection"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="#string/choose_collection"
android:layout_below="#id/tv_add_to"/>
<FrameLayout
android:id="#+id/container_list_collections"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="#id/tv_choose_collection"/>
<Button
android:id="#+id/bt_add_to"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="#string/valider"
android:layout_below="#id/container_list_collections"/>
</RelativeLayout>
What is the problem ?
(Sorry for my very bad english)
i think the problem is in this line
getFragmentManager()
.beginTransaction()
.add(R.id.container_list_collections, new FragmentCollectionVignette())
.commit();
change this to
this.getActivity()
.getFragmentManager()
.beginTransaction()
.add(R.id.container_list_collections, new FragmentCollectionVignette())
.commit()
I'm trying to change a Textview's text inside a fragment, but it gaves me a NullPointerException at the setName method.
I have already tried 2 ways to do this:
public class MemberFragment extends Fragment {
private TextView tvName;
#Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
View view;
view = inflater.inflate(R.layout.fragment_member,container, false);
tvName = (TextView) getView().findViewById(R.id.tvProfileName);
return view;
}
public void setName(String name) {
tvName.setText(name);
}
or:
public class MemberFragment extends Fragment {
private static TextView tvName;
#Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
View view;
view = inflater.inflate(R.layout.fragment_member,container, false);
return view;
}
public void setName(String name) {
tvName = (TextView) getView().findViewById(R.id.tvProfileName);
tvName.setText(name);
}
but none gave me success. Here is where I instantiate the fragment:
MemberFragment fragment = new MemberFragment();
FragmentManager fm = getFragmentManager();
FragmentTransaction ft = fm.beginTransaction();
ft.replace(R.id.content_frame, fragment);
ft.commit();
fragment.setName(map.get(Tags.NAME));
and the fragment_member.xml:
<?xml version="1.0" encoding="utf-8"?>
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
style="#style/ActionBar.Transparent.MyStyle"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="top" >
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="446dp" >
<TextView
android:id="#+id/tvProfileName"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:text="Large Text"
android:textAppearance="?android:attr/textAppearanceLarge" />
</RelativeLayout>
</ScrollView>
Can someone help me?
Thanks.
view in your onCreateView method is the rootView of your fragment.
So just add the following code in your onCreateView method to change the text of your TextView:
((TextView)view.findViewById(R.id.tvProfileName)).setText("Your new text");
try this:
tvName = (TextView) view.findViewById(R.id.tvProfileName);
instead of :
tvName = (TextView) getView().findViewById(R.id.tvProfileName);
I want the onclick method to communicate with the other views in my layout. I am getting a NullPointerException when attempting to do so. I think I may be doing it wrong.
My getView method is below:
public View getView(int position, View convertView, ViewGroup parent) {
View v = convertView;
ViewHolder holder;
final int p =position;
if (v == null) {
LayoutInflater vi = (LayoutInflater) _c.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
v = vi.inflate(R.layout.menuitemrow, null);
holder = new ViewHolder();
holder.image = (ImageView) v.findViewById(R.id.MIR_itemImage);holder.image.setTag(position);
holder.itemName = (TextView)v.findViewById(R.id.MIR_itemName);holder.itemName.setTag(position);
holder.itemPrice = (TextView)v.findViewById(R.id.MIR_itemPrice);holder.itemPrice.setTag(position);
holder.itemOther = (TextView)v.findViewById(R.id.MIR_itemOther);holder.itemOther.setTag(position);
holder.details = (Button) v.findViewById(R.id.MIR_detailsbtn);holder.details.setTag(position);
holder.qAdd = (Button) v.findViewById(R.id.MIR_qaddbtn);holder.qAdd.setTag(position);
v.setTag(holder);
} else
holder = (ViewHolder) v.getTag();
MenuItemDetail mid = _data.get(position);
holder.image.setImageResource(mid.icon);
holder.itemName.setText(mid.itemName);
holder.itemPrice.setText("Price: $"+mid.itemPrice);
holder.itemOther.setText(mid.itemOther);
//set click listeners
holder.details.setOnClickListener(new View.OnClickListener() {
#Override
public void onClick(View v) {
m =_data.get(p);
s = m.getItemName();
Toast.makeText(_c, "clicked details"+p+" "+s, Toast.LENGTH_SHORT).show();
}
});
holder.qAdd.setOnClickListener(new View.OnClickListener() {
#Override
public void onClick(View v) {
Toast.makeText(_c, "clicked quick add "+p, Toast.LENGTH_SHORT).show();
TextView btnUpdate = (TextView) v.findViewById(R.id.CBV_textview2);
//btnUpdate.setTag(1);
//btnUpdate.setText(btnUpdate.getTag().toString());
btnUpdate.setText("b");
}
});
return v;
}
as you can see I am just assigning a number to the getTag just to pass it to the setText method. I have tried it commenting out the set and get, using just a String.
the problematic line is btnUpdate.setText("b");
Any ideas?
to summarize I am trying to access a TextView of a custom Button inside of a custom ListView from its customer adapter's getView method.
UPDATE for comment:
This is a Custom Listview being displayed with other buttons. I want the listview item (a button that is part of the custom ListView) when it is click to update the textview of a custom button I created that is displayed in the same acitivity as the custom list view.
The Layout is below:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >
<Button
android:id="#+id/MI_backbutton"
android:layout_width="fill_parent"
android:layout_height="50dp"
android:layout_weight="1"
android:text="#string/back_list_categories"
android:textSize="#dimen/FontSize8" />
<ListView
android:id="#+id/menuList"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="20" >
</ListView>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="50dp"
android:layout_gravity="bottom"
android:layout_marginBottom="5dp"
android:layout_weight="1" >
<Button
android:id="#+id/button2"
style="#android:style/Widget.Button"
android:layout_width="wrap_content"
android:layout_height="50dp"
android:layout_gravity="bottom"
android:layout_weight="1"
android:text="#string/generalbutton" />
<include
android:id="#+id/MI_checkorder"
style="android:buttonStyle"
android:layout_width="wrap_content"
android:layout_height="50dp"
android:layout_gravity="bottom"
android:layout_marginTop="5dp"
android:layout_weight="1"
layout="#layout/custombtnview"
android:background="#style/AppTheme"
android:clickable="true"
android:focusable="true" />
</LinearLayout>
In the view I am referencing to get the Textview, the textview is not there. What is in that view is the MI_checkorder. I was thinking maybe this is why I am getting the NullPointerException for my btnUpdate. the textveiw CBV_textview2 is part of the view I created as a button(MI_checkorder).
I now have the button but I am unable to get the change to show on the UI. Here is the code I added:
public void onClick(View v) {
Toast.makeText(_c, "clicked quick add "+p, Toast.LENGTH_SHORT).show();
TextView btnUpdate = (TextView) inflateToEdit(_c, v).findViewById(R.id.CBV_textview2);
//btnUpdate.setTag(1);
//btnUpdate.setText(btnUpdate.getTag().toString());
btnUpdate.setText("b");
}
and this is the method I created in the custom adapter class.
public View inflateToEdit(Context c, View view){
View vw = view;
LayoutInflater vi = (LayoutInflater) _c.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
return vi.inflate(R.layout.custombtnview, null);
}
It is updating the button's text but it is not showing on the UI. I do not think i can update the UI from this point in the code. I think I need to do it from the activity.
That's because findViewById called on a view looks for the child view of the given view.
findViewById doc
"Look for a child view with the given id. If this view has the given id, return this view."
From what I can see, CBV_textview2 is contained in the layout of the activity.
So, what you can do is to pass the activity to the adapter's constructor (I see you already have a _c member variable which I suppose is a Context, OR directly pass the CBV_textview2 itself (calling findViewById in the containing activty).
In both cases, you need to call the activity's findViewById which
"Finds a view that was identified by the id attribute from the XML that was processed in onCreate(Bundle)."
public class YourAdapter extends ArrayAdapter<String> {
private final Context context;
// blahblahblah
private final TextView mYourTextView;
public YourAdapter(Context context, String[] values, TextView btnUpdate) {
super(context, R.layout.rowlayout, values);
this.context = context;
this.values = values;
mYourTextView = btnUpdate;
}
....
#Override
public void onClick(View v) {
Toast.makeText(_c, "clicked quick add "+p, Toast.LENGTH_SHORT).show();
//mYourTextView.setTag(1);
//mYourTextView.setText(btnUpdate.getTag().toString());
mYourTextView.setText("b");
}
In your activity you should be able to get the TextView before calling the constructor.