Android Studio Tutorial - 69 - Fragment Example

preview_player
Показать описание
This video demonstrate a simple android fragment example using android studio.
Рекомендации по теме
Комментарии
Автор

If you're having the error " Can't resolve method

Then follow the next steps to modify your code and have it working ;


1 - first remove all the two fragment libraries and replace them with following two :

import
import


2- Do not extend your class from Activity, instead extend from AppCompatActivity



3- Instead of using getFragmentManager(); use getSupportFragmentManager();



Enjoy the view now,

k.a.
Автор

ExtraOrdinary Stuff....superb implementation and presentation..!! THANK YOU SIR

pradeep
Автор

Dear Sir Namaskar. Firstly I wish you and your family a very happy Diwali.Sir
I had gone through your fragment tutorials in Android Studio.I tried
running Fragment application created in Android Studio in my physical
device i.e. Samsung Galaxy J7(2016).But could not able to run it. When I
Tap the application in my Device the following message
came-"Unfortunately Application name has stopped".But all the simple
apps are running smoothly in my device.I tried clear catch and clear
data in my device and reboot my device then too the Fragment app is not
running.Please help me in this regard.Eagerly waiting for your reply

pelesengupta
Автор

Great stuff! Thank you for sharing your knowledge!

chrispretorius
Автор

VERY GOOD !! I LIKED!
I will join your channel Sir. Thanks!

surfistadomercado
Автор

Those who are getting error “ *cannot resolve method add(int, fragment)* ”
Here is solutions
In your fragments check the import statement and instead of
import
Use
Import android.support.app.Fragment;

shubhamshinde
Автор

Incompatible Type:

Required: import
Found :android.app.FragmentManager


I have already add these

import
import but still showing above error

ignousan
Автор

FragmentManager manager = getSupportFragmentManager();
transaction = manager.beginTransaction();
BlankFragment frag = new BlankFragment();
transaction.add(R.id.frame, frag);
transaction.commit();

hildebertomelo
Автор

When I'm trying to run the application it is saying unfortunately your application has stopped.

magarwal
Автор

Error:(30, 40) error:
no suitable method found for add(int, FragmentOne)

method FragmentTransaction.add(Fragment, String) is not applicable
(argument mismatch; int cannot be converted to Fragment)

method FragmentTransaction.add(int, Fragment) is not applicable
(argument mismatch; FragmentOne cannot be converted to Fragment)

How should I fix the error, please?

wili
Автор

i am getting an error
cannot resolve method 'add(int, com.wub
can you please explain

shankarreddy
Автор

hello sir how can i put this a video inside the fragment? how is the flow of the code sorry im too newly in android studio.

alkamargustaham
Автор

another question: when do we use fragments, what condition we have to use fragments.

masbro
Автор

thanks for the really well explanation.
could you maybe make a video about the immersive mode in android

miladimohamed
Автор

u did not show us how the fragment class looks and what methods(if any) need to be overridden

sumitbhujel
Автор

how can I remove the button from moving to fragment?

jungabrielcodog
Автор

so fragment is activity inside activity.. is it not?

masbro
Автор

Great tutorial.. Thanks for the upload.

direndrasubba