|
|
Start here.
"One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
"You can easily judge the character of a man by how he treats those who can do nothing for him." - James D. Miles
|
|
|
|
|
Hi;
I am new to Android, and I am making a book reader (not for all books) but only for one textbook. I started with the demo for multi-pages in Android developers section and I added some text to it. My question is, is that the correct example I used (TextView)? here is my code:
I ma saving the strings in "String.xml" file.
public class MainActivity extends AppCompatActivity {
private SectionsPagerAdapter mSectionsPagerAdapter;
private ViewPager mViewPager;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
setSupportActionBar(toolbar);
mSectionsPagerAdapter = new SectionsPagerAdapter(getSupportFragmentManager());
mViewPager = (ViewPager) findViewById(R.id.container);
mViewPager.setAdapter(mSectionsPagerAdapter);
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
getMenuInflater().inflate(R.menu.menu_main, menu);
return true;
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
int id = item.getItemId();
if (id == R.id.action_settings) {
PlaceholderFragment p = PlaceholderFragment.newInstance(1);
return true;
}
return super.onOptionsItemSelected(item);
}
public class SectionsPagerAdapter extends FragmentPagerAdapter {
public SectionsPagerAdapter(FragmentManager fm) {
super(fm);
}
@Override
public Fragment getItem(int position) {
return PlaceholderFragment.newInstance(position + 1);
}
@Override
public int getCount() {
return 604;
}
@Override
public CharSequence getPageTitle(int position) {
switch (position) {
case 0:
return "SECTION 1";
case 1:
return "SECTION 2";
case 2:
return "SECTION 3";
}
return null;
}
}
public static class PlaceholderFragment extends Fragment {
private static final String ARG_SECTION_NUMBER = "section_number";
private static final String ARG_PAGE_NUMBER = "page_number";
public static PlaceholderFragment newInstance(int sectionNumber) {
PlaceholderFragment fragment = new PlaceholderFragment();
Bundle args = new Bundle();
args.putInt(ARG_SECTION_NUMBER, sectionNumber);
fragment.setArguments(args);
return fragment;
}
public PlaceholderFragment() {
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
View rootView = inflater.inflate(R.layout.fragment_main, container, false);
TextView textView = (TextView) rootView.findViewById(R.id.section_label);
textView.setTextSize(20);
int page_number_to_go =1;
page_number_to_go = getArguments().getInt(ARG_SECTION_NUMBER);
goToPage(textView, page_number_to_go);
return rootView;
}
public void goToPage(TextView textView, int page_number){
switch (page_number){
case 1:
textView.setText(getString(R.string.page1));
break;
case 2:
textView.setText(getString(R.string.page2));
break;
case 3:
textView.setText(getString(R.string.page3));
break;
case 4:
textView.setText(getString(R.string.page4));
break;
case 5:
textView.setText(getString(R.string.page5));
break;
case 6:
textView.setText(getString(R.string.page6));
break;
case 7:
textView.setText(getString(R.string.page7));
break;
case 8:
textView.setText(getString(R.string.page8));
break;
case 9:
textView.setText(getString(R.string.page9));
break;
case 10:
textView.setText(getString(R.string.page10));
break;
case 11:
textView.setText(getString(R.string.page11));
break;
case 12:
textView.setText(getString(R.string.page12));
break;
}
|
|
|
|
|
Ali_Abdelrhim wrote: My question is, is that the correct example I used (TextView)? Does it meet all of your needs and do what you want?
"One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
"You can easily judge the character of a man by how he treats those who can do nothing for him." - James D. Miles
|
|
|
|
|
|
So, then, do you think it would be helpful to elaborate on what it is currently doing vs. what you want it to do?
|
|
|
|
|
can't run the app in android studio.
|
|
|
|
|
how to code for security feature in android studio for two-way authentication?
|
|
|
|
|
|
have installed android studio in my desktop. it is the first time to interact with,, how should i begin?
|
|
|
|
|
|
Member 13290839 wrote: how should i begin? By starting here.
"One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
"You can easily judge the character of a man by how he treats those who can do nothing for him." - James D. Miles
|
|
|
|
|
I'm currently developing a mobile quiz app that is going to be used by multiple participants they will connect to the local server via wifi and I have this idea of issuing a command from the server that chooses what activity/screen to show in my app. Is this possible?
I just want to know the main logic of this, I'm still at the android app development and haven't started on the server side for my mobile app. I'm planning on using php, json and wamp to connect to my local server, is this a good idea? if not, what software should I use for this particular system? Any answer would be appreciated.
|
|
|
|
|
Gemson Gonzales wrote: issuing a command from the server that chooses what activity/screen to show in my app. Is this possible? Well it is only possible after the mobile calls into the server. I would suggest you go to Android Tutorials[^] first, and study Android programming.
|
|
|
|
|
A am a newbie in android, and I want to make a color detection app, but don't know where to start.
Can someone please point me in the right direction, and suggest some articles I could read and some examples I could view to make this app?
I found this example:
Color detection in android - Android Discussion Boards
But I don't know how to get int values for red green and blue from a camera.
If someone could please tell me how to do so, I would really appreciate it.
Thanks in advance.
modified 18-Jun-17 16:14pm.
|
|
|
|
|
Member 10850253 wrote: I found this example: What example? The link points to your original question.
Member 10850253 wrote: how to get int values for red green and blue from a camera. See this[^] SO answer to retrieve the image taken by the camera. Once you have the image, use the bitmap's getPixels() method to retrieve its pixels.
If you're just getting started in Android, you may have bitten off more than you can chew. I'm not saying you won't be able to solve your problem, but you may want to proceed step by step and first gain more familiarity with programming in Android.
/ravi
|
|
|
|
|
Member 10850253 wrote: A am a newbie in android, Go to [^] where you will find lots of useful information.
|
|
|
|
|
please help me send online appointment app code
|
|
|
|
|
Sorry, this site does not provide code to order. There are many free and commercial applications that can do what you want.
|
|
|
|
|
Sure. Ask a question first.
There are two kinds of people in the world: those who can extrapolate from incomplete data.
There are only 10 types of people in the world, those who understand binary and those who don't.
|
|
|
|
|
How can I change tempo of a jetfile in android?
|
|
|
|
|
Does this help?
"One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
"You can easily judge the character of a man by how he treats those who can do nothing for him." - James D. Miles
|
|
|
|
|
Hello world,
I'm working on an android app for cardboard. The purpose of the app is to make augmented reality and for the moment the only thing you can do with it is to see through the smartphone's camera. I got this functionnality from this project : https://github.com/SalahEddin/CardboardPassthrough
My problem is that I would like to show some text to the user but I don't know how to make it properly in order for the text to be shown in the two squares of the GvrView. In oder words I would like something like this : screenshot
Here are some code elements that you can find in the GitHub project.
MainActivity.Java
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_live_counting_vr);
setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);
cardboardView = (GvrView) findViewById(R.id.cardboard_view);
cardboardView.setRenderer(this);
setGvrView(cardboardView);
}
activity_main.xml
<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:paddingBottom="@dimen/activity_vertical_margin"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
tools:context=".MainActivity" >
<com.google.vrtoolkit.cardboard.CardboardView
android:id="@+id/cardboard_view"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_alignParentTop="true"
android:layout_alignParentLeft="true" />
</RelativeLayout>
Thanks
|
|
|
|
|
Thank you! I really need it
|
|
|
|
|