Get Even More Visitors To Your Blog, Upgrade To A Business Listing >>

SOLVED: White screen showing up while calling fragment

BOTJr.:

I am new to android, so , i have been playing with fragments to understand how they work.

Firstly, i made a calciKeyboard class which extends Fragment

Code:


public class calciKeyboard extends Fragment {
@Nullable
Button b;

public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, Bundle savedInstanceState) {

GridLayout gridLayout=(GridLayout) inflater.inflate(R.layout.calci_keyboard,container,false);
for(int i=0;i b=(Button)gridLayout.getChildAt(i);
if (b != null) {
b.setBackground(getResources().getDrawable(R.drawable.button_dark_gradient));
}
}
return gridLayout;
}
}

calciKeyboard.xml



android:layout_width="match_parent"
android:layout_height="match_parent"
android:rowCount="4"
android:columnCount="4"
>
Buttons inside....


advance_mix


public class advance_mix extends Activity {
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.advance_length);
}
}

advance_length



android:layout_width="match_parent"
android:layout_height="match_parent">

android:layout_height="wrap_content"
android:name="com.example.tilak.myfirstapplication.calciKeyboard"
android:id="@+id/calciKeyboard" />


go_advance.java


findViewById(R.id.redirectLength).setOnClickListener(
new View.OnClickListener() {
@Override
public void onClick(View view) {
Intent i=new Intent(go_advance.this,advance_mix.class);
startActivity(i);
}
}
);

go_advance class contains the intent which starts the advance_mix activity, which further lays out the advance_length layout file.

The problem is when redirect_length button is clicked it shows me a white screen?

Why is it happening?



Posted in S.E.F
via StackOverflow & StackExchange Atomic Web Robots
This Question have been answered
HERE


This post first appeared on Stack Solved, please read the originial post: here

Share the post

SOLVED: White screen showing up while calling fragment

×

Subscribe to Stack Solved

Get updates delivered right to your inbox!

Thank you for your subscription

×