Questions tagged [main-activity]

The main activity is the one which starts before the other ones.

201 questions
0
votes
3 answers

How AsyncTask returns parameters to MainActivity

I am new to android. I have written a asynctask class which takes one string as parameter. Asynctask class has two functions doinbackground and onpostexecute. doinbackground is doing a httppost and if the post is successful it is returning a string…
0
votes
1 answer

NoClassDefFoundError in SplashScreen

In my App, it opens a Splash Screen then MainActivity. I wrote the following code SplashActivity.java public class SplashActivity extends Activity { private final int SPLASH_DISPLAY_LENGHT = 2000; @Override protected void…
Eman87
  • 2,735
  • 7
  • 36
  • 53
0
votes
1 answer

App has stopped unexpectedly, and i don't know why

I get no errors but when I run the app it crashes and I don't know why! Here is the code, I am sure the error is here because it was working until here. I've been trying to search for the problem for about 4 hours and still have no clue! public…
0
votes
1 answer

how do i programatically access main activity from surfaceview to remove adView

My main activity calls my Surfaceview game, setting a layout with an adview and surfaceview added (initially I did not use a layout at all before I had to ad the banner). however I have not been able to access the main activity from surfaceview to…
Androidcoder
  • 4,389
  • 5
  • 35
  • 50
0
votes
1 answer

phonegap: MainActivity.java - changing extends to "Droidgap" causes errors

I'm trying to set up phonegap for 3 days now. The docs will only get me to the "phonegap add android" part which returns an error so I tried this tutorial from…
ProblemsOfSumit
  • 19,543
  • 9
  • 50
  • 61
0
votes
2 answers

Android out of memory error on choosing second image

My app works by stepping out of main activity, starts a second activity, displays an image chosen by user and analyzes the image. After the analysis of the first image, I used the back button to go back to the main activity and proceed to the second…
jop
  • 121
  • 1
  • 2
  • 9
0
votes
1 answer

Trying to use create a new instance of the MainActivity with a different layout

So in my main activity I have a listView, a custom ArrayAdapter, and a Connection to the database. This works all just fine ! When I click one of the item, I'm redirected to a second activity, which Logs/Registers the user. Then after successful…
hayonj
  • 1,429
  • 3
  • 21
  • 28
0
votes
5 answers

BackButton calls previous activity

Use of this code I call Next Activity. Code public void click_contact(View v) { Intent myIntent = new Intent(MainActivity.this, ContactActivity.class); MainActivity.this.startActivity(myIntent); overridePendingTransition (R.anim.slide_in_right,…
RaulPop
  • 25
  • 5
0
votes
0 answers

Canvas containing bitmap size proper adjustment in landscape and portrait mode

Consider the following image as an example: Landscape mode In Landscape mode, there are 2 sides viz- left side containing fragment 1 and right side containing fragment 2. The left side (fragment 1) view is fine meaning - buttons are proper, text…
sjain
  • 23,126
  • 28
  • 107
  • 185
0
votes
2 answers

Stop LoginActivity from popping out onResume()

I got two activities.....LoginActivity(Launcher Activity) and MainActivity. When the app is installed and started the LoginActivity is invoked and on entering the username and password, it authenticate from a server and starts the MainActivity. This…
ASP
  • 3,645
  • 1
  • 31
  • 45
0
votes
1 answer

how range the main screen's icons when switch between two languages?

I tried to arrange my icons in main screen in English version & it's ok, but when switch the language to Arabic Version, main screen works with unsuitable arrangement each icon in place far of another.. How I can solve this problem ?? this is a…
0
votes
1 answer

How to create a file in the internal storage only during the installation process?

I would like to know how to create a file in the internal storage only during the .apk installing. My problem is that when I put the file with the onCreate method of MainActivity, everytime I relaunch the application, the content of my file is…
Bob Nalyd
  • 21
  • 1
  • 5
0
votes
2 answers

Accessing your Main Activity from another package

I am using libGDX. Created a project and there are two packages as appName, appName-android. My codes are in appName, but MainActivity.java is in the appName-android package. I set the admob advertise in the MainActivity but i don't want to have it…
Ozan Atmar
  • 270
  • 1
  • 3
  • 11
0
votes
2 answers

Can't call main Activity from service

In Service of Keyboard i cant start Main Activity: public void onKey(int primaryCode, int[] keyCodes) Log.d(TAG, primaryCode + " PrimaryCode to send"); if (primaryCode == 6) { Intent intent = new Intent(this, MainActivity.class); …
user1755546
  • 1,049
  • 2
  • 13
  • 27
-1
votes
2 answers

Define MainActivity as static variable in order to access findViewById method

While I was coding, I wanted to use findViewById method to find a view that cant access in the current view but can be accessed via the MainActivity. So two options came to my mind. One is creating a static method from that object in the…
Lloyd95
  • 73
  • 7