Dialog Fragment is crashing - java

i have a Dialog fragment that i show using. Btw i have updated my support libraries to include material design theme and new classes. Is it possible that the new fragmentDialog fragments are buggy
fragment.show(getSupportedFragmentManager(),null);
here is the code for the fragment
public class NewTimedEvent extends DialogFragment {
#Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
// Inflate the layout for this fragment
return inflater.inflate(R.layout.fragment_new_timed_event, container, false);
}
#Override // show User interface in a dialog
public Dialog onCreateDialog(Bundle savedInstanceState) {
// Use the Builder class for convenient dialog construction
AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
LayoutInflater inflater = getActivity().getLayoutInflater();
View view = inflater.inflate(R.layout.fragment_new_timed_event, null);
builder.setView(view);
builder.setPositiveButton(getString(android.R.string.ok), new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int id) {
}
});
builder.setNegativeButton(getString(android.R.string.cancel), new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int id) {
}
});
// Create the AlertDialog object and return it
return builder.create();
}
}
here is the error is get
11-20 19:05:17.665 14612-14612/prototyping.materialdesign E/AndroidRuntime﹕ FATAL EXCEPTION: main
android.util.AndroidRuntimeException: requestFeature() must be called before adding content
at com.android.internal.policy.impl.PhoneWindow.requestFeature(PhoneWindow.java:267)
at com.android.internal.app.AlertController.installContent(AlertController.java:235)
at android.app.AlertDialog.onCreate(AlertDialog.java:336)
at android.app.Dialog.dispatchOnCreate(Dialog.java:351)
at android.app.Dialog.show(Dialog.java:256)
at android.support.v4.app.DialogFragment.onStart(DialogFragment.java:398)
at android.support.v4.app.Fragment.performStart(Fragment.java:1810)
at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:977)
at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1126)
at android.support.v4.app.BackStackRecord.run(BackStackRecord.java:739)
at android.support.v4.app.FragmentManagerImpl.execPendingActions(FragmentManager.java:1489)
at android.support.v4.app.FragmentManagerImpl$1.run(FragmentManager.java:454)
at android.os.Handler.handleCallback(Handler.java:615)
at android.os.Handler.dispatchMessage(Handler.java:92)
at android.os.Looper.loop(Looper.java:137)
at android.app.ActivityThread.main(ActivityThread.java:4898)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:511)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1008)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:775)
at dalvik.system.NativeStart.main(Native Method)
finally here is the code for Fragment UI
<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="vertical"
tools:context="prototyping.materialdesign.NewTimedEvent">
<LinearLayout
android:paddingTop="10dp"
android:paddingBottom="#dimen/activity_vertical_margin"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:showDividers="middle"
android:divider="?android:dividerVertical">
<TextView
android:id="#+id/action_time"
android:text="Action time"
android:layout_weight="1"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:textStyle="bold"
/>
<TextView
android:id="#+id/time"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="00:00"
android:paddingRight="#dimen/activity_horizontal_margin"
/>
</LinearLayout>
<View
android:layout_width="match_parent"
android:layout_height="1dp"
android:background="#d0d0d0"/>
<TextView
android:id="#+id/days"
android:paddingTop="#dimen/activity_vertical_margin"
android:paddingBottom="#dimen/activity_vertical_margin"
android:textStyle="bold"
android:text="Select Days for action to take place"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
<RadioGroup
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
>
<RadioButton
android:id="#+id/sound"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="#string/sound" />
<RadioButton
android:id="#+id/vibrate"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="#string/vibrate" />
<RadioButton
android:id="#+id/silent"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="#string/silent" />
</RadioGroup>
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<CheckBox
android:id="#+id/wifi"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="#string/wifi" />
<CheckBox
android:id="#+id/bluetooth"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="#string/bluetooth" />
</LinearLayout>
<CheckBox
android:id="#+id/airplane"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="#string/airplane_mode"/>
<EditText
android:id="#+id/event_name"
android:hint="Event name"
android:layout_width="match_parent"
android:layout_height="wrap_content"
/>
</LinearLayout>

Related

Inflating Images on ImageView on a RecylerView

I have been having a problem inflating an images on an Image view in a recyclerview.The images fetched from firebase database into the recyclerview, Precisely i get the following error.
E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.example.cnatra_measure, PID: 21096
android.view.InflateException: Binary XML file line #24: Binary XML file line #24: Error inflating class android.widget.ImageView
Caused by: android.view.InflateException: Binary XML file line #24: Error inflating class android.widget.ImageView
Caused by: java.lang.reflect.InvocationTargetException
and a further in the error i get
at com.example.cnatra_measure.Adapters.Trads_StyleAdapter.onCreateViewHolder(Trads_StyleAdapter.java:54)
at com.example.cnatra_measure.Adapters.Trads_StyleAdapter.onCreateViewHolder(Trads_StyleAdapter.java:21)
my Adapter code is given below
public class Trads_StyleAdapter extends RecyclerView.Adapter<Trads_StyleAdapter.Trads_ViewHolder> {
private Context mCtx;
private List<Styles> stylesList;
public Trads_StyleAdapter(Context mCtx, List<Styles> stylesList) {
this.mCtx = mCtx;
this.stylesList = stylesList;
}
public Trads_StyleAdapter(ArrayList<Styles> stylesList) {
this.stylesList = stylesList;
}
public static class Trads_ViewHolder extends RecyclerView.ViewHolder {
ImageView styleImage;
TextView style_name, style_price;
//List<Food> foods;
//Context ctx;
public Trads_ViewHolder(View v) {
super(v);
styleImage = v.findViewById(R.id.styleIcon);
style_name = v.findViewById(R.id.style_names);
style_price = v.findViewById(R.id.style_price);
}
}
#NonNull
#Override
public Trads_ViewHolder onCreateViewHolder(#NonNull ViewGroup parent, int viewType) {
LayoutInflater inflater = LayoutInflater.from(mCtx);
View v = inflater.inflate(R.layout.styles_items, parent, false);
return new Trads_ViewHolder(v);
}
#Override
public void onBindViewHolder(#NonNull Trads_ViewHolder holder, int position) {
Styles mStyles = stylesList.get(position);
holder.style_name.setText(mStyles.getStyle_name());
holder.style_price.setText(mStyles.getPrice());
Picasso.get()
.load(mStyles.getStyle_image())
.placeholder(R.drawable.img_placeholder)
.fit()
.centerCrop()
.into(holder.styleImage);
}
#Override
public int getItemCount() {
return stylesList.size();
}
}
and the XML code for the list items is
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:card_view="http://schemas.android.com/apk/res-auto"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent">
<androidx.cardview.widget.CardView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="#+id/card_view"
android:layout_gravity="center"
android:layout_margin="5dp"
android:elevation="15dp"
card_view:cardCornerRadius="8dp">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="250dp"
android:id="#+id/iconWrapper"
android:orientation="vertical">
<ImageView
android:layout_width="130dp"
android:layout_height="130dp"
android:id="#+id/styleIcon"
android:background="?attr/selectableItemBackgroundBorderless"
android:clickable="true"
android:layout_gravity="center_horizontal|center_vertical"
android:scaleType="fitXY"
android:layout_marginTop="15dp"
android:layout_marginBottom="15dp"
android:focusable="true" />
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="#+id/style_names"
android:fontFamily="#font/nunito_semibold"
android:padding="5dp"
android:textSize="20sp"
android:textColor="#color/blue"
android:textAlignment="center"/>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal">
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="#string/naira"
android:fontFamily="#font/nunito_bold"
android:padding="5dp"
android:textSize="15sp"
android:textColor="#color/blue"
android:textAlignment="center"/>
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="#+id/style_price"
android:padding="5dp"
android:textSize="15sp"
android:fontFamily="#font/nunito_bold"
android:textColor="#color/black"
android:textAlignment="center"/>
</LinearLayout>
</LinearLayout>
</androidx.cardview.widget.CardView>
</RelativeLayout>
Thanks in advance
Use this xml :
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:card_view="http://schemas.android.com/apk/res-auto"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent">
<androidx.cardview.widget.CardView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="#+id/card_view"
android:layout_gravity="center"
android:layout_margin="5dp"
android:elevation="15dp"
card_view:cardCornerRadius="8dp">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="250dp"
android:id="#+id/iconWrapper"
android:orientation="vertical">
<ImageView
android:layout_width="130dp"
android:layout_height="130dp"
android:id="#+id/styleIcon"
android:clickable="true"
android:layout_gravity="center"
android:scaleType="fitXY"
android:layout_marginTop="15dp"
android:layout_marginBottom="15dp"
android:focusable="true" />
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="#+id/style_names"
android:fontFamily="#font/nunito_semibold"
android:padding="5dp"
android:textSize="20sp"
android:textColor="#color/blue"
android:textAlignment="center"/>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal">
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="#string/naira"
android:fontFamily="#font/nunito_bold"
android:padding="5dp"
android:textSize="15sp"
android:textColor="#color/blue"
android:textAlignment="center"/>
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="#+id/style_price"
android:padding="5dp"
android:textSize="15sp"
android:fontFamily="#font/nunito_bold"
android:textColor="#color/black"
android:textAlignment="center"/>
</LinearLayout>
</LinearLayout>
</androidx.cardview.widget.CardView>
</RelativeLayout>

My Button is not working to get next activity by clicking on them

I implemented Bottom navigation bar in my project. When I declare and initialize buttons and then set onClickListener for them. The onclicklistener is not working fine without any error in logcat. I think its logical mistake that I'm unable to understand please see the code and guide me. (If you think the question is not according to community standards then I'm sorry in advance because I'm a beginner in java)
I searched a lot of questions related to this but nothing works for me.
Here is my main activity:
public class HomeActivity extends AppCompatActivity {
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_home);
BottomNavigationView bottomNav = findViewById(R.id.bottom_navigation);
bottomNav.setOnNavigationItemSelectedListener(navListener);
//I added this if statement to keep the selected fragment when rotating the device
if (savedInstanceState == null) {
getSupportFragmentManager().beginTransaction().replace(R.id.fragment_container,
new HomeFragment()).commit();
}
}
private BottomNavigationView.OnNavigationItemSelectedListener navListener =
new BottomNavigationView.OnNavigationItemSelectedListener() {
#Override
public boolean onNavigationItemSelected(#NonNull MenuItem item) {
Fragment selectedFragment = null;
switch (item.getItemId()) {
case R.id.nav_home:
selectedFragment = new HomeFragment();
break;
case R.id.nav_notifications:
selectedFragment = new NotificationFragment();
break;
case R.id.nav_search:
selectedFragment = new SearchFragment();
break;
}
getSupportFragmentManager().beginTransaction().replace(R.id.fragment_container,
selectedFragment).commit();
return true;
}
};
}
Here is my First Fragment named HomeFragment:
public class HomeFragment extends Fragment implements View.OnClickListener {
Button btnFertilizers;
#Nullable
#Override
public View onCreateView(LayoutInflater inflater, #Nullable ViewGroup container, #Nullable Bundle savedInstanceState) {
View v = inflater.inflate(R.layout.fragment_home, container, false);
btnFertilizers = (Button)v.findViewById(R.id.btnFertilizers);
return inflater.inflate(R.layout.fragment_home, container, false);
}
#Override
public void onClick(View view) {
btnFertilizers.setOnClickListener(new View.OnClickListener() {
#Override
public void onClick(View view) {
Intent intent = new Intent(getActivity(),Fertilizers.class);
getActivity().startActivity(intent);
}
});
}
Logcat shows zero error.
I believe that here is the problem area. This is because the click function is not working properly for Fertilizers.class:
#Override
public void onClick(View view) {
btnFertilizers.setOnClickListener(new View.OnClickListener() {
#Override
public void onClick(View view) {
Intent intent = new Intent(getActivity(),Fertilizers.class);
getActivity().startActivity(intent);
}
});
}
Here is my FragmentHome.xml :
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#android:color/holo_green_light">
<ScrollView
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_alignParentTop="true"
android:layout_alignParentLeft="true"
>
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical">
<RelativeLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="230dp"
android:orientation="vertical"
android:gravity="center"
android:background="#drawable/agriculture_home">
<ImageView
android:layout_width="110dp"
android:layout_height="110dp"
android:src="#drawable/e_agriculture_logo"
android:layout_gravity="center" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="E-Agriculture"
android:textColor="#ffffff"
android:layout_gravity="center"
android:textStyle="bold"
android:textSize="29sp"
android:layout_marginTop="10dp"
/>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:layout_marginTop="215dp"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="200dp"
android:layout_marginLeft="10dp"
android:layout_marginTop="21dp"
android:layout_marginRight="10dp"
android:layout_marginBottom="0dp"
android:orientation="horizontal">
<androidx.cardview.widget.CardView
android:layout_width="125dp"
android:layout_height="match_parent"
android:layout_gravity="center"
android:layout_weight="1"
android:layout_marginRight="5dp"
android:orientation="vertical">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<ImageView
android:id="#+id/fertilizers"
android:layout_width="144dp"
android:layout_height="113dp"
android:layout_centerInParent="true"
android:src="#drawable/fertilizers_png" />
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="#+id/fertilizers"
android:text="Fertilizers"
android:textSize="20sp"
android:gravity="center"
android:textColor="#color/colorBlack"
android:layout_centerHorizontal="true"
android:layout_marginTop="10dp"
android:layout_marginBottom="0dp"
/>
<Button
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="#+id/btnFertilizers"
android:background="#android:color/transparent"/>
</RelativeLayout>
</androidx.cardview.widget.CardView>
<androidx.cardview.widget.CardView
android:layout_width="125dp"
android:layout_height="match_parent"
android:layout_gravity="center"
android:layout_marginLeft="5dp"
android:layout_weight="1"
android:orientation="vertical">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<ImageView
android:id="#+id/seeds"
android:layout_width="100dp"
android:layout_height="100dp"
android:layout_centerInParent="true"
android:src="#drawable/seed" />
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="#+id/seeds"
android:text="Seeds"
android:gravity="center"
android:textColor="#color/colorBlack"
android:textSize="20sp"
android:layout_centerHorizontal="true"
android:layout_marginTop="10dp"
android:layout_marginBottom="10dp"
/>
<Button
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="#+id/btn_seeds"
android:background="#android:color/transparent"/>
</RelativeLayout>
</androidx.cardview.widget.CardView>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="200dp"
android:layout_marginLeft="10dp"
android:layout_marginTop="21dp"
android:layout_marginRight="10dp"
android:layout_marginBottom="0dp"
android:orientation="horizontal">
<androidx.cardview.widget.CardView
android:layout_width="125dp"
android:layout_height="match_parent"
android:layout_gravity="center"
android:layout_weight="1"
android:layout_marginRight="5dp"
android:orientation="vertical">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<ImageView
android:id="#+id/deseases"
android:layout_width="100dp"
android:layout_height="100dp"
android:layout_centerInParent="true"
android:src="#drawable/deseases" />
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="#+id/deseases"
android:text="Diseases"
android:textSize="20sp"
android:gravity="center"
android:textColor="#color/colorBlack"
android:layout_centerHorizontal="true"
android:layout_marginTop="10dp"
android:layout_marginBottom="10dp"
/>
<Button
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="#+id/btn_deseases"
android:background="#android:color/transparent"/>
</RelativeLayout>
</androidx.cardview.widget.CardView>
<androidx.cardview.widget.CardView
android:layout_width="125dp"
android:layout_height="match_parent"
android:layout_gravity="center"
android:layout_marginLeft="5dp"
android:layout_weight="1"
android:orientation="vertical">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<ImageView
android:id="#+id/imageViewPesticides"
android:layout_width="100dp"
android:layout_height="100dp"
android:layout_centerInParent="true"
android:src="#drawable/pesticides" />
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="#+id/imageViewPesticides"
android:text="Pesticides"
android:textSize="20sp"
android:layout_centerHorizontal="true"
android:layout_marginTop="10dp"
android:gravity="center"
android:textColor="#color/colorBlack"
android:layout_marginBottom="10dp"
/>
<Button
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="#+id/btnPesticides"
android:background="#android:color/transparent"/>
</RelativeLayout>
</androidx.cardview.widget.CardView>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="200dp"
android:layout_marginLeft="10dp"
android:layout_marginTop="21dp"
android:layout_marginRight="10dp"
android:layout_marginBottom="0dp"
android:orientation="horizontal">
<androidx.cardview.widget.CardView
android:layout_width="125dp"
android:layout_height="match_parent"
android:layout_gravity="center"
android:layout_weight="1"
android:layout_marginRight="5dp"
android:orientation="vertical">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<ImageView
android:id="#+id/imageViewWeatherForecast"
android:layout_width="100dp"
android:layout_height="100dp"
android:layout_centerInParent="true"
android:src="#drawable/weatherforecast" />
<TextView
android:gravity="center"
android:textColor="#color/colorBlack"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="#+id/imageViewWeatherForecast"
android:text="Weather Forecast"
android:textSize="20sp"
android:layout_centerHorizontal="true"
android:layout_marginTop="10dp"
android:layout_marginBottom="10dp"
/>
<Button
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="#+id/btnWeatherForecast"
android:background="#android:color/transparent"/>
</RelativeLayout>
</androidx.cardview.widget.CardView>
<androidx.cardview.widget.CardView
android:layout_width="125dp"
android:layout_height="match_parent"
android:layout_gravity="center"
android:layout_marginLeft="5dp"
android:layout_weight="1"
android:orientation="vertical">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<ImageView
android:id="#+id/imageViewArticles"
android:layout_width="100dp"
android:layout_height="100dp"
android:layout_centerInParent="true"
android:src="#drawable/video" />
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="#+id/imageViewArticles"
android:text="Videos"
android:textSize="20sp"
android:gravity="center"
android:textColor="#color/colorBlack"
android:layout_marginTop="10dp"
android:layout_marginBottom="10dp"
/>
<Button
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="#+id/btnArticles"
android:background="#android:color/transparent"/>
</RelativeLayout>
</androidx.cardview.widget.CardView>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="200dp"
android:layout_marginLeft="10dp"
android:layout_marginTop="21dp"
android:layout_marginRight="10dp"
android:layout_marginBottom="0dp"
android:orientation="horizontal">
<androidx.cardview.widget.CardView
android:layout_width="125dp"
android:layout_height="match_parent"
android:layout_gravity="center"
android:layout_weight="1"
android:layout_marginRight="5dp"
android:orientation="vertical">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<ImageView
android:id="#+id/imageViewFeedback"
android:layout_width="100dp"
android:layout_height="100dp"
android:layout_centerInParent="true"
android:src="#drawable/feedback" />
<TextView
android:gravity="center"
android:textColor="#color/colorBlack"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="#+id/imageViewFeedback"
android:text="Feedback"
android:textSize="20sp"
android:layout_centerHorizontal="true"
android:layout_marginTop="10dp"
android:layout_marginBottom="10dp"
/>
<Button
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="#+id/btnFeedback"
android:background="#android:color/transparent"/>
</RelativeLayout>
</androidx.cardview.widget.CardView>
<androidx.cardview.widget.CardView
android:layout_width="125dp"
android:layout_height="match_parent"
android:layout_gravity="center"
android:layout_weight="1"
android:layout_marginRight="5dp"
android:orientation="vertical">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<ImageView
android:id="#+id/imageViewLocation"
android:layout_width="100dp"
android:layout_height="100dp"
android:layout_centerInParent="true"
android:src="#drawable/location_icon" />
<TextView
android:gravity="center"
android:textColor="#color/colorBlack"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="#+id/imageViewLocation"
android:text="Location"
android:textSize="20sp"
android:layout_centerHorizontal="true"
android:layout_marginTop="10dp"
android:layout_marginBottom="10dp"
tools:ignore="NotSibling" />
<Button
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="#+id/btnLocation"
android:background="#android:color/transparent"/>
</RelativeLayout>
</androidx.cardview.widget.CardView>
</LinearLayout>
</LinearLayout>
</RelativeLayout>
</LinearLayout>
</ScrollView>
</RelativeLayout>
Here is my MainActivity.xml file:
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".HomeActivity">
<FrameLayout
android:id="#+id/fragment_container"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_above="#id/bottom_navigation"/>
<com.google.android.material.bottomnavigation.BottomNavigationView
android:id="#+id/bottom_navigation"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
app:menu="#menu/bottom_navigation"
app:itemIconTint="#color/colorWhite"
app:itemTextColor="#color/colorWhite"
android:background="#color/colorGreen"/>
</RelativeLayout>
How I should setOnClickListener to access my wanted activity?
Move this code into onCreateView.
btnFertilizers.setOnClickListener(new View.OnClickListener() {
#Override
public void onClick(View view) {
Intent intent = new Intent(getActivity(),Fertilizers.class);
getActivity().startActivity(intent);
}
});
remove this
implements View.OnClickListener
remove this
#Override
public void onClick(View view) { }
You are calling another onClick lisnter inside the onclick method so it will no work.You should have to change the code like this:
#Override
public void onClick(View view) {
if (view.getId() == R.id.btnFertilizers) {
Intent intent = new Intent(getActivity(),Fertilizers.class);
getActivity().startActivity(intent);
}
Return v in your onCreateViewMethod .
#Nullable
#Override
public View onCreateView(LayoutInflater inflater, #Nullable ViewGroup
container, #Nullable Bundle savedInstanceState) {
View v = inflater.inflate(R.layout.fragment_home, container, false);
btnFertilizers = (Button)v.findViewById(R.id.btnFertilizers);
return v;
}

Can't run App on Note 2 because of too many images (only 20 images)

I am getting the following error when I go from my Main Activity page to my New Activity page. The New Activity page crashes unless it has <10 images or so, which is pathetic (the app runs fine emulated on my computer, however):
06-22 16:53:04.841 15058-15058/? D/AndroidRuntime: Shutting down VM
06-22 16:53:04.841 15058-15058/? W/dalvikvm: threadid=1: thread exiting with uncaught exception (group=0x41e35c08)
06-22 16:53:04.851 15058-15058/? E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.matthewscompany.matthew.test1, PID: 15058
java.lang.OutOfMemoryError
at android.graphics.BitmapFactory.nativeDecodeAsset(Native Method)
at android.graphics.BitmapFactory.decodeStream(BitmapFactory.java:683)
at android.graphics.BitmapFactory.decodeResourceStream(BitmapFactory.java:513)
at android.graphics.drawable.Drawable.createFromResourceStream(Drawable.java:889)
at android.content.res.Resources.loadDrawable(Resources.java:3436)
at android.content.res.TypedArray.getDrawable(TypedArray.java:602)
at android.widget.ImageView.<init>(ImageView.java:133)
at android.support.v7.widget.AppCompatImageView.<init>(AppCompatImageView.java:57)
at android.support.v7.widget.AppCompatImageView.<init>(AppCompatImageView.java:53)
at android.support.v7.app.AppCompatViewInflater.createView(AppCompatViewInflater.java:102)
at android.support.v7.app.AppCompatDelegateImplV7.createView(AppCompatDelegateImplV7.java:972)
at android.support.v7.app.AppCompatDelegateImplV7.onCreateView(AppCompatDelegateImplV7.java:1030)
at android.support.v4.view.LayoutInflaterCompatHC$FactoryWrapperHC.onCreateView(LayoutInflaterCompatHC.java:44)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:690)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:761)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:769)
at android.view.LayoutInflater.inflate(LayoutInflater.java:498)
at android.view.LayoutInflater.inflate(LayoutInflater.java:398)
at android.view.LayoutInflater.inflate(LayoutInflater.java:354)
at android.support.v7.app.AppCompatDelegateImplV7.setContentView(AppCompatDelegateImplV7.java:276)
at android.support.v7.app.AppCompatActivity.setContentView(AppCompatActivity.java:136)
at com.example.matthew.test1.NewActivity.onCreate(NewActivity.java:23)
at android.app.Activity.performCreate(Activity.java:5451)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1093)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2377)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2471)
at android.app.ActivityThread.access$900(ActivityThread.java:175)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1308)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:146)
at android.app.ActivityThread.main(ActivityThread.java:5602)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1283)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1099)
at dalvik.system.NativeStart.main(Native Method)
06-22 16:53:04.861 2430-2769/? W/ActivityManager: Force finishing activity com.matthewscompany.matthew.test1/com.example.matthew.test1.NewActivity
06-22 16:53:04.866 2430-2769/? W/ActivityManager: Force finishing activity com.matthewscompany.matthew.test1/com.example.matthew.test1.MainActivity
I understand that the out of memory error occurs when the ram for a phone runs out when processing too many bitmaps.
Yes, I have read the Android Developer webpages on tips for processing bitmaps. However, I still don't understand which groups of code from their guides I'm supposed to insert, and where I'm supposed to insert it. I've tried inserting some of their stuff into my .java files but I just end up getting errors. I owe this to me being a beginner at Java and not understanding how to apply the example codes.
Again, I am a beginner to Java and Android Studio so please go easy on me and explain things as simply as you can, if possible.
Here's my code:
MainActivity.java:
package com.example.matthew.test1;
import android.content.Intent;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.view.View;
import android.widget.ImageButton;
public class MainActivity extends AppCompatActivity {
//Main Menu
//Main Activity Mario Icon:
ImageButton Mario;
ImageButton Luigi;
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
Mario= (ImageButton) findViewById(R.id.Mario);
Mario.setOnClickListener(new View.OnClickListener() {
#Override
public void onClick(View v) {
Intent intentLoadNewActivity = new Intent(MainActivity.this, NewActivity.class);
startActivity(intentLoadNewActivity);
}
});
Luigi= (ImageButton) findViewById(R.id.Luigi);
Luigi.setOnClickListener(new View.OnClickListener() {
#Override
public void onClick(View v) {
Intent intentLoadNewActivity = new Intent(MainActivity.this, Main2Activity.class);
startActivity(intentLoadNewActivity);
}
});
}
}
NewActivity.java:
public class NewActivity extends AppCompatActivity implements View.OnClickListener {
ViewFlipper viewFlipper;
Button next;
Button previous;
TextView pageCounter;
int count = 1;
private static final int TOTAL_IMG_COUNT = 23;
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_new);
viewFlipper = (ViewFlipper)findViewById(R.id.viewFlipper);
next = (Button) findViewById(R.id.next);
previous = (Button) findViewById(R.id.previous);
pageCounter = (TextView)findViewById(R.id.textView2);
pageCounter.setText(String.valueOf(count));
next.setOnClickListener(this);
previous.setOnClickListener(this);
}
#Override
public void onClick(View v) {
if (v == next) {
viewFlipper.showNext();
if (next.getId() == (R.id.ImageView23)) {
count = 1;
} else {
count++;
}
pageCounter.setText(String.valueOf(count) + "/" + TOTAL_IMG_COUNT);
}
else if (v == previous) {
viewFlipper.showPrevious();
if(previous.getId() == (R.id.ImageView1)) {
count = TOTAL_IMG_COUNT;
} else {
count--;
}
pageCounter.setText(String.valueOf(count) + "/" + TOTAL_IMG_COUNT);
}
}
}
content_main.xml:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
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"
app:layout_behavior="#string/appbar_scrolling_view_behavior"
tools:context="com.example.matthew.test1.MainActivity"
tools:showIn="#layout/activity_main">
<ImageButton
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="#+id/Mario"
android:src="#drawable/mario_select"
android:layout_above="#+id/samus_select"
android:layout_alignLeft="#+id/samus_select"
android:layout_alignStart="#+id/samus_select" />
<ImageButton
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="#+id/Luigi"
android:src="#drawable/luigi_select"
android:layout_above="#+id/samus_select"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true" />
<ImageButton
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="#+id/dk_select"
android:src="#drawable/dk_select"
android:layout_above="#+id/falcon_select"
android:layout_alignParentRight="true"
android:layout_alignParentEnd="true" />
<ImageButton
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="#+id/link_select"
android:src="#drawable/link_select"
android:layout_below="#+id/fox_select"
android:layout_alignParentLeft="true" />
<ImageButton
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="#+id/samus_select"
android:src="#drawable/samus_select"
android:layout_above="#+id/kirby_select"
android:layout_centerHorizontal="true" />
<ImageButton
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="#+id/falcon_select"
android:src="#drawable/falcon_select"
android:layout_alignTop="#+id/samus_select"
android:layout_alignParentRight="true"
android:layout_alignParentEnd="true" />
<ImageButton
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="#+id/ness_select"
android:src="#drawable/ness_select"
android:layout_alignParentBottom="true"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true" />
<ImageButton
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="#+id/yoshi_select"
android:src="#drawable/yoshi_select"
android:layout_below="#+id/falcon_select"
android:layout_alignParentRight="true"
android:layout_alignParentEnd="true" />
<ImageButton
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="#+id/kirby_select"
android:src="#drawable/kirby_select"
android:layout_above="#+id/pika_select"
android:layout_alignLeft="#+id/samus_select"
android:layout_alignStart="#+id/samus_select" />
<ImageButton
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="#+id/fox_select"
android:src="#drawable/fox_select"
android:layout_alignParentStart="true"
android:layout_below="#+id/Luigi"
android:layout_alignParentLeft="true" />
<ImageButton
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="#+id/pika_select"
android:src="#drawable/pika_select"
android:layout_alignParentBottom="true"
android:layout_alignLeft="#+id/kirby_select"
android:layout_alignStart="#+id/kirby_select" />
<ImageButton
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="#+id/jiggly_select"
android:src="#drawable/jiggly_select"
android:layout_below="#+id/yoshi_select"
android:layout_alignLeft="#+id/yoshi_select"
android:layout_alignStart="#+id/yoshi_select" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceLarge"
android:text="Hitbox64"
android:id="#+id/textView"
android:textSize="48dp"
android:layout_above="#+id/Mario"
android:layout_centerHorizontal="true" />
</RelativeLayout>
activity_new.xml:
<?xml version="1.0" encoding="utf-8"?>
<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="com.example.matthew.test1.NewActivity">
<ViewFlipper
android:layout_width="480dp"
android:layout_height="480dp"
android:id="#+id/viewFlipper">
<ImageView
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:id="#+id/ImageView1"
android:scaleType="centerCrop"
android:src="#drawable/b1"/>
<ImageView
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:id="#+id/ImageView2"
android:scaleType="centerCrop"
android:src="#drawable/b2"/>
<ImageView
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:id="#+id/ImageView3"
android:scaleType="centerCrop"
android:src="#drawable/b3"/>
<ImageView
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:id="#+id/ImageView4"
android:scaleType="centerCrop"
android:src="#drawable/b4"/>
<ImageView
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:id="#+id/ImageView5"
android:scaleType="centerCrop"
android:src="#drawable/b5"/>
<ImageView
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:id="#+id/ImageView6"
android:scaleType="centerCrop"
android:src="#drawable/b6"/>
<ImageView
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:id="#+id/ImageView7"
android:scaleType="centerCrop"
android:src="#drawable/b7"/>
<ImageView
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:id="#+id/ImageView8"
android:scaleType="centerCrop"
android:src="#drawable/b8"/>
<ImageView
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:id="#+id/ImageView9"
android:scaleType="centerCrop"
android:src="#drawable/b9"/>
<ImageView
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:id="#+id/ImageView10"
android:scaleType="centerCrop"
android:src="#drawable/b10"/>
<ImageView
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:id="#+id/ImageView11"
android:scaleType="centerCrop"
android:src="#drawable/b11"/>
<ImageView
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:id="#+id/ImageView12"
android:scaleType="centerCrop"
android:src="#drawable/b12"/>
<ImageView
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:id="#+id/ImageView13"
android:scaleType="centerCrop"
android:src="#drawable/b13"/>
<ImageView
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:id="#+id/ImageView14"
android:scaleType="centerCrop"
android:src="#drawable/b14"/>
<ImageView
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:id="#+id/ImageView16"
android:scaleType="centerCrop"
android:src="#drawable/b17"/>
<ImageView
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:id="#+id/ImageView18"
android:scaleType="centerCrop"
android:src="#drawable/b18"/>
<ImageView
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:id="#+id/ImageView19"
android:scaleType="centerCrop"
android:src="#drawable/b19"/>
<ImageView
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:id="#+id/ImageView20"
android:scaleType="centerCrop"
android:src="#drawable/b20"/>
<ImageView
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:id="#+id/ImageView21"
android:scaleType="centerCrop"
android:src="#drawable/b21"/>
<ImageView
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:id="#+id/ImageView22"
android:scaleType="centerCrop"
android:src="#drawable/b22"/>
<ImageView
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:id="#+id/ImageView23"
android:scaleType="centerCrop"
android:src="#drawable/b23"/>
</ViewFlipper>
<Button
android:id="#+id/next"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Next"
android:layout_alignParentBottom="true"
android:layout_alignParentRight="true"
android:layout_alignParentEnd="true"/>
<Button
android:id="#+id/previous"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Prev"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_alignParentBottom="true"
android:layout_alignTop="#+id/next"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceLarge"
android:text="Frame Counter"
android:id="#+id/textView2"
android:layout_below="#+id/textView3"
android:layout_centerHorizontal="true" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceLarge"
android:text="Bair"
android:id="#+id/textView3"
android:layout_alignTop="#+id/previous"
android:layout_centerHorizontal="true" />
</RelativeLayout>
If your images are too high-resolution, they can eat up a LOT of memory, especially if you have 20 of them as you say. Consider using Picasso or some other library to load your images.

How to create a custom adapter for a listview? Getting RessourceNotFoundException

I am trying to make a custom adapter for my listview, but I keep getting a RessourceNotFoundException on the same line.
Firstly, here is my adapter class code:
public class CreateProgramAdapter extends BaseAdapter {
private final LayoutInflater inflater;
private ArrayList<TrainingPass> trainingPasses;
private List<TrainingPass> items;
private int layoutResourceId;
private Context context;
public CreateProgramAdapter(Context context, List<TrainingPass> items) {
this.context = context;
this.items = items;
inflater = LayoutInflater.from(this.context);
}
#Override
public int getCount() {
return items.size();
}
#Override
public Object getItem(int position) {
return items.get(position);
}
#Override
public long getItemId(int position) {
return 0;
}
#Override
public View getView(int position, View convertView, ViewGroup parent) {
View row = convertView;
TrainingPassHolder holder;
if(convertView == null) {
convertView = inflater.inflate(R.layout.adapter_createprogram_trainingpasses_item, null);
holder = new TrainingPassHolder();
convertView.setTag(holder);
} else {
holder = (TrainingPassHolder) convertView.getTag();
}
holder.trainingPass = this.items.get(position);
holder.trainingPassRelativeLayout = (RelativeLayout) row.findViewById(R.id.trainingpass_item_relativelayout);
holder.headlineTxt = (TextView) row.findViewById(R.id.trainingpass_headline);
holder.setNoTxt = (TextView) row.findViewById(R.id.txt_trainingpass_setno);
holder.showHideIcon = (ImageView) row.findViewById(R.id.trainingpass_showhide_imageview);
holder.exerciseSearchField = (EditText) row.findViewById(R.id.trainingpass_exercise_searchfield);
holder.repsTextField = (EditText) row.findViewById(R.id.trainingpass_reps_txtfield);
holder.addSetButton = (Button) row.findViewById(R.id.add_set_button);
holder.addExerciseButton = (Button) row.findViewById(R.id.trainingpass_addexercise_button);
holder.setsListView = (ListView) row.findViewById(R.id.trainingpass_sets_listview);
holder.exercisesListView = (ListView) row.findViewById(R.id.trainingpass_exercises_listview);
holder.trainingPassRelativeLayout.setTag(holder.trainingPass);
holder.headlineTxt.setTag(holder.trainingPass);
holder.setNoTxt.setTag(holder.trainingPass);
holder.showHideIcon.setTag(holder.trainingPass);
holder.exerciseSearchField.setTag(holder.trainingPass);
holder.repsTextField.setTag(holder.trainingPass);
holder.addSetButton.setTag(holder.trainingPass);
holder.addExerciseButton.setTag(holder.trainingPass);
holder.setsListView.setTag(holder.trainingPass);
holder.exercisesListView.setTag(holder.trainingPass);
setupItems(holder);
return convertView;
}
private void setupItems(TrainingPassHolder trainingPassHolder) {
// TODO: set default values for items
}
public static class TrainingPassHolder {
TrainingPass trainingPass;
RelativeLayout trainingPassRelativeLayout;
TextView headlineTxt;
TextView setNoTxt;
ImageView showHideIcon;
EditText exerciseSearchField;
EditText repsTextField;
Button addSetButton;
Button addExerciseButton;
ListView setsListView;
ListView exercisesListView;
}
}
And here is the xml for the view, containing the listview:
<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:paddingLeft="#dimen/activity_horizontal_margin"
android:paddingRight="#dimen/activity_horizontal_margin"
android:paddingTop="#dimen/activity_vertical_margin"
android:paddingBottom="#dimen/activity_vertical_margin"
tools:context="com.mobileplatformexam.activities.CreateProgramActivity"
android:id="#+id/relativeLayoutCreateProgram">
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Add training pass"
android:id="#+id/btn_add_trainingpass"
android:layout_alignParentTop="true"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_toLeftOf="#+id/btn_add_trainingpass_help"
android:layout_toStartOf="#+id/btn_add_trainingpass_help"
android:onClick="addTrainingPass"/>
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="\?"
android:id="#+id/btn_add_trainingpass_help"
android:layout_alignParentTop="true"
android:layout_alignParentRight="true"
android:layout_alignParentEnd="true"
android:onClick="addTrainingPassHelp"/>
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Create program"
android:id="#+id/btn_create_program"
android:layout_alignParentBottom="true"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_alignRight="#+id/btn_add_trainingpass_help"
android:layout_alignEnd="#+id/btn_add_trainingpass_help"
android:onClick="createProgram"/>
<ListView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="#+id/listView_trainingpasses"
android:layout_above="#+id/btn_create_program"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_below="#+id/btn_add_trainingpass" />
</RelativeLayout>
And the xml file with the item layout for the above listview:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical" android:layout_width="match_parent"
android:layout_height="match_parent">
<RelativeLayout
android:id="#+id/trainingpass_item_relativelayout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_gravity="center_horizontal">
<TextView
android:id="#+id/trainingpass_headline"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="false"
android:layout_alignParentTop="true"
android:text="Trainingpass"
android:textSize="26dp"
android:textColor="#android:color/white"
android:background="#android:color/holo_blue_dark"
android:height="50dp"
android:gravity="center_vertical"
android:paddingLeft="20dp"
android:layout_toLeftOf="#+id/trainingpass_showhide_imageview"
android:layout_toStartOf="#+id/trainingpass_showhide_imageview"
android:textIsSelectable="true"
android:textStyle="bold" />
<ImageView
android:id="#+id/trainingpass_showhide_imageview"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_alignParentEnd="true"
android:src="#drawable/abc_spinner_mtrl_am_alpha"
android:layout_alignParentTop="true"
android:background="#android:color/holo_blue_dark"
android:minWidth="50dp"
android:minHeight="50dp"
android:layout_alignBottom="#+id/trainingpass_headline" />
<EditText
android:id="#+id/trainingpass_exercise_searchfield"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#+id/trainingpass_headline"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_alignRight="#+id/trainingpass_showhide_imageview"
android:layout_alignEnd="#+id/trainingpass_showhide_imageview"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:hint="Name of exercise"
android:padding="15dp"
android:layout_marginTop="10dp" />
<TextView
android:id="#+id/txt_trainingpass_setno"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Set 1"
android:textSize="20dp"
android:textColor="#android:color/black"
android:paddingRight="30dp"
android:paddingLeft="10dp"
android:paddingTop="20dp"
android:paddingBottom="10dp"
android:layout_below="#+id/trainingpass_exercise_searchfield"
android:layout_toLeftOf="#+id/trainingpass_reps_txtfield"
android:layout_toStartOf="#+id/trainingpass_reps_txtfield" />
<EditText
android:id="#+id/trainingpass_reps_txtfield"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:hint="Reps"
android:padding="15dp"
android:width="160dp"
android:layout_alignBottom="#+id/txt_trainingpass_setno"
android:layout_toLeftOf="#+id/add_set_button"
android:layout_toStartOf="#+id/add_set_button"
android:layout_marginRight="10dp" />
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="#+id/add_set_button"
android:text="Add set"
android:layout_alignBottom="#+id/trainingpass_reps_txtfield"
android:layout_alignRight="#+id/trainingpass_exercise_searchfield"
android:layout_alignEnd="#+id/trainingpass_exercise_searchfield"
android:layout_below="#+id/trainingpass_exercise_searchfield" />
<ListView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="#+id/trainingpass_sets_listview"
android:layout_alignLeft="#+id/trainingpass_exercise_searchfield"
android:layout_alignStart="#+id/trainingpass_exercise_searchfield"
android:layout_below="#+id/txt_trainingpass_setno" />
<Button
android:text="Add exercise"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="#+id/trainingpass_addexercise_button"
android:layout_below="#+id/trainingpass_sets_listview"
android:layout_alignRight="#+id/add_set_button"
android:layout_alignEnd="#+id/add_set_button"
android:layout_alignLeft="#+id/trainingpass_sets_listview"
android:layout_alignStart="#+id/trainingpass_sets_listview" />
<ListView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="#+id/trainingpass_exercises_listview"
android:layout_below="#+id/trainingpass_addexercise_button"
android:layout_alignLeft="#+id/trainingpass_addexercise_button"
android:layout_alignStart="#+id/trainingpass_addexercise_button" />
</RelativeLayout>
</LinearLayout>
And this is the code for setting the adapter in my activity (extends Activity)
ArrayList<TrainingPass> trainingPasses = new ArrayList<TrainingPass>();
TrainingPass trainingPass = new TrainingPass();
trainingPass.setTrainingPassName("wefwef");
TrainingPass trainingPass2 = new TrainingPass();
trainingPass.setTrainingPassName("rwefhtr");
trainingPasses.add(trainingPass);
trainingPasses.add(trainingPass2);
ListView trainingPassesListView = (ListView)findViewById(R.id.listView_trainingpasses);
CreateProgramAdapter createProgramAdapter = new CreateProgramAdapter(CreateProgramActivity.this, trainingPasses);
trainingPassesListView.setAdapter(createProgramAdapter);
The error i am getting is this:
12661-12661/com.mobileplatformexam E/AndroidRuntime﹕ FATAL EXCEPTION: main
android.content.res.Resources$NotFoundException: Resource ID #0x7f04001a
at android.content.res.Resources.getValue(Resources.java:1019)
at android.content.res.Resources.loadXmlResourceParser(Resources.java:2107)
at android.content.res.Resources.getLayout(Resources.java:858)
at android.view.LayoutInflater.inflate(LayoutInflater.java:394)
at android.view.LayoutInflater.inflate(LayoutInflater.java:352)
at com.mobileplatformexam.Adapters.CreateProgramAdapter.getView(CreateProgramAdapter.java:56)
at android.widget.AbsListView.obtainView(AbsListView.java:2466)
at android.widget.ListView.measureHeightOfChildren(ListView.java:1244)
at android.widget.ListView.onMeasure(ListView.java:1155)
at android.view.View.measure(View.java:12807)
at android.widget.RelativeLayout.measureChildHorizontal(RelativeLayout.java:642)
at android.widget.RelativeLayout.onMeasure(RelativeLayout.java:424)
at android.view.View.measure(View.java:12807)
at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:4698)
at android.widget.FrameLayout.onMeasure(FrameLayout.java:293)
at android.view.View.measure(View.java:12807)
at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:4698)
at android.support.v7.internal.widget.ActionBarOverlayLayout.onMeasure(ActionBarOverlayLayout.java:453)
at android.view.View.measure(View.java:12807)
at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:4698)
at android.widget.FrameLayout.onMeasure(FrameLayout.java:293)
at android.view.View.measure(View.java:12807)
at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:4698)
at android.widget.LinearLayout.measureChildBeforeLayout(LinearLayout.java:1399)
at android.widget.LinearLayout.measureVertical(LinearLayout.java:690)
at android.widget.LinearLayout.onMeasure(LinearLayout.java:583)
at android.view.View.measure(View.java:12807)
at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:4698)
at android.widget.FrameLayout.onMeasure(FrameLayout.java:293)
at com.android.internal.policy.impl.PhoneWindow$DecorView.onMeasure(PhoneWindow.java:2218)
at android.view.View.measure(View.java:12807)
at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:1068)
at android.view.ViewRootImpl.handleMessage(ViewRootImpl.java:2452)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:137)
at android.app.ActivityThread.main(ActivityThread.java:4476)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:511)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:816)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:583)
at dalvik.system.NativeStart.main(Native Method)
The error refers to line 56 in my adapterclass, which is the following line:
convertView = inflater.inflate(R.layout.adapter_createprogram_trainingpasses_item, null);
I really can't seem to find out what may be wrong with the code, so I hope someone can help me out.
Thanks
Thanks to JafarKhQ, I solved the problem.
By changing the layout "adapter_createprogram_trainingpasses_item .xml" to the following, it worked:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:padding="10dp"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:orientation="horizontal">
<TextView
android:id="#+id/trainingpass_headline"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="false"
android:layout_alignParentTop="true"
android:text="Trainingpass"
android:textSize="20dp"
android:textColor="#android:color/white"
android:background="#android:color/holo_blue_dark"
android:height="30dp"
android:gravity="center_vertical"
android:paddingLeft="20dp"
android:layout_toLeftOf="#+id/trainingpass_showhide_imageview"
android:layout_toStartOf="#+id/trainingpass_showhide_imageview"
android:textIsSelectable="true"
android:textStyle="bold" />
<ImageView
android:id="#+id/trainingpass_showhide_imageview"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_alignParentEnd="true"
android:src="#drawable/abc_spinner_mtrl_am_alpha"
android:layout_alignParentTop="true"
android:background="#android:color/holo_blue_dark"
android:height="30dp"
android:minWidth="50dp"
android:layout_alignBottom="#+id/trainingpass_headline" />
<EditText
android:id="#+id/trainingpass_exercise_searchfield"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#+id/trainingpass_headline"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_alignRight="#+id/trainingpass_showhide_imageview"
android:layout_alignEnd="#+id/trainingpass_showhide_imageview"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:hint="Name of exercise"
android:padding="15dp"
android:layout_marginTop="10dp" />
<TextView
android:id="#+id/txt_trainingpass_setno"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Set 1"
android:textSize="20dp"
android:textColor="#android:color/black"
android:paddingRight="30dp"
android:paddingLeft="10dp"
android:paddingTop="20dp"
android:paddingBottom="10dp"
android:layout_below="#+id/trainingpass_exercise_searchfield"
android:layout_toLeftOf="#+id/trainingpass_reps_txtfield"
android:layout_toStartOf="#+id/trainingpass_reps_txtfield" />
<EditText
android:id="#+id/trainingpass_reps_txtfield"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:hint="Reps"
android:padding="15dp"
android:width="160dp"
android:layout_alignBottom="#+id/txt_trainingpass_setno"
android:layout_toLeftOf="#+id/add_set_button"
android:layout_toStartOf="#+id/add_set_button"
android:layout_marginRight="10dp" />
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="#+id/add_set_button"
android:text="Add set"
android:layout_alignBottom="#+id/trainingpass_reps_txtfield"
android:layout_alignRight="#+id/trainingpass_exercise_searchfield"
android:layout_alignEnd="#+id/trainingpass_exercise_searchfield"
android:layout_below="#+id/trainingpass_exercise_searchfield" />
<ListView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="#+id/trainingpass_sets_listview"
android:layout_alignLeft="#+id/trainingpass_exercise_searchfield"
android:layout_alignStart="#+id/trainingpass_exercise_searchfield"
android:layout_below="#+id/txt_trainingpass_setno" />
<Button
android:text="Add exercise"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="#+id/trainingpass_addexercise_button"
android:layout_below="#+id/trainingpass_sets_listview"
android:layout_alignRight="#+id/add_set_button"
android:layout_alignEnd="#+id/add_set_button"
android:layout_alignLeft="#+id/trainingpass_sets_listview"
android:layout_alignStart="#+id/trainingpass_sets_listview" />
<ListView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="#+id/trainingpass_exercises_listview"
android:layout_below="#+id/trainingpass_addexercise_button"
android:layout_alignLeft="#+id/trainingpass_addexercise_button"
android:layout_alignStart="#+id/trainingpass_addexercise_button" />
</RelativeLayout>

NullPointerException on a android Fragment

I’m trying to put some data into a bundle and transfer it to a fragment. But the log show me an error of NullPointerException in the fragment and I don't know what is the relation between the two.
The error code :
09-22 14:19:03.216 1918-1918/com.example.user.unchained E/AndroidRuntime﹕ FATAL EXCEPTION: main
Process: com.example.user.unchained, PID: 1918
java.lang.NullPointerException
at com.example.user.unchained.HeaderFragement.onCreate(HeaderFragement.java:85)
at android.support.v4.app.Fragment.performCreate(Fragment.java:1481)
at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:908)
at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1121)
at android.support.v4.app.BackStackRecord.run(BackStackRecord.java:682)
at android.support.v4.app.FragmentManagerImpl.execPendingActions(FragmentManager.java:1484)
at android.support.v4.app.FragmentManagerImpl$1.run(FragmentManager.java:450)
at android.os.Handler.handleCallback(Handler.java:733)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:136)
at android.app.ActivityThread.main(ActivityThread.java:5017)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:779)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:595)
at dalvik.system.NativeStart.main(Native Method)
The Fragment code :
#Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
if (getArguments() != null) {
mParam1 = getArguments().getString(ARG_PARAM1);
mParam2 = getArguments().getString(ARG_PARAM2);
}
name = (TextView) getView().findViewById(R.id.nameH);
img = (ImageView) getView().findViewById(R.id.imageViewHeader);
Bundle infos = getArguments();
name.setText(infos.getString("Name"));
img.setImageBitmap(getBitmapFromURL(infos.getString("ImgUrl")));
//Name.setText(Name.getText()+" "+infos.getString("Name"));
}
The Activity in which i put data in the bundle.
protected void onPostExecute(final String res) {
//LoginTask = null;
//showProgress(false);
try {
jObj = new JSONObject(res);
} catch (JSONException e) {
e.printStackTrace();
}
try {
if (jObj.getString("code").equals("1")) {
infos = new Bundle();
infos.putString("ID",jObj.getString("ID"));
infos.putString("Name",jObj.getString("display_name"));
infos.putString("ImgUrl","http://unchained-network.com/uploads/profilpics/53f5c570b6ac2.png");
android.support.v4.app.FragmentTransaction tr = getSupportFragmentManager().beginTransaction();
HeaderFragement hf = new HeaderFragement();
//Charger les infos dans l'activité
hf.setArguments(infos);
tr.replace(R.id.frgmnt, hf);
tr.commit();
Intent myIntent = new Intent(getActivity(), HomesActivity.class);
//Lançer l'activité
startActivityForResult(myIntent, 0);
} else {
//password.setError(getString(R.string.error_incorrect_password));
//password.requestFocus();
AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
builder.setTitle("Error !");
builder.setMessage("The information entered is incorrect.\nPlease try again!")
.setCancelable(false)
.setPositiveButton("OK", new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int id) {
dialog.cancel();
}
});
AlertDialog alert = builder.create();
alert.show();
}
} catch (JSONException e) {
e.printStackTrace();
}
}
The layout
<?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:background="#000"
android:orientation="vertical" >
<!-- Login progress -->
<ProgressBar
android:id="#+id/login_progress"
style="?android:attr/progressBarStyleLarge"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginTop="50dp"
android:visibility="gone"/>
<ScrollView
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1" >
<LinearLayout
android:id="#+id/login_form"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:paddingBottom="10dp"
android:paddingLeft="15dp"
android:paddingRight="15dp"
android:paddingTop="5dp" >
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="#+id/logo"
android:focusableInTouchMode="true"
android:src="#drawable/unchained_beta_logo"
android:layout_marginTop="20dp"
android:gravity="center"
android:contentDescription="Unchained-Network Logo"
android:layout_alignParentTop="true"
android:layout_alignParentRight="true"
android:layout_alignParentEnd="true" />
<EditText
style="#style/SignInEditText"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:completionThreshold="1"
android:inputType="textEmailAddress"
android:layout_marginTop="64dp"
android:layout_below="#+id/logo"
android:layout_alignParentRight="true"
android:layout_alignParentEnd="true"
android:id="#+id/email"
android:hint="Email" />
<EditText
style="#style/SignInEditText"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:completionThreshold="1"
android:inputType="textPassword"
android:layout_marginTop="20dp"
android:layout_below="#+id/email"
android:layout_alignParentRight="true"
android:layout_alignParentEnd="true"
android:id="#+id/password"
android:hint="Password" />
<Button
android:id="#+id/connexion"
style="#style/ShadowText"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginTop="50dp"
android:layout_below="#+id/password"
android:background="#color/green_android"
android:gravity="center"
android:padding="10dp"
android:textColor="#fff"
android:textSize="20sp"
android:textStyle="bold"
android:text="Go Ride !"
/>
<TextView
android:layout_width="200dp"
android:id="#+id/passf"
style="#style/ShadowText"
android:layout_height="30dp"
android:layout_marginLeft="70dp"
android:text="Forgotten your password?"
android:layout_marginTop="20dp"
android:gravity="center"
android:textSize="10sp"
android:textStyle="bold"
android:textColor="#feed01" />
<TextView
android:layout_width="200dp"
style="#style/ShadowText"
android:layout_height="30dp"
android:layout_marginLeft="70dp"
android:text="No account yet ? Get one "
android:layout_marginTop="5dp"
android:gravity="center"
android:id="#+id/newaccount"
android:textSize="14sp"
android:textStyle="bold"
android:textColor="#fff" />
</LinearLayout>
</ScrollView>
</LinearLayout>
onCreate() is too early to call getView() and it will return null. Postpone the code that needs to touch the fragment's view hierarchy to onCreateView() or later in the fragment lifecycle.
you should add your fragment container inside your main layout. then you will do that replacement using this layout
<LinearLayout
android:id="#+id/frgmnt"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="vertical" />
change your layout with this
<?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:background="#000"
android:orientation="vertical" >
<!-- Login progress -->
<ProgressBar
android:id="#+id/login_progress"
style="?android:attr/progressBarStyleLarge"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginTop="50dp"
android:visibility="gone"/>
<ScrollView
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1" >
<LinearLayout
android:id="#+id/login_form"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:paddingBottom="10dp"
android:paddingLeft="15dp"
android:paddingRight="15dp"
android:paddingTop="5dp" >
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="#+id/logo"
android:focusableInTouchMode="true"
android:src="#drawable/unchained_beta_logo"
android:layout_marginTop="20dp"
android:gravity="center"
android:contentDescription="Unchained-Network Logo"
android:layout_alignParentTop="true"
android:layout_alignParentRight="true"
android:layout_alignParentEnd="true" />
<EditText
style="#style/SignInEditText"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:completionThreshold="1"
android:inputType="textEmailAddress"
android:layout_marginTop="64dp"
android:layout_below="#+id/logo"
android:layout_alignParentRight="true"
android:layout_alignParentEnd="true"
android:id="#+id/email"
android:hint="Email" />
<EditText
style="#style/SignInEditText"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:completionThreshold="1"
android:inputType="textPassword"
android:layout_marginTop="20dp"
android:layout_below="#+id/email"
android:layout_alignParentRight="true"
android:layout_alignParentEnd="true"
android:id="#+id/password"
android:hint="Password" />
<Button
android:id="#+id/connexion"
style="#style/ShadowText"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginTop="50dp"
android:layout_below="#+id/password"
android:background="#color/green_android"
android:gravity="center"
android:padding="10dp"
android:textColor="#fff"
android:textSize="20sp"
android:textStyle="bold"
android:text="Go Ride !"
/>
<TextView
android:layout_width="200dp"
android:id="#+id/passf"
style="#style/ShadowText"
android:layout_height="30dp"
android:layout_marginLeft="70dp"
android:text="Forgotten your password?"
android:layout_marginTop="20dp"
android:gravity="center"
android:textSize="10sp"
android:textStyle="bold"
android:textColor="#feed01" />
<TextView
android:layout_width="200dp"
style="#style/ShadowText"
android:layout_height="30dp"
android:layout_marginLeft="70dp"
android:text="No account yet ? Get one "
android:layout_marginTop="5dp"
android:gravity="center"
android:id="#+id/newaccount"
android:textSize="14sp"
android:textStyle="bold"
android:textColor="#fff" />
</LinearLayout>
</ScrollView>
<LinearLayout
android:id="#+id/frgmnt"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="vertical" />
</LinearLayout>

Categories